Skip to content

lib/auth/encryption

function decrypt(encrypted: Uint8Array): Uint8Array

Defined in: studiocms/packages/studiocms/src/lib/auth/encryption.ts:45

Decrypts the given encrypted data using AES-128-GCM.

Uint8Array

The encrypted data as a Uint8Array. The data must be at least 33 bytes long.

Uint8Array

The decrypted data as a Uint8Array.

Will throw an error if the encrypted data is less than 33 bytes.


function decryptToString(data: Uint8Array): string

Defined in: studiocms/packages/studiocms/src/lib/auth/encryption.ts:63

Decrypts the given Uint8Array data and returns the result as a string.

Uint8Array

The encrypted data as a Uint8Array.

string

The decrypted data as a string.


function encrypt(data: Uint8Array): Uint8Array

Defined in: studiocms/packages/studiocms/src/lib/auth/encryption.ts:16

Encrypts the given data using AES-128-GCM encryption.

Uint8Array

The data to be encrypted as a Uint8Array.

Uint8Array

The encrypted data as a Uint8Array, which includes the initialization vector (IV), the encrypted content, and the authentication tag.


function encryptString(data: string): Uint8Array

Defined in: studiocms/packages/studiocms/src/lib/auth/encryption.ts:34

Encrypts a given string and returns the encrypted data as a Uint8Array.

string

The string to be encrypted.

Uint8Array

The encrypted data as a Uint8Array.