Skip to content
docs

BunkerOptions

Defined in: policies.ts:6

Options for bunkerPolicies.

optional inner?: Policies

Defined in: policies.ts:38

The app’s own policies. Their lists and fee caps apply unchanged; their confirm runs after the bunker rules.


optional isFullSweep?: (intent) => boolean | Promise<boolean>

Defined in: policies.ts:22

Does this send move the whole balance of its asset? A partial send exposes the key and leaves the rest behind it. Without this check, enforce mode refuses every send of a protected account.

WriteIntent

boolean | Promise<boolean>


optional isSealedDestination?: (chain, address) => boolean | Promise<boolean>

Defined in: policies.ts:17

Is address a sealed address of this wallet: derived from the same seed, never used on-chain and absent from the ledger? Use nextSealedIndex to pick one, or a vault address.

Without it no address counts as sealed: every send of a protected account is an unsealed-destination, refused in enforce mode and reported in warn mode. An app that runs warn only can leave it out.

string

string

boolean | Promise<boolean>


optional ledgerFailure?: "refuse" | "continue"

Defined in: policies.ts:34

When the ledger cannot be saved for a write this package does not guard (an account that is not protected, or warn mode): refuse (default) signs nothing; continue tells BunkerOptions.onLedgerError and lets the write go on. The exposure then stays known in memory until the app restarts, and the chain scan finds a transaction later; an off-chain signature is lost to the ledger. A protected account in enforce mode is always refused.


optional mode?: "enforce" | "warn"

Defined in: policies.ts:24

enforce (default) refuses. warn calls BunkerOptions.onWarning and lets inner.confirm decide.


optional now?: () => number

Defined in: policies.ts:40

Clock, for tests.

number


optional onLedgerError?: (error, intent) => void | Promise<void>

Defined in: policies.ts:36

ledgerFailure: 'continue': told what the storage threw, before the write goes on.

unknown

WriteIntent

void | Promise<void>


optional onWarning?: (rule, message, intent) => void | Promise<void>

Defined in: policies.ts:26

warn mode: told what enforce would have refused, before inner.confirm runs.

BunkerRule

string

WriteIntent

void | Promise<void>


protect: (intent) => boolean | Promise<boolean>

Defined in: policies.ts:8

Is the writing account in the bunker? The app decides who is (by balance, by user choice).

WriteIntent

boolean | Promise<boolean>