@openvireo/sdk - v1.0.0
    Preparing search index...

    Class Account

    Index
    core: Account

    The core's account handle, for everything this class doesn't wrap (orgs, devices, audit, billing…).

    • get auth(): AuthClient

      The typed client of the account server's routes (openapi.yaml), signed in with this session: it borrows the core's access token (and has the core refresh it on a 401). For the routes the core doesn't wrap; JSON is the server's (snake_case).

      Returns AuthClient

    • get deletionScheduledFor(): string | null

      The erase date while the account is scheduled for deletion (SPEC.md §23), else null.

      Returns string | null

    • get email(): string | undefined

      Returns string | undefined

    • get fingerprint(): string

      this account's public key fingerprint (to compare out of band)

      Returns string

    • get offline(): boolean

      True while the servers can't be reached and this account works from the offline cache.

      Returns boolean

    • get principal(): string

      Returns string

    • get shareBase(): string | null

      Where this server's share links point (config.share, else ${config.web}/s), or null.

      Returns string | null

    • get signedIn(): boolean

      Returns boolean

    • get unlocked(): boolean

      Returns boolean

    • get userId(): string | undefined

      Returns string | undefined

    • Parameters

      • p: { code: string; email: string; password: string }

      Returns Promise<void>

    • Parameters

      • p: { current: string; kdf?: { m?: number; p?: number; t?: number }; next: string }

      Returns Promise<void>

    • Parameters

      • userId: string

      Returns Promise<"ended" | "valid" | "no_answer">

    • Confirms an accepted member (SPEC §12) and grants vaults. The core fetches and verifies the member's keys. Takes a member from account.auth.listMembers (snake_case) or account.core.orgMembers.

      Parameters

      • orgId: string
      • member: Member | Member
      • vaults: { id: string; role: VaultRole }[] = []

      Returns Promise<Member>

    • Creates a service account in an org; token (shown once) is what CI uses.

      Parameters

      • orgId: string
      • p: {
            expiresAt?: string | null;
            name: string;
            secretName?: string;
            vaults?: { id: string; role: VaultRole }[];
        }

      Returns Promise<{ serviceAccount: ServiceAccountInfo; token: string }>

    • Creates a vault (in an org with orgId) and uploads it empty.

      Parameters

      • name: string
      • opts: { orgId?: string } = {}

      Returns Promise<AccountVault>

    • Parameters

      • p: { confirm: string; password: string }

      Returns Promise<{ scheduledFor: string }>

    • Parameters

      • email: string

      Returns Promise<void>

    • Whether this device can sign in to email without being given the Secret Key.

      Parameters

      • email: string

      Returns Promise<boolean>

    • Imports an open local vault as a new account vault (re-keyed with a fresh vault key). Throws VaultUploadError (holding the new vault) when it was created but the first upload failed.

      Parameters

      • source: Vault
      • opts: { name?: string; orgId?: string } = {}

      Returns Promise<AccountVault>

    • Issues another secret (token) for a service account.

      Parameters

      • saId: string
      • p: { expiresAt?: string | null; name?: string } = {}

      Returns Promise<{ id: string; prefix: string; token: string }>

    • This account's share links, newest first, with where each came from when this account can read that.

      Returns Promise<ShareListing[]>

    • Every vault this account can open, with names decrypted (offline: the cached list).

      Returns Promise<VaultInfo[]>

    • Returns void

    • Signs in (OPAQUE) and unlocks. totp is a code or a prompt asked again after a wrong code.

      Parameters

      • p: {
            email: string;
            password: string;
            secretKey?: string;
            totp?: string | TotpPrompt;
            trustDevice?: boolean;
        }

      Returns Promise<void>

    • Signs out (and with forgetDevice drops the kept Secret Key and device id).

      Parameters

      • opts: { forgetDevice?: boolean } = {}

      Returns Promise<void>

    • Locks and signs out with a keepalive request, for pagehide.

      Returns void

    • Parameters

      • userId: string

      Returns Promise<void>

    • The signed-in user's profile: plan, orgs, two-step status, and the keyset's kdf parameters and signature-checked publicKeys (with fingerprint). Keys that don't verify are invalid_public_keys.

      Returns Promise<Profile>

    • Called when the server ends this session (token reused, expired, signed out elsewhere, deletion).

      Parameters

      Returns () => void

    • Downloads and opens a vault (offline: the cached copy).

      Parameters

      • vaultId: string

      Returns Promise<AccountVault>

    • Parks this session (switching accounts) so resumeSession can come back to it without signing in.

      Returns Promise<boolean>

    • Back online after working offline: syncs and returns the vault list and the vaults no longer listed.

      Returns Promise<{ dropped: string[]; vaults: VaultInfo[] }>

    • Completes an approved account reset (SPEC.md §18): new password and Secret Key; signs in.

      Parameters

      • p: {
            kdf?: { m?: number; p?: number; t?: number };
            password: string;
            token: string;
            trustDevice?: boolean;
        }

      Returns Promise<{ secretKey: string; userId: string }>

    • Parameters

      • token: string

      Returns Promise<RecoveryReset>

    • Creates an account. Returns the Secret Key to show once (Emergency Kit). Signs in and unlocks.

      Parameters

      • p: {
            email: string;
            kdf?: { m?: number; p?: number; t?: number };
            password: string;
            trustDevice?: boolean;
        }

      Returns Promise<{ secretKey: string; userId: string }>

    • Removes a member and rotates the keys of the vaults they could read.

      Parameters

      • orgId: string
      • userId: string

      Returns Promise<{ failed: { error: unknown; id: string }[]; rotated: string[] }>

    • Parameters

      • email: string

      Returns Promise<void>

    • Parameters

      • p: { password: string }

      Returns Promise<void>

    • Restores the vaults archived by a reset with the old password and Secret Key.

      Parameters

      • p: { oldPassword: string; oldSecretKey: string }

      Returns Promise<{ restored: number }>

    • Parameters

      • userId: string

      Returns Promise<boolean>

    • Unlocks from sealUnlocked's output. Throws decryption_failed for another key, user or server.

      Parameters

      • sealed: string
      • key: CryptoKey

      Returns Promise<void>

    • Removes access and rotates the vault key so the removed principals can't read new versions. A rotation left pending on the vault by this account (another device, or this one, stopped before activating) is finished first; one this account holds no key for is rotation_pending (409) until it is activated or, after 24 hours, replaced.

      Parameters

      • vaultId: string
      • principals: string[]

      Returns Promise<SyncReport>

    • Parameters

      • id: string

      Returns Promise<void>

    • Rotates the vault key (optionally removing principals), with revoke's pending-rotation rules.

      Parameters

      • vaultId: string
      • opts: { remove?: string[] } = {}

      Returns Promise<SyncReport>

    • Seals the unlocked keyset under key (AES-GCM, random IV, bound to this issuer and user), so a page can unlock again after a reload with resumeUnlocked instead of the master password. Pass a non-extractable AES-GCM key and keep the result apart from it.

      Parameters

      • key: CryptoKey

      Returns Promise<string>

    • The Secret Key this device keeps for the signed-in account, to show again; null when it keeps none.

      Returns Promise<string | null>

    • Changes an org role; promotion to owner/admin includes the SA master keys and manage on every org vault.

      Parameters

      Returns Promise<Member>

    • Grants a user (by email or principal) access to a vault; returns their principal and fingerprint. When the user was shown the grantee's fingerprint to compare first, use shareWithKeys.

      Parameters

      • vaultId: string
      • who: { email?: string; principal?: string }
      • role: VaultRole

      Returns Promise<{ fingerprint: string; principal: string }>

    • Shares a vault to the keys the user confirmed: keys are the grantee's public keys whose fingerprint was shown (e.g. trustedPublicKeys(await account.auth.lookupUser(email))). The core fetches the grantee's keys again and, if they are no longer keys (changed since they were shown), seals nothing and fails with invalid_public_keys.

      Parameters

      • vaultId: string
      • who: { email?: string; principal?: string }
      • role: VaultRole
      • keys: { encPk: Uint8Array; fingerprint?: string; sig: Uint8Array; signPk: Uint8Array }

      Returns Promise<{ fingerprint: string; principal: string }>

    • Server events: vault changes, access changes (the vault list is refetched) and the end of the session. Returns a handle to close.

      Parameters

      • handlers: {
            onError?: (e: unknown) => void;
            onVaultChanged?: (e: {}) => void;
            onVaultsChanged?: (vaults: VaultInfo[]) => void;
        } = {}

      Returns { close(): void }

    • Parameters

      • vaultId: string
      • to: string

      Returns Promise<void>

    • Unlocks a signed-in (resumed) session with the master password. With offline, an unreachable server falls back to the wrapped keyset cached at the last sign-in or unlock.

      Parameters

      • password: string
      • OptionalsecretKey: string

      Returns Promise<void>

    • The verified public keys of a user or service account (invalid_public_keys if the signature fails).

      Parameters

      • principal: string

      Returns Promise<PublicKeys>

    • A one-time link that signs the web app in as this account (SPEC.md §16).

      Parameters

      • Optionalnext: string

      Returns Promise<string>

    • Discovers the server and loads a stored session, if any (signed in but locked). With offline, an unreachable server falls back to the discovery document from the last successful connect.

      Parameters

      Returns Promise<Account>

    • Whether storage holds edits of this user's vaults not yet uploaded.

      Parameters

      Returns Promise<boolean>

    • Whether storage holds an active, parked or no session for this user (without connecting).

      Parameters

      Returns Promise<"signed_out" | "active" | "parked">