@bsv/wallet-toolbox-mobile
Optional durable profile state (2.18.0 source candidate)
CWIStyleWalletManager and its WalletAuthenticationManager subclass accept an
optional host store through setStatePersistence. Attach it before authentication.
The host awaits and verifies its own durable commits; saveSnapshot() continues
to return bytes and does not itself write device storage. Existing callers that
do not attach a store keep that contract. Snapshot v1/v2 and on-chain UMP formats,
KDFs, BRC-100 calls, defaults and peer ranges are unchanged.
import type { WalletAuthenticationManager, WalletStatePersistence } from '@bsv/wallet-toolbox-mobile'
declare const manager: WalletAuthenticationManager
declare const durableDeviceStore: WalletStatePersistence
manager.setStatePersistence(durableDeviceStore)
The host must store both snapshot and pending-update capabilities privately,
partitioned by account, network and service configuration. Never log those bytes.
Fence application requests while changing profiles. Activation publishes the new
profile ID and underlying wallet together after construction succeeds. Opted-in
snapshot restores, profile operations and UMP updates serialize. Public wallet calls
are blocked while those operations run or await recovery. A failed builder retains the
previous SDK identity; a host builder with external side effects must additionally
restore or withhold its own serving runtime.
A UMP update records prepared, submitting, signed and published stages.
The built-in interactor signs with noSend, saves the exact signed receipt,
then releases the same transaction through the wallet and the overlay. The
underlying wallet must retain its staged action so sendWith can release it
after restart. Custom interactors opt in with checkpointVersion: 1 and must
await the signed checkpoint before any publication.
Funding and input checks run before the signing checkpoint. If planning fails,
the manager can clear the prepared update. Destroying the manager clears its
in-memory session. The host retains the durable checkpoint for that account.
After an interrupted update, authenticate or restore the original account, then
load its retained checkpoint with loadPendingUMPUpdate before serving wallet
requests. Call recoverPendingUMPUpdate to verify the exact successor or
re-publish the original transaction after checking its owner, fields, unique
token output and predecessor input. With Toolbox Wallet or
WalletPermissionsManager and locally readable Toolbox storage, a submitting
checkpoint can recover the original signed transaction using the operation ID. Recovery saves
that receipt before sending it. Custom interactors can implement
recoverCheckpoint to recover the same authenticated receipt from their own
durable action store. An unknown signing outcome remains pending. Resume an
interrupted phone-number change after recovery to finalize its existing rotation.
syncUMPToken() retains its boolean return. getUMPTokenSyncStatus() additionally
distinguishes unchanged, updated, authoritative not-found and unknown results.
With an attached store, refresh verifies the discovered owner where the
interactor supports it, rebuilds the selected runtime and persists the result. An unavailable
selected profile requires an explicit choice; it does not silently activate the
default. Lookup errors preserve prior state. Applications may retain offline reads
from a committed cache, but should block new UMP mutations without a verified
current account. retryStatePersistence() retries a device save without publishing.
Adoption is optional and is a minor additive API change. There is no automatic
schema migration: the host owns its storage and upgrade/restore tests. Before
rolling back, stop new operations, reconcile pending updates with the original
qualified artifact, retain their checkpoints and export a current legacy-compatible
snapshot. Do not discard a checkpoint or restore a spent predecessor as current.
Source merge, package publication and application release remain separate actions.
Certificate pagination
The 2.17.0 source candidate reports listCertificates totalCertificates as
the size of the matching set at every offset, including full and empty later
pages in IndexedDB. Non-empty final pages use the skipped rows plus the page;
other pages count without a page window. User, deletion, type and certifier
filters and returned certificate fields are unchanged. Upgrade the affected
local storage package or remote Storage service to receive corrected totals.
No API, wire or schema migration is required.
Permission-module spending authorization
Spending authorization accounts for the inputs and outputs that permission
modules pass to the wallet, including token funding and change. Caller input
descriptions remain attached to their outpoints when a module reorders inputs.
Output descriptions follow the metadata retained by copied or reordered outputs,
including outputs with identical scripts and amounts. New module entries with no
caller description use the existing description fallback. Requested-output
verification, exact wallet-spend checks and storage service-charge accounting
remain enforced. No API, wire or stored-data migration is required.
Coordinated 2.17.0 version
The 2.17.0 source candidate preserves the required version lockstep with the core
and browser client distributions. The new setup-factory actionBatchMode option
belongs to those distributions; the mobile entry point exports neither Setup
nor SetupClient. Existing mobile Wallet construction, its actionBatchMode
option and default auto behavior remain unchanged. No mobile consumer or storage
migration is required. Publication is separate from this source candidate.

