@bsv/expo-wallet-toolbox 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/CHANGELOG.md +292 -0
  2. package/README.md +0 -1
  3. package/assets/sounds/vault-deposit.wav +0 -0
  4. package/assets/sounds/vault-withdraw.wav +0 -0
  5. package/core/config.tsx +9 -1
  6. package/core/context/VaultContext.tsx +8 -11
  7. package/core/context/WalletConnectionContext.tsx +137 -52
  8. package/core/context/WalletContext.tsx +409 -20
  9. package/core/hooks/useConfirmationSound.ts +14 -8
  10. package/core/i18n/translations.tsx +3368 -952
  11. package/core/index.ts +97 -14
  12. package/core/localpay/build.ts +674 -37
  13. package/core/localpay/codec.ts +68 -5
  14. package/core/localpay/pending.ts +240 -22
  15. package/core/localpay/settlementAck.ts +149 -0
  16. package/core/localpay/types.ts +14 -1
  17. package/core/localpay/verify.ts +118 -69
  18. package/core/mandala/abortGuard.ts +134 -0
  19. package/core/mandala/basketMigration.ts +166 -0
  20. package/core/mandala/bundle.ts +244 -0
  21. package/core/mandala/createRuntime.ts +2437 -0
  22. package/core/mandala/drain.ts +670 -0
  23. package/core/mandala/permissionModule.ts +642 -0
  24. package/core/mandala/resendTransfer.ts +175 -0
  25. package/core/mandala/runtime.ts +357 -0
  26. package/core/mandala/settlementStore.ts +412 -0
  27. package/core/mandala/types.ts +290 -0
  28. package/core/offline/cancelParked.ts +94 -1
  29. package/core/offline/payerHold.ts +152 -12
  30. package/core/offline/tokenFrames.ts +197 -0
  31. package/core/parsePeerPayURI.ts +70 -17
  32. package/core/pay/rails/address.ts +51 -3
  33. package/core/pay/rails/handle.ts +88 -9
  34. package/core/pay/rails/index.ts +16 -6
  35. package/core/pay/rails/nearby.ts +114 -4
  36. package/core/services/capWalletArgs.ts +8 -9
  37. package/core/services/externalOrigin.ts +39 -0
  38. package/core/services/vault/VaultKeyService.ts +912 -251
  39. package/core/services/vault/ceremony.ts +435 -367
  40. package/core/services/vault/ceremonyHost.ts +27 -21
  41. package/core/services/vault/devMock.ts +30 -7
  42. package/core/services/vault/driver.ts +95 -41
  43. package/core/services/vault/guard.ts +514 -56
  44. package/core/services/vault/hardwareLease.ts +22 -0
  45. package/core/services/vault/mockYubiKey.ts +258 -90
  46. package/core/services/vault/pivReset.ts +145 -0
  47. package/core/services/vault/r1comb.ts +976 -0
  48. package/core/services/vault/session.ts +93 -26
  49. package/core/services/vault/transfers.ts +2617 -747
  50. package/core/services/vault/types.ts +100 -43
  51. package/core/services/vault/vaultStore.ts +991 -74
  52. package/core/services/walletConnectionValidation.ts +293 -0
  53. package/core/storage/StorageExpoSQLite.ts +382 -56
  54. package/core/storage/dbImage.ts +48 -0
  55. package/core/storage/methods/findSql.ts +0 -54
  56. package/core/storage/methods/listOutputsSql.ts +7 -3
  57. package/core/storage/methods/offlineActions.ts +15 -0
  58. package/core/storage/methods/processOfflineActions.ts +263 -6
  59. package/core/storage/methods/walletBalanceSql.ts +16 -4
  60. package/core/storage/schema/createTables.ts +123 -0
  61. package/core/storage/sqlUpdateValue.ts +24 -0
  62. package/core/toolboxConfig.ts +112 -1
  63. package/core/walletRepair/runWalletCheck.ts +19 -2
  64. package/package.json +25 -24
  65. package/ui/components/QRScanner.tsx +1 -1
  66. package/ui/components/pay/AdmissionNotice.tsx +99 -0
  67. package/ui/components/pay/AssetPicker.tsx +184 -0
  68. package/ui/components/pay/AvailableBalance.tsx +33 -2
  69. package/ui/components/pay/HandleReceive.tsx +213 -50
  70. package/ui/components/pay/NearbyFlow.tsx +616 -69
  71. package/ui/components/pay/PayForm.tsx +73 -8
  72. package/ui/components/pay/PaymentSuccessOverlay.tsx +43 -2
  73. package/ui/components/pay/RecipientField.tsx +49 -4
  74. package/ui/components/pay/RequestHub.tsx +68 -8
  75. package/ui/components/pay/ResultBanner.tsx +41 -4
  76. package/ui/components/pay/UniversalSend.tsx +534 -30
  77. package/ui/components/pay/tokenSendCopy.ts +116 -0
  78. package/ui/components/pay/useRecipientInput.ts +36 -7
  79. package/ui/components/ui/PermissionSheet.tsx +65 -4
  80. package/ui/components/ui/Sheet.tsx +9 -2
  81. package/ui/components/vault/EnrollWizard.tsx +1432 -488
  82. package/ui/components/vault/KeyChooser.tsx +96 -0
  83. package/ui/components/vault/VaultCeremonySheet.tsx +107 -43
  84. package/ui/components/vault/vaultErrorCopy.ts +145 -0
  85. package/ui/components/wallet/ActivityRow.tsx +101 -17
  86. package/ui/components/wallet/AmountInput.tsx +77 -25
  87. package/ui/components/wallet/AssetAmount.tsx +95 -0
  88. package/ui/components/wallet/AssetSwitcherDropdown.tsx +261 -0
  89. package/ui/components/wallet/tokenEviction.ts +65 -0
  90. package/ui/hooks/useExportWalletData.ts +39 -0
  91. package/ui/hooks/useMandala.ts +303 -0
  92. package/ui/hooks/useVaultBalance.ts +105 -7
  93. package/ui/hooks/useVaultCoverage.ts +52 -0
  94. package/ui/importDatabases.ts +7 -3
  95. package/ui/index.ts +50 -7
  96. package/ui/screens/ConnectionsScreen.tsx +46 -29
  97. package/ui/screens/PairScreen.tsx +12 -12
  98. package/ui/screens/PayScreen.tsx +130 -10
  99. package/ui/screens/SettingsScreen.tsx +18 -9
  100. package/ui/screens/VaultScreen.tsx +925 -171
  101. package/ui/screens/VaultTransferScreen.tsx +376 -123
  102. package/ui/screens/WalletCheckScreen.tsx +10 -1
  103. package/ui/screens/WalletConfigScreen.tsx +38 -16
  104. package/ui/screens/WalletHomeScreen.tsx +417 -86
  105. package/ui/screens/homeBadges.ts +9 -1
  106. package/ui/screens/tokenRowTitle.ts +68 -0
  107. package/ui/tokenFormat.ts +108 -0
  108. package/ui/tokenSeen.ts +75 -0
  109. package/ui/tokenStatus.ts +79 -0
  110. package/assets/sounds/vault-close.wav +0 -0
  111. package/assets/sounds/vault-open.wav +0 -0
  112. package/core/services/vault/k1.ts +0 -75
  113. package/core/services/vault/sealing.ts +0 -84
  114. package/core/services/vault/vaultDerivation.ts +0 -152
  115. package/core/services/vault/vaultPassphrase.ts +0 -287
  116. package/ui/components/vault/PassphraseField.tsx +0 -306
  117. package/ui/components/vault/PhraseBackupSheet.tsx +0 -227
  118. package/ui/screens/VaultRecoverScreen.tsx +0 -226
