Skip to content
docs

Vault

Defined in: vault.ts:158

One Vault per storage area: writes to the envelope are serialized inside the instance, so two instances over the same area could still overwrite each other.

new Vault(options): Vault

Defined in: vault.ts:168

VaultOptions

Vault

addPasskey(dek, passkey): Promise<void>

Defined in: vault.ts:322

Register a passkey as a second unlock path: the DEK (from the unlocked session) is sealed under HKDF-SHA256(prf, salt = credential id). The password stays the recovery path; prf is zeroized here. A v1 envelope must be unlocked (and thereby upgraded) first, and the vault must hold a secret (it proves the DEK).

Uint8Array

number

string

string

Uint8Array

string

Promise<void>


changePassword(oldPassword, newPassword): Promise<void>

Defined in: vault.ts:243

Re-wrap the DEK under a new password (fresh salt, current KDF). Secrets and passkeys are untouched — and so is the DEK: after a suspected compromise (a copied profile, a leaked session, a lost passkey) this is not enough, because whoever holds the DEK still opens every secret, old and new. Use Vault.rotateVaultKey then.

string

string

Promise<void>


create(password): Promise<Uint8Array<ArrayBufferLike>>

Defined in: vault.ts:199

Create an empty vault protected by password. Returns the DEK — hand it to the session, then setSecret the first seed. Refuses when a vault exists.

string

Promise<Uint8Array<ArrayBufferLike>>


deleteSecret(sourceId): Promise<void>

Defined in: vault.ts:406

string

Promise<void>


destroy(): Promise<void>

Defined in: vault.ts:418

Remove the whole vault. The explicit destructive flow only (back up → wipe → create).

Promise<void>


exists(): Promise<boolean>

Defined in: vault.ts:182

Promise<boolean>


getSecret(dek, sourceId): Promise<Uint8Array<ArrayBufferLike> | null>

Defined in: vault.ts:397

Unseal one secret. null when the id is unknown; the caller zeroizes the result after use.

Uint8Array

string

Promise<Uint8Array<ArrayBufferLike> | null>


kdfInfo(): Promise<VaultKdfInfo | null>

Defined in: vault.ts:187

What protects the DEK right now (UI). null without a vault.

Promise<VaultKdfInfo | null>


listPasskeys(): Promise<object[]>

Defined in: vault.ts:302

Public view of the registered passkeys (ids, labels; whether each can verify assertions).

Promise<object[]>


listSecretIds(): Promise<string[]>

Defined in: vault.ts:372

Promise<string[]>


passkeyPublicKey(id): Promise<{ alg: number; publicKey: string; } | null>

Defined in: vault.ts:309

The SPKI public key (base64) of one passkey, for assertion verification; null when unknown.

string

Promise<{ alg: number; publicKey: string; } | null>


removePasskey(id): Promise<void>

Defined in: vault.ts:361

Forget one passkey’s box. A DEK that passkey already unwrapped stays valid: after a lost or compromised passkey, Vault.rotateVaultKey.

string

Promise<void>


rotateVaultKey(password): Promise<Uint8Array<ArrayBufferLike>>

Defined in: vault.ts:269

Replace the DEK (scan 2026-10-27 modules, F30): a fresh random DEK, every secret re-sealed under it, the DEK wrapped under password with a fresh salt — written as one envelope, so a failure leaves the old vault as it was. Returns the new DEK: hand it to session.unlock(dek), which overwrites the old one in chrome.storage.session. A DEK copied before the rotation opens nothing in the new envelope, and Vault.setSecret refuses it, so a stale session cannot seal new secrets under it.

Passkeys are dropped — their boxes hold the old DEK and cannot be re-wrapped without their PRF output — and must be registered again (Vault.addPasskey with the new DEK).

string

Promise<Uint8Array<ArrayBufferLike>>


setSecret(dek, sourceId, secret): Promise<void>

Defined in: vault.ts:381

Seal secret under the DEK as sourceId (overwrites an entry with the same id). The DEK must open the vault’s secrets (locked otherwise): a key retired by Vault.rotateVaultKey never seals a new one.

Uint8Array

string

Uint8Array

Promise<void>


unlock(password): Promise<Uint8Array<ArrayBufferLike>>

Defined in: vault.ts:214

Derive the KEK from password, unseal and return the DEK. wrong-password on failure. A v1 (PBKDF2) envelope that opens is re-sealed as v2 (scrypt) on the way out, secrets untouched.

string

Promise<Uint8Array<ArrayBufferLike>>


unlockWithPasskey(id, prf): Promise<Uint8Array<ArrayBufferLike>>

Defined in: vault.ts:345

Unseal the DEK with a passkey’s PRF output. wrong-password when the box does not open, missing when the id is unknown.

string

Uint8Array

Promise<Uint8Array<ArrayBufferLike>>