@cdr-kit/react/Hooks/useAccessVault

useAccessVault

Imperative access to one vault. Returns a discriminated status + the decrypted bytes when ready. The state machine behind <VaultGate> and <Vault>.
import { useAccessVault } from "@cdr-kit/react"

Signature

type
function useAccessVault(uuid: number): {
access: (accessAuxData?: Hex) => Promise<Uint8Array>;
status: "idle" | "collecting-partials" | "ready" | "error";
data?: Uint8Array;
error?: CdrError;
progress?: { collected: number; threshold: number };  // mock-mode only
};

States

  • idle — initial; call access() to begin.
  • collecting-partials — the ~15s threshold read.
  • readydata populated.
  • error — see error for the typed reason.