package/CHANGELOG.md CHANGED
@@ -1,5 +1,297 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### 1-of-N YubiKey vault (breaking)
6
+
7
+ The vault is rebuilt around the P-256 comb verifier: each enrolled YubiKey
8
+ signs vault inputs on the card, and the K1 sealed-seed design is gone. Spec:
9
+ `docs/superpowers/specs/2026-09-09-r1-comb-vault-design.md`.
10
+
11
+ Removed exports (`core` barrel):
12
+
13
+ - `sealing` (`SEAL_INFO`, `softwareEcdh`, `sealVaultKey`, `unsealVaultKey`);
14
+ `vaultDerivation` (`deriveVaultSeed`, `BIP32_KEYID_PREFIX`, `bip32KeyID`,
15
+ `indexFromKeyID`, `randomDepositStartIndex`, `deriveVaultHD`,
16
+ `depositPrivKey`, `depositPubKeyHash`); `vaultPassphrase`
17
+ (`VAULT_PASSPHRASE_MIN_BITS`, `RECOMMENDED_WORD_COUNT`,
18
+ `MINIMUM_WORD_COUNT`, `generatePassphrase`, `PassphraseVerdict`,
19
+ `PassphraseTier`, `PassphraseStrength`, `normalizeVaultPassphrase`,
20
+ `passphraseEntropyBits`, `checkVaultPassphrase`, `crackTimeSeconds`,
21
+ `formatCrackTime`, `passphraseStrength`); `k1` (`K1_LOCK_LEN`,
22
+ `K1_UNLOCK_LEN`, `VaultInstructions`, `encodeVaultInstructions`,
23
+ `decodeVaultInstructions`, `buildVaultLockingScript`).
24
+ - `SealedBlob`; the error codes `seal-corrupt`, `bad-passphrase`,
25
+ `bad-mnemonic`, `bad-derivation-index`, `backup-required`.
26
+ - `VaultKeyHandle`, `CeremonyController.requestKey`, `requestVaultKey`;
27
+ `CeremonyStoreView.getSeal`.
28
+ - `enrollVault`, `recoverVaultHD`, `resealToNewKey`, `PendingEnrollment`.
29
+ - `sweepVaultWithHD`; `VaultSpendResult.remainingInputs`; the `reason`
30
+ parameter of `depositToVault`; `VaultDriver.ecdh`; `vaultStore.getSeal` /
31
+ `setSeal` / `takeNextIndex`; meta v4 (`VaultMetaV4`).
32
+
33
+ New:
34
+
35
+ - `r1comb`: `buildLock`, `bakedCommitments`, `commitment`, `buildUnlock`,
36
+ `verifyVaultInput`, `sighashPreimage`, `signerDigest`, `pushTxDerCheck`,
37
+ `compressPubkey`, the exact v6 `VaultInstructions` codec, `R1C_LOCK_LEN`,
38
+ `R1C_UNLOCK_LEN` (on-chain format: spec
39
+ `docs/superpowers/specs/2026-09-09-r1-comb-vault-design.md` §2; codec in
40
+ `core/services/vault/r1comb.ts`).
41
+ - `vaultStore` meta v6: wallet-and-network-scoped `VaultKeyRecord`, recovery
42
+ adoption state, two-phase removal tombstones, enrollment drafts and
43
+ quarantine state; `isEnrolled()` is meta-only.
44
+ - `VaultKeyService`: `enrollKey`, `finalizeEnrollment(records)`,
45
+ `addVaultKey`, `VAULT_MIN_KEYS`, `VAULT_MAX_KEYS`, `EnrollPhase`.
46
+ - Ceremony: `VaultSigner { serial, pubkey, sign(digest, progress?), release() }`,
47
+ `CeremonyController.requestSigner(reason, chosenSerial)`,
48
+ `requestVaultSigner`, `VAULT_INPUTS_PER_TAP`, `CeremonyState.progress`,
49
+ `VaultProgress.signed/total`.
50
+ - Transfers: `depositToVault(w, adminOriginator, satoshis, opts?)` needs no
51
+ hardware; `withdrawFromVault(w, adminOriginator, amount, reason,
52
+ chosenSerial, opts?)`; `previewVaultWithdrawal(w, adminOriginator,
53
+ chosenSerial, amount)` — the chosen key's selectable total, capped count
54
+ and unreachable set without reserving or tapping, for the remainder
55
+ confirmation before the tap; `relockVault`; `estimateRelockFee`;
56
+ `getVaultKeyCoverage`; `orphanedIfRemoved`;
57
+ `VaultSpendResult { txid, cappedInputs, unreachable }`;
58
+ `VaultTransferOptions.vaultEnabled` and `backupEnabled`; error codes
59
+ `not-released`, `backup-off`, `not-enough-keys`, `key-already-enrolled`,
60
+ `too-many-keys`, `last-keys`, `relock-required`, `key-not-committed`,
61
+ `key-cannot-cover`, `too-small-to-relock`, `bad-version`; `VaultError.details`.
62
+ - `configureToolbox({ vaultEnabled })` and `isVaultEnabled()` — the release
63
+ gate (default off).
64
+ - `withKeySession(driver, work, onWaiting?, { nfcMessage?, attachTimeoutMs? })`
65
+ rejects on `session-failed`, `detached` and the attach timeout instead of
66
+ waiting forever; `VaultDriver.start` takes an optional `message`.
67
+ - Native: `startDiscovery(message)` sets the iOS NFC alert text from JS.
68
+ - `devMock`: `setMockPresentKey`, `getMockPresentKey`, `MockPresentKey` —
69
+ switch which of three dev keys is "held to the phone" without hardware.
70
+
71
+ Behaviour changes:
72
+
73
+ - Vault outputs and spends use transaction version 1. The exact lock is about
74
+ 45 KB and commits to every enrolled key. `VAULT_DEPOSIT_MIN` is 100,000 sat.
75
+ - Every output gets a 32-byte salt from wallet `createHmac` under
76
+ `[2, "vault salt"]`, using counterparty `self`, the next canonical decimal
77
+ key ID (`"1"`, `"2"`, ...), and the canonically framed ordered YubiKey
78
+ serials as data. Authenticated current and historical scans rederive every
79
+ claimed HMAC before its index can advance the high-water mark. Output records
80
+ used for recovery or lifecycle mutation must also pass exact
81
+ instructions-to-lock validation and wallet HMAC rederivation before cleanup,
82
+ finalization, or metadata deletion. The in-process FIFO serializes simultaneous
83
+ calls. Disconnected devices sharing a mnemonic can select the same next index;
84
+ the same wallet/index/key set can therefore
85
+ reproduce a script, including across networks. Such outputs remain separate
86
+ UTXOs spendable only by their committed keys. The lock contains only
87
+ `HASH160(salt || canonicalTable(Q))` commitments; its 71-push unlock reveals
88
+ the salt as a final, exact 32-byte item. The salt is a privacy aid, not an
89
+ access-control requirement, and the HMAC is one-way: it does not recover its
90
+ serial-number input. Exact lock sizes are 45,199 bytes for one key and
91
+ `45,175 + 25N` for two through five keys; the measured unlock maximum is
92
+ 2,539 bytes under the existing 2,560-byte declaration.
93
+ - Inventory scans consume each page as it arrives: current-output BEEF pages use
94
+ 64 outputs, script-bearing action-history pages use 8 rows, and lightweight
95
+ action-history pages use 200 rows. A withdrawal retains full proofs only for
96
+ its at most 32 selected inputs. Compact identity, salt and pagination sets can
97
+ still grow with history; there is deliberately no total-history cap that can
98
+ hide an otherwise valid Vault output.
99
+ - Vault output creation requires a configured private-backup endpoint and
100
+ enabled encrypted backup push. This configuration gate does not prove that
101
+ the exact new record reached the backup host; the asynchronous backup system
102
+ exposes no per-action receipt. A deposit or output-producing spend is built
103
+ and signed as `noSend`, its exact
104
+ signed AtomicBEEF is revalidated, and that exact txid is then released with
105
+ `sendWith`. A signed held action discovered after a crash is neither aborted
106
+ nor automatically rebroadcast; it requires manual network-state
107
+ reconciliation. The toolbox release flag still defaults off (`not-released`);
108
+ the app's EAS production profile now enables it explicitly for TestFlight and
109
+ production builds.
110
+ - Vault recovery ignores completed pre-release Vault action history before
111
+ interpreting source scripts, so historical labels cannot make the newly
112
+ enabled Vault screen fail on entry. Pending current-template actions remain
113
+ subject to exact-script validation.
114
+ - Disabling a drained Vault reads only live actions as reservations. Storage
115
+ restores the sources of a terminally failed action and clears their
116
+ `spentBy`, so an aborted withdrawal or re-lock lists no inputs at all;
117
+ requiring exact R1C sources from it reported empty history as malformed
118
+ (`template-invalid`) and refused to disable an empty Vault for good. Exact
119
+ source-script validation and the failed-action blocker now apply to pending
120
+ actions and to failed actions that still list inputs — the shapes that can
121
+ actually hide a Vault output. Completed history no longer has its inputs
122
+ interpreted; its outputs are still authenticated. A failed disable check
123
+ also reports its own error instead of claiming the Vault still holds funds.
124
+ - HMAC salt derivation requires the wallet root, numeric ID, and complete
125
+ ordered serial list, and does not reconstruct an exact lock by itself.
126
+ Clean-device recovery also needs the ordered historical P-256 YubiKey
127
+ public-key descriptor and transaction discovery; current recovery obtains
128
+ that data from authenticated wallet history.
129
+ - Withdrawals name a key before the tap; only outputs committed to that key
130
+ are spent, each checked against its real lock; the card signs one digest
131
+ per input in batches of 16 per NFC tap, resuming after a dropped tap.
132
+ - Enrollment always generates a fresh P-256 key in PIV slot `0x82`.
133
+ `generateVaultKey` verifies the same-session pinned Yubico attestation, exact
134
+ key and PIN-once/touch-cached policy. The enclosing enrollment flow changes a
135
+ factory-default PIN when needed, rotates the PUK, replaces the default
136
+ management key and proves possession. Recovery adopts a surviving card only
137
+ after a fresh possession challenge.
138
+ - `enrollKey` refuses a serial already in the stored key list itself
139
+ (meta ∪ `pendingSerials`), inside the card session and before the PIN is
140
+ spent or the slot is regenerated; `finalizeEnrollment` refuses
141
+ (`key-already-enrolled`) while a vault is already enrolled, so Finish never
142
+ replaces a live key list.
143
+ - Vault format v6 is future-only. Earlier experimental metadata and outputs are
144
+ rejected; there is no decoder, migration, staging reclaim or compatibility
145
+ spend path.
146
+
147
+ ### Vault UI (breaking)
148
+
149
+ - `EnrollWizard` is the sequential multi-key wizard (`mode: 'enroll' | 'add-key'`):
150
+ intro with the acknowledgement, one card session per
151
+ key with the PIN gathered before the tap, naming, Add another / Finish with
152
+ two keys minimum, leave-confirm while keys are pending.
153
+ - `VaultScreen` shows the key list (`nickname · …serialTail4`), coverage badges,
154
+ add / rename / remove (refused when a re-lock is needed first), the re-lock
155
+ sheet, an **Export wallet data** row with its explainer, the footnote and
156
+ disable-when-empty. Deposit runs the lazy wallet-creation path.
157
+ - `VaultTransferScreen` renders the deposit floor and fee inline, confirms the
158
+ first deposit and a below-floor remainder, lets the user choose the key
159
+ before a withdrawal, and reports unreachable and capped outputs as alerts.
160
+ - `VaultCeremonySheet` shows `Signed k of n` and the batch number between taps.
161
+ - New exports: `KeyChooser`, `vaultKeyLabel`, `vaultErrorCopy`,
162
+ `RETRYABLE_VAULT_ERRORS`, `useExportWalletData`, `useVaultCoverage`.
163
+ - Removed exports: `PassphraseField`, `PhraseBackupSheet`, `VaultRecoverScreen`
164
+ (there is no phrase path). Hosts must drop their `vault-recover` route.
165
+ - The home Vault button and the Settings Vault row render only when the host
166
+ passes `vaultEnabled: true` to `configureToolbox`.
167
+ - i18n: the wizard, key-management, transfer-confirmation and error keys added
168
+ in all twelve locales; the K1/passphrase-era keys removed.
169
+
170
+ ### Expo SDK 57 (breaking)
171
+
172
+ Peer ranges move to Expo SDK 57 / React Native 0.86: every `expo-*` peer is
173
+ `~57.x`, `react-native` `^0.86.3`, `react-i18next` `^16.6.6` (TypeScript 6
174
+ peer range), `@react-native-community/netinfo` `^12`,
175
+ `react-native-gesture-handler` `~2.32`, `react-native-safe-area-context`
176
+ `~5.7`. New peer: `@bsv/mandala` `^0.2.0`. iOS deployment target is 16.4, the
177
+ SDK 57 minimum. `StyleSheet.absoluteFillObject` is gone in RN 0.86; this
178
+ package uses `absoluteFill`.
179
+
180
+ ### Stablecoins (Mandala)
181
+
182
+ Stablecoin acceptance and transfer on top of the `@bsv/mandala` token client,
183
+ pay-first UX, recipient-submits offline settlement (specs:
184
+ `docs/superpowers/specs/2026-09-15-mandala-*`).
185
+
186
+ - **Host config.** `configureToolbox({ mandala })` takes a per-chain map of
187
+ `MandalaEndpointConfig` (`overlayUrl`, `overlayIdentityKey` — the only key
188
+ an admission signature may come from — and `messageBoxUrl`). The map is
189
+ the whole policy: a chain with no entry has no runtime, no drain and no
190
+ token asset offered; nothing is hardcoded to mainnet. `getMandalaEndpoints`,
191
+ `isMandalaAvailable`, `isVaultAvailable` exported.
192
+ - **Storage.** Four settlement tables (`token_settlements`,
193
+ `token_admissions`, `token_admission_edges`, `token_linkage_payloads`),
194
+ created by `createTables`; `ensureTokenSettlementColumns`,
195
+ `createMandalaSettlementTables`, `createSettlementStore`,
196
+ `TokenTransactionRepair`, `findOfflineActionByTxid`, `OfflineTokenDeps`.
197
+ Basket `p mandala` behind `MandalaTokenModule` with a one-time basket
198
+ migration; paired apps are prompted for list, spend, credit and relinquish
199
+ and never receive unlocking derivations.
200
+ - **Settlement.** The drain submits ancestors parents-first and broadcasts
201
+ only after admission; three structural guards keep token transactions away
202
+ from any plain broadcast, including the receiver's first internalize.
203
+ `abortAction` on the published manager refuses a reference whose settlement
204
+ row is held, handed_over, submitting, admitted or broadcast
205
+ (`wrapAbortActionForSettlements`, `abortIsBlockedBy`); an admitted answer
206
+ with no verifying σ_I is never `admitted`; every held coin gets a verified
207
+ admission fetched and cached on the tick; `repairAdmittedAborted` re-attaches
208
+ a transaction the wallet failed but the overlay admitted.
209
+ - **Rails.** Handle rail is hand-over-first: build and sign (noSend), assemble
210
+ the admission bundle from local evidence, post the v2 MessageBox body; the
211
+ send path never contacts the overlay. An online payer then settles at once
212
+ (`MandalaRuntime.settleNow`); offline, the drain finishes later.
213
+ PaymentFrame v4: `admissions[]` replaces `recipientLinkage`; the payee runs
214
+ COVER at hand-over against its own configured overlay key and refuses frames
215
+ naming another. Nearby token payments are denominated in the asset, labelled
216
+ `mandala` on both sides, and a payee-first submit is resolved via
217
+ `GET /admin/admission/:txid` instead of looping.
218
+ - **Runtime and UI.** `MandalaRuntime` is the one surface the UI reads
219
+ (`useMandala`, `MandalaProvider`, `useTokenActivity`); nothing above it
220
+ imports `@bsv/mandala`. New `ui` exports: `AssetAmount`, `AssetPicker`,
221
+ `AdmissionNotice`, `tokenFormat` (`formatTokenAmount`, `parseTokenAmount`,
222
+ …), `tokenStatus`, `tokenSeen`, `tokenEviction`, `tokenSendCopy`,
223
+ `tokenRowTitle`. Balances read every page of the basket, not the first
224
+ 1000 outputs. Sent token rows carry a minus sign.
225
+ - **Core exports.** `./mandala/types`, `drain`, `bundle`, `createRuntime`,
226
+ `abortGuard`, `settlementStore`; `./offline/tokenFrames`;
227
+ `cancelParkedPayment`; `./services/externalOrigin`.
228
+
229
+ ### Payments
230
+
231
+ - **Sender note** on nearby (BLE/QR), address and message-box token payments;
232
+ the note becomes the recipient's activity description. Nearby
233
+ `FRAME_VERSION` 4 → 5 with an optional `note`; `sendToAddress` takes a
234
+ `note` (local only); `sendToHandle` forwards it to `transferTokens`. Token
235
+ activity rows now show the note instead of a fixed ticker template.
236
+ - **Token requests in peerpay links**: `asset=<txid.vout>` names a token by
237
+ genesis outpoint, `amount=` its base units; `sats=` selects BSV; mixing is
238
+ refused. Get paid emits them for a selected token. `PeerPayRequest` exported.
239
+ - **Resend a token transfer** over the message box from the activity row,
240
+ rebuilt from the payer's blinding journal and cached admission, journaled
241
+ first so a failed send is retried by the drain.
242
+
243
+ ### Home screen
244
+
245
+ - Coin switcher is a filled accent pill in the top bar (the title doubles as
246
+ the control) opening a dropdown card with a tail; the bottom drawer and the
247
+ Balances section are gone. Token holdings remain in Pay's asset picker and
248
+ Activity. Pay form order: Recipient, Paying with, Amount, Pay.
249
+ - `useWalletStatus` / `WalletStatusSlice` exported from `core`.
250
+
251
+ ### Storage
252
+
253
+ - `listOutputs` and the wallet balance count outputs of a transaction at
254
+ `sending` (already posted, not yet `unproven`), matching what
255
+ `allocateChangeInput` was already willing to spend; `listOutputsSql` shares
256
+ `walletBalanceSql`'s one status list. A vault re-lock remainder no longer
257
+ reads as 0 for a few seconds.
258
+ - Received token frames round-trip every byte field through the pending
259
+ queue; the settlement store refuses non-byte or empty payloads and reads
260
+ back the TEXT rows already on Android devices; `build.ts` aborts its own
261
+ noSend action when a step after `createAction` fails.
262
+
263
+ ### Vault fixes
264
+
265
+ - A key can be removed while the vault holds a balance: broadcast statuses
266
+ (`sending`, `unproven`) no longer block `beginVaultKeyRemoval`; the re-lock
267
+ sheet names the remaining keys.
268
+ - Enrollment names keys itself (Key 1, Key 2, …) instead of stopping on a
269
+ naming page; rename from the vault screen. `vault_name_title` /
270
+ `vault_name_hint` removed from all locales.
271
+ - A re-lock records `Vault relock` as its action description instead of the
272
+ NFC prompt copy.
273
+ - Guarded in-app PIV application reset for a previously used key
274
+ (`./services/vault/pivReset`), refused for keys mid-removal, on other
275
+ chains, or holding an unknown vault key. The vault is mainnet-only.
276
+
277
+ ### Fixes
278
+
279
+ - **Short nearby-payment notes** no longer fail internalize forever. A note
280
+ under 5 characters (a lone 🪿) is truthy after trim, so the fixed fallback
281
+ never applied and `internalizeAction` rejected the description on every
282
+ retry; `processPending` now pads to 5 like `build.ts` and `handle.ts`.
283
+ - **Import wallet data** works again for files exported since the wallet
284
+ database moved to WAL mode (`9ef35665`, 2026-09-02). Every export — the iOS
285
+ byte copy and the Android `serializeAsync` image — carries SQLite header
286
+ bytes 18/19 = 2 (WAL). `deserializeDatabaseAsync` loads the image under
287
+ SQLite's memdb VFS, which has no `xShmMap`, so the pager's WAL open failed
288
+ with SQLITE_CANTOPEN "unable to open database file", surfacing from
289
+ `backupDatabaseAsync`. The import now runs the bytes through the new
290
+ `prepareSqliteImageForDeserialize` (`core` barrel), which returns a copy
291
+ with those two bytes set to rollback-journal mode; the image is already
292
+ complete (export checkpoints first), so nothing is lost. Non-SQLite input
293
+ passes through untouched so SQLite still reports the real error.
294
+
3
295
  ## 0.4.0
