API reference@evolu/common › Crypto

Cryptographic utilities.

Type-safe cryptographic operations including random bytes generation, SLIP21 key derivation, XChaCha20-Poly1305 symmetric encryption, PADMÉ padding, and timing-safe comparisons.

Functions

FunctionDescription
createPadmePaddedLengthReturns the PADMÉ padded length for a given input length.
createPadmePaddingCreates a PADMÉ padding array of zeros for the given input length.
createRandomBytes-
createSlip21SLIP21.
decryptWithXChaCha20Poly1305Decrypts ciphertext with XChaCha20-Poly1305.
deriveSlip21NodeDerives a single node in the SLIP-21 hierarchical key derivation.
encryptWithXChaCha20Poly1305Encrypts plaintext with XChaCha20-Poly1305.
testCreateRandomBytesCreates seeded random bytes for deterministic tests.

Interfaces

InterfaceDescription
DecryptWithXChaCha20Poly1305ErrorBase interface for objects with a discriminant type property.
RandomBytes-
RandomBytesDep-
TimingSafeEqualDep-

Type Aliases

Type AliasDescription
EncryptionKeyThe encryption key for symmetric encryption.
Entropy16-
Entropy24-
Entropy32-
Entropy64-
TimingSafeEqualPerforms a timing-safe comparison of two Uint8Arrays. Returns true if they are equal, false otherwise. Takes constant time regardless of where the arrays differ.
XChaCha20Poly1305CiphertextBranded Uint8Array for XChaCha20-Poly1305 encryption.

Variables

VariableDescription
EncryptionKeyThe encryption key for symmetric encryption.
Entropy16-
Entropy24-
Entropy32-
Entropy64-
XChaCha20Poly1305CiphertextBranded Uint8Array for XChaCha20-Poly1305 encryption.
xChaCha20Poly1305NonceLengthThe nonce length for XChaCha20-Poly1305 encryption.