API Reference
Crypt Library
Encoding, hashing, and symmetric encryption helpers.
crypt.base64encode(data: string): stringEncodes a string as base64.
crypt.base64decode(data: string): stringDecodes a base64 string.
crypt.encrypt(data: string, key: string, iv: string?, mode: string?): (string, string)Encrypts data and returns the result with its initialisation vector.
crypt.decrypt(data: string, key: string, iv: string, mode: string): stringDecrypts data produced by crypt.encrypt.
crypt.hash(data: string, algorithm: string): stringHashes a string with the named algorithm.
crypt.generatebytes(size: number): stringReturns a base64 string of random bytes.
crypt.generatekey(): stringReturns a random base64 key suitable for crypt.encrypt.
base64encode(data: string): stringAlias for crypt.base64encode.
base64decode(data: string): stringAlias for crypt.base64decode.