4
296
 
5
297
  ### Host-supplied configuration (breaking)
package/README.md CHANGED
@@ -288,7 +288,6 @@ export { WalletHomeScreen as default } from '@bsv/expo-wallet-toolbox/ui'
288
288
  | `SettingsScreen` | `app/settings.tsx` |
289
289
  | `WalletConfigScreen` | `app/wallet-config.tsx` |
290
290
  | `VaultScreen` | `app/vault.tsx` |
291
- | `VaultRecoverScreen` | `app/vault-recover.tsx` |
292
291
  | `VaultTransferScreen` | `app/vault-transfer.tsx` |
293
292
  | `ConnectionsScreen` | `app/connections.tsx` |
294
293
  | `PairScreen` | `app/pair.tsx` |
Binary file
Binary file
package/core/config.tsx CHANGED
@@ -39,4 +39,12 @@ export const DEFAULT_MESSAGEBOX_URL = 'https://gmb.bsvblockchain.tech'
39
39
  * every request fail authentication.
40
40
  */
41
41
  export const DEFAULT_CHAIN: AppChain = 'main'
42
- export const ADMIN_ORIGINATOR = 'admin.com'
42
+ /**
43
+ * Internal authority label passed only by the wallet shell.
44
+ *
45
+ * Keep this deliberately outside the hostname namespace. The permissions
46
+ * manager grants this originator administrative access, so using an ordinary
47
+ * DNS name would let whoever controls that host acquire the same authority
48
+ * through a paired connection.
49
+ */
50
+ export const ADMIN_ORIGINATOR = 'urn:bsv-wallet:internal-admin'
@@ -3,8 +3,10 @@
3
3
  *