Mobile build of @bsv/wallet-toolbox — the reference BRC-100 wallet implementation. It provides mobile-safe wallet, signer, services, monitor, and remote storage APIs without Knex, SQLite/MySQL native bindings, IndexedDB, or Node-only IO.
Remote StorageClient calls accept authFetchOptions in the existing third
constructor argument. For a longer authenticated request, configure both
requestTimeoutMs and responseTimeoutMs with an SDK that supports the latter.
Omission preserves the installed SDK defaults; existing SDK peer ranges and
consumer calls are unchanged. See the
remote storage timeout guide.
Use this package in:
- React Native apps
- Capacitor / Cordova mobile apps
- Other mobile runtimes that provide
fetch, Web Crypto, and the required web-compatible globals
For Node servers, use @bsv/wallet-toolbox. For browsers, use @bsv/wallet-toolbox-client.
Resumable synchronization (2.15 candidate)
WalletStorageManager.syncFromReaderResumable(identityKey, source, options) adds
cancellation, durable checkpoints and per-page progress. IndexedDB and Knex local
destinations yield the manager queue during source/proof I/O and between atomic
page commits. Negotiated remote snapshot destinations release the manager queue
while the authenticated server owns its atomic transaction; legacy providers
retain serialized execution. Use
maxRoughSize: 262144 as a measured starting point for constrained clients;
one oversized record may still exceed this rough page target and is subject to
the provider's separate transfer bound. Resume by invoking the API again: the
destination checkpoint is authoritative, including after a lost acknowledgement.
See the sync contract and next-stage design.
Ordinary replica merge and coherent archive capture are separate APIs. A
replica checkpoint is never substituted for the source archive's original
sync-state rows. Existing BRC-38/39 formats remain unchanged.
Provisional delivery budget
The held #569 branch uses provisional artifact allowances based on the complete retained-feature builds. Metro measured 2,765,570 / 729,495 / 558,373 bytes (raw / gzip / Brotli); a 15% allowance sets ceilings of 3,013,000 / 776,250 / 586,500 bytes. The reproducible Hermes build measured 6,116,798 / 2,575,349 / 1,985,367 bytes, about 18.5–20.3% above its original limits. A separate 25% allowance sets Hermes ceilings of 6,368,750 / 2,675,000 / 2,093,750 bytes, leaving about 4–5.5% headroom.
platform-budget.json retains the original baselines, measured source and job, owner, earliest review date, and removal conditions. Review follows full implementation, validation, feature completion, and goal achievement. These artifact allowances apply the operator's direction to use measured, judicious limits and are separate from the earlier browser allowance. They do not change exports, dependencies, compiler settings, source maps, licenses, runtime memory, native or production limits, or negative controls. Passing an artifact budget does not qualify mobile behavior or physical devices. Earlier failed samples remain failed evidence.
Readiness artifact optimization
The readiness build compacts internal code while retaining function/class names,
properties, debugger statements, licenses and complete source maps. Internal
JSON, IndexedDB and wallet modules have separate private chunks; the package's
public entry points and conditional exports stay the same. The build includes
only the used Noble Argon2id fallback and its dependencies, with the same pinned
implementation and algorithm parameters. SDK imports select only used categories
through the SDK's declared public exports. A private re-export module preserves
the original SDK types, constructors and namespace objects, including the SDK overlay-name validators, patterns and byte bound; the marked primitive
curve setup stays eager. Real ESM and CommonJS imports check every re-export
against the peer SDK. SDK and IndexedDB implementations remain external. Shared
Promise/await forwarding reduces duplicated generated
state machines without changing immediate work, suspension order or rejection
objects.
The platform gate also decrypts a fixed public BRC-39 fixture through fresh
installed ESM and CommonJS consumers with WebAssembly disabled, and refuses a
modified authentication tag. The fixture was produced with hash-wasm and Node
AES-GCM independently of the JavaScript fallback; its legacy KDF values do not
change encryption defaults. Original Metro/Hermes ceilings and reproducibility,
composition and source-map checks remain required. Measurements from earlier
failed experiments do not qualify the final source.
The strict Node 24.18 readiness gate measures Metro at 2,694,126 / 711,462 /
546,585 bytes and Hermes at 5,947,886 / 2,551,787 / 1,971,944 bytes
(raw / gzip / Brotli), within all six existing ceilings. Both independent Hermes
builds produce identical bytes. This artifact result does not establish physical
device qualification.
Local recovery capability boundary
The coordinated 2.15.0 source candidate preserves this wrapper's existing APIs
and SDK peer range. Core's new local SQLite action/funding recovery controllers
are separate Node deep imports; this package does not bundle or expose them.
An upgrade does not give IndexedDB, mobile or remote storage a durable operation
journal. Ordinary BRC-100 methods retain their existing behavior.
When a host separately adopts core recovery, preserve its whole consistent
wallet database and keys. Ordinary entity export/sync does not include those
auxiliary journals. Reconcile outstanding core operations before rollback;
wrapper retries or a new payment cannot substitute for retained recovery state.
See the local recovery guide.
Receiving already-broadcast payments
The 2.14.9 source candidate completes broadcast results even when storage
already marks the request unmined or completed. This fixes first receipt
without a mining proof on shared storage, and the same result path when another
storage worker advances the request before the broadcast result refresh. The
stored advanced state remains intact; unsuccessful provider results still
reject receipt and do not credit new recipient outputs. Repeated successful
receipt remains idempotent. A payment carrying its valid mining proof follows
the existing proof path without rebroadcast.
Remote SQL storage also needs the 2.14.9 storage migration and coordinated
server rollout: a durable user/TXID claim serializes receipts across pods while
preserving historical rows. No public API or
wire migration is required. Source versions are candidates until published
through the protected release workflow; upgrading an app alone does not
upgrade its remote storage server.
BRC-100 result compatibility
Version 2.14.1 keeps internal exact-spend accounting off public createAction
results, fixing strict binary bridge failures after the wallet operation while
retaining fee and service-charge authorization. Upgrade the wallet and permission
manager together. Existing JSON bridges that remove internal metadata retain their
behavior; no application, BRC-39 or account-recovery migration is required. Check
wallet history before retrying an action whose response failed on an older host.
Backup and recovery
A BRC-100 wallet needs both recoverable keys and wallet records/derivation
metadata. BRC-39 exports contain wallet data, not root keys or manager snapshots.
App removal or device loss can remove locally retained secrets and state.
Test the independent key and data recovery paths on a replacement device.
Read Wallet backup and recovery,
BRC-38/39 integration and the
recovery checklist.
The unpublished 2.15 candidate exports the same snapshot and journal
contracts as the client build. Its StorageClient uses the shared authenticated
remote archive and negotiated remote snapshot-destination implementations.
These bind every handle/checkpoint to one identity, network and source, with
finite expiry and transfer limits. Unsupported servers retain their serialized
protocol; they never advertise a partial archive as complete.
This package does not install an IndexedDB or native SQLite provider on a mobile
device. A host native provider must implement and qualify the negotiated
contracts; a remote client is not a local StorageProvider. The portable
streaming interfaces and optional asynchronous Argon2id backend are exported
without a Node dependency. A Hermes host must supply a ready interoperable
native backend for strict streaming encryption; Web Worker availability is a
host capability, not a mobile assumption.
DeviceBackupController shares only device backup preferences and destination
catalogue IDs. It verifies each profile's identity/network independently and
never shares primary selection or recovery checkpoints. Call suspend() on
backgrounding, await original in-flight acknowledgement/cleanup, then resume()
on foregrounding. The host owns foreground cadence and atomic preference
storage; constructing the controller starts no timer. Native suspension,
disk-pressure and physical device validation remain outstanding.
See the implementation map and
device lifecycle example.
Large wallet records
Compatible providers negotiate authenticated, integrity-checked transfers for
records that exceed a single HTTP message. Uploads resume saved pieces after
interruption; ordinary pages and legacy providers retain their existing protocol.
Version 1 is bounded to 64 MiB per frame and requires an upgraded provider.
See the transfer and migration guide.
Install