Skip to main content

AuthenticatedEncryption

@webda/core


Variable: AuthenticatedEncryption

const AuthenticatedEncryption: object

Defined in: packages/core/src/services/authenticatedencryption.ts:9

Authenticated encryption helpers used by the configuration encrypters

AES-256-GCM: the output is base64(iv(12) | tag(16) | ciphertext), decryption throws if the key is wrong or the data was altered.

Type Declaration​

decrypt()​

decrypt(key, data, aad?): string

Decrypt a string

Parameters​

key​

Uint8Array

32 bytes key

data​

string

the base64 encrypted value

aad?​

Uint8Array

the additional authenticated data given to encrypt, if any

Returns​

string

the plain value

encrypt()​

encrypt(key, data, aad?): string

Encrypt a string

Parameters​

key​

Uint8Array

32 bytes key

data​

string

the plain value

aad?​

Uint8Array

optional additional authenticated data, required again to decrypt

Returns​

string

the base64 encrypted value