4
4
  * Subscribes to the shared CeremonyController (services/vault/ceremonyHost) and
5
5
  * republishes its state to the ceremony sheet, and owns the *effects* of a
6
- * ceremony: on arm, play the open sound + success haptic; on relock, play the
7
- * close sound + confirm haptic and toast.
6
+ * ceremony: on arm, the success haptic; on relock, the confirm haptic and a
7
+ * toast. No tone: arming and relocking are hardware/session events, not a
8
+ * deposit or a withdrawal — those get their own tones (vaultDeposit /
9
+ * vaultWithdraw) at the transfer screen's actual success moment instead.
8
10
  *
9
11
  * WalletContext owns the unplug→relock wiring; this owns the user-facing
10
12
  * feedback. They never fire the same haptic twice — the pairing rules live in
@@ -13,7 +15,6 @@
13
15
  import React, { createContext, useContext, useEffect, useMemo, useState, useCallback } from 'react'
14
16
  import { ceremony } from '../services/vault/ceremonyHost'
15
17
  import { CeremonyState } from '../services/vault/ceremony'
16
- import { sounds } from '../hooks/useConfirmationSound'
17
18
  import { haptics } from '../hooks/useHaptics'
18
19
  import i18n from '../i18n/translations'
19
20
 
@@ -46,20 +47,16 @@ export const VaultProvider: React.FC<{ children: React.ReactNode; onToast?: Vaul
46
47
 
47
48
  useEffect(() => ceremony.subscribe(setState), [])
48
49
 
49
- // Effects of a completed ceremony: the open cue, and nothing else. `onArmed`
50
- // deliberately ignores its VaultKeyHandle argument — the unwrapped node must
51
- // never reach React state or a closure that outlives the operation (see
52
- // VaultKeyHandle in services/vault/ceremony.ts). There is no key queue to
53
- // replenish here either: deposit addresses derive from the private node on
54
- // demand, and no xpub is stored anywhere.
50
+ // Effects of a completed ceremony: the haptic, and nothing else. `onArmed`
51
+ // deliberately ignores its VaultSigner argument — the signer is owned by the
52
+ // transfer that requested it (transfers.ts obtains it from ceremonyHost) and
53
+ // must never reach React state (see VaultSigner in services/vault/ceremony.ts).
55
54
  useEffect(() => {
56
55
  ceremony.onArmed = () => {
57
56
  haptics.success()
58
- sounds.vaultOpen()
59
57
  }
60
58
  ceremony.onRelock = () => {
61
59
  haptics.confirm()
62
- sounds.vaultClose()
63
60
  onToast?.(i18n.t('vault_locked'), { type: 'info' })
64
61
  }
65
62
  return () => {