/** * Sovereign-custody (FR-6) capability strategy — the three on-demand * operations the custody surface routes through: minting a custodian * (`grantCustodian`), removing one (`revokeCustodian`), and the audited * ownership-claim ceremony (`liberate`). The active engine ({@link withCustody}) * runs the grant/revoke impls the host exposes and dynamically imports the * heavy `liberateVault` ceremony (keeping it out of the floor bundle); * {@link NO_CUSTODY} throws. * * `Noydb.grantCustodian` / `Noydb.revokeCustodian` delegate here (passing * themselves as the {@link CustodyHost}), and `vault.custody.liberate` delegates * here with its {@link Vault}. An un-opted-in caller hits `NO_CUSTODY`'s throw. * * Note: the lower-level `liberateVault` FREE FUNCTION (exported from * `custody/liberate.ts`) stays ungated — it has no `createNoydb` instance to * gate against (the same carve-out as the `openSealedRecord` host opener). Only * the instance surfaces (`db.grantCustodian` / `db.revokeCustodian` / * `vault.custody.*`) are the capability. * @internal */ import type { GrantOptions, RevokeOptions, FactorProofBundle, NoydbStore } from '../../kernel/types.js'; import type { Vault } from '../../kernel/vault.js'; import type { UnlockedKeyring } from '../team/keyring.js'; import type { GrantCustodianOptions } from './index.js'; import type { LiberateOptions, LiberateResult } from './liberate.js'; /** * The grant/revoke engine the strategy runs when opted in — implemented by * `Noydb` (`_grantCustodianImpl` / `_revokeCustodianImpl` hold the gate + * keyring logic; the public `grantCustodian` / `revokeCustodian` route through * the strategy). Since the #267 team split the keyring grant/revoke engines * are passed IN by `withCustody()` (statically linked there, not in the * kernel) so the single-user floor never carries them. */ export interface CustodyHost { _grantCustodianImpl(engine: (adapter: NoydbStore, vault: string, callerKeyring: UnlockedKeyring, options: GrantOptions) => Promise, vault: string, options: GrantCustodianOptions, factors?: FactorProofBundle): Promise; _revokeCustodianImpl(engine: (adapter: NoydbStore, vault: string, callerKeyring: UnlockedKeyring, options: RevokeOptions) => Promise, vault: string, options: RevokeOptions, factors?: FactorProofBundle): Promise; } export interface CustodyStrategy { grantCustodian(host: CustodyHost, vault: string, options: GrantCustodianOptions, factors?: FactorProofBundle): Promise; revokeCustodian(host: CustodyHost, vault: string, options: RevokeOptions, factors?: FactorProofBundle): Promise; liberate(vault: Vault, opts: LiberateOptions): Promise; } /** * No-op stub — the floor default. Every custody operation throws * {@link CustodyNotEnabledError}; opt in with `custodyStrategy: withCustody()` * in createNoydb. @internal */ export declare const NO_CUSTODY: CustodyStrategy;