Overview
All sensitive cryptographic operations happen client-side using the Web Crypto API. The client SDK provides functions for key derivation, encryption/decryption, TOTP code generation, and family vault key management.Key derivation
deriveVaultKey(masterPassword, salt)
Derives a CryptoKey from the master password and user salt using Argon2id.
| Function | Memory | Iterations | Use case |
|---|---|---|---|
deriveVaultKeyRaw() | 64 MiB | 3 | Default |
deriveVaultKeyRawLowMemory() | 32 MiB | 4 | Constrained devices |
deriveVaultKeyRawHighMemory() | 128 MiB | 2 | High-security |
Uint8Array (raw key bytes) instead of a CryptoKey.
Encryption and decryption
encryptWithVaultKey(key, plaintext)
Encrypts a string with AES-256-GCM using the vault key.
decryptWithVaultKey(key, payload)
Decrypts an EncryptedPayload back to plaintext.
Types
EncryptedPayload
Cipher constants
Salt management
generateVaultSalt()
Generate a cryptographically random salt for vault key derivation.
Recovery key
hashRecoveryKey(key)
Hash a recovery key for server-side storage and verification.
encryptVaultKeyWithRecoveryKey(rawKey, recoveryKeyHex)
Wrap the vault key with a recovery key for backup storage.
decryptVaultKeyWithRecoveryKey(blob, recoveryKeyHex)
Recover the vault key using a recovery key.
Family vault keys
wrapFamilyKeyForInvite(familyKey, inviteToken, salt?)
Wrap the family vault key for sharing via an invite token.
unwrapFamilyKey(wrapped, userVaultKey)
Unwrap a family vault key using the user’s vault key.
unwrapFamilyKeyFromInvite(wrapped, inviteToken, salt?)
Unwrap a family vault key from an invite token.
Base64 utilities
TOTP client
Client-side TOTP code generation for zero-trust 2FA.generateSecret(bytes?)
Generate a new TOTP secret.
generateTotp(secret, now?, opts?)
Generate a current TOTP code.
{ step: 30, digits: 6, algorithm: 'SHA-1' }
buildOtpauthUrl(options)
Generate an otpauth:// URL for QR code display.