Skip to main content

encrypt

@quik/core


@quik/core / encrypt

Function: encrypt()

encrypt(text): string

Defined in: utils/Crypto.ts:41

Encrypts plain text with the configured application key.

The returned value is a base64-encoded JSON payload that contains the encrypted text, initialization vector, and authentication tag required for decryption.

Parameters​

text​

string

Plain text value to encrypt.

Returns​

string

Throws​

MissingAppKeyError If crypto.appKey is not configured.

Throws​

Error If the configured key is invalid for the cipher.

Example​

const encrypted = encrypt("hello");