@bsv/expo-wallet-toolbox 0.3.1 → 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.
- package/CHANGELOG.md +311 -0
- package/README.md +52 -1
- package/assets/sounds/vault-deposit.wav +0 -0
- package/assets/sounds/vault-withdraw.wav +0 -0
- package/core/config.tsx +21 -18
- package/core/context/VaultContext.tsx +8 -11
- package/core/context/WalletConnectionContext.tsx +137 -52
- package/core/context/WalletContext.tsx +413 -23
- package/core/hooks/useConfirmationSound.ts +14 -8
- package/core/i18n/translations.tsx +3368 -952
- package/core/index.ts +107 -14
- package/core/localpay/build.ts +674 -37
- package/core/localpay/codec.ts +68 -5
- package/core/localpay/pending.ts +240 -22
- package/core/localpay/settlementAck.ts +149 -0
- package/core/localpay/types.ts +14 -1
- package/core/localpay/verify.ts +118 -69
- package/core/mandala/abortGuard.ts +134 -0
- package/core/mandala/basketMigration.ts +166 -0
- package/core/mandala/bundle.ts +244 -0
- package/core/mandala/createRuntime.ts +2437 -0
- package/core/mandala/drain.ts +670 -0
- package/core/mandala/permissionModule.ts +642 -0
- package/core/mandala/resendTransfer.ts +175 -0
- package/core/mandala/runtime.ts +357 -0
- package/core/mandala/settlementStore.ts +412 -0
- package/core/mandala/types.ts +290 -0
- package/core/offline/cancelParked.ts +94 -1
- package/core/offline/payerHold.ts +152 -12
- package/core/offline/tokenFrames.ts +197 -0
- package/core/parsePeerPayURI.ts +70 -17
- package/core/pay/rails/address.ts +51 -3
- package/core/pay/rails/handle.ts +88 -9
- package/core/pay/rails/index.ts +16 -6
- package/core/pay/rails/nearby.ts +114 -4
- package/core/services/capWalletArgs.ts +8 -9
- package/core/services/externalOrigin.ts +39 -0
- package/core/services/vault/VaultKeyService.ts +912 -251
- package/core/services/vault/ceremony.ts +435 -367
- package/core/services/vault/ceremonyHost.ts +27 -21
- package/core/services/vault/devMock.ts +30 -7
- package/core/services/vault/driver.ts +95 -41
- package/core/services/vault/guard.ts +514 -56
- package/core/services/vault/hardwareLease.ts +22 -0
- package/core/services/vault/mockYubiKey.ts +258 -90
- package/core/services/vault/pivReset.ts +145 -0
- package/core/services/vault/r1comb.ts +976 -0
- package/core/services/vault/session.ts +93 -26
- package/core/services/vault/transfers.ts +2617 -747
- package/core/services/vault/types.ts +100 -43
- package/core/services/vault/vaultStore.ts +991 -74
- package/core/services/walletConnectionValidation.ts +293 -0
- package/core/services/walletServiceConfig.ts +19 -24
- package/core/storage/StorageExpoSQLite.ts +382 -56
- package/core/storage/dbImage.ts +48 -0
- package/core/storage/methods/findSql.ts +0 -54
- package/core/storage/methods/listOutputsSql.ts +7 -3
- package/core/storage/methods/offlineActions.ts +15 -0
- package/core/storage/methods/processOfflineActions.ts +263 -6
- package/core/storage/methods/walletBalanceSql.ts +16 -4
- package/core/storage/schema/createTables.ts +123 -0
- package/core/storage/sqlUpdateValue.ts +24 -0
- package/core/toolboxConfig.ts +240 -0
- package/core/walletRepair/runWalletCheck.ts +19 -2
- package/package.json +25 -24
- package/ui/components/QRScanner.tsx +1 -1
- package/ui/components/pay/AdmissionNotice.tsx +99 -0
- package/ui/components/pay/AssetPicker.tsx +184 -0
- package/ui/components/pay/AvailableBalance.tsx +33 -2
- package/ui/components/pay/HandleReceive.tsx +213 -50
- package/ui/components/pay/NearbyFlow.tsx +616 -69
- package/ui/components/pay/PayForm.tsx +73 -8
- package/ui/components/pay/PaymentSuccessOverlay.tsx +43 -2
- package/ui/components/pay/RecipientField.tsx +49 -4
- package/ui/components/pay/RequestHub.tsx +68 -8
- package/ui/components/pay/ResultBanner.tsx +41 -4
- package/ui/components/pay/UniversalSend.tsx +534 -30
- package/ui/components/pay/tokenSendCopy.ts +116 -0
- package/ui/components/pay/useRecipientInput.ts +36 -7
- package/ui/components/ui/PermissionSheet.tsx +65 -4
- package/ui/components/ui/Sheet.tsx +9 -2
- package/ui/components/vault/EnrollWizard.tsx +1432 -488
- package/ui/components/vault/KeyChooser.tsx +96 -0
- package/ui/components/vault/VaultCeremonySheet.tsx +107 -43
- package/ui/components/vault/vaultErrorCopy.ts +145 -0
- package/ui/components/wallet/ActivityRow.tsx +101 -17
- package/ui/components/wallet/AmountInput.tsx +77 -25
- package/ui/components/wallet/AssetAmount.tsx +95 -0
- package/ui/components/wallet/AssetSwitcherDropdown.tsx +261 -0
- package/ui/components/wallet/tokenEviction.ts +65 -0
- package/ui/hooks/useExportWalletData.ts +39 -0
- package/ui/hooks/useMandala.ts +303 -0
- package/ui/hooks/useVaultBalance.ts +105 -7
- package/ui/hooks/useVaultCoverage.ts +52 -0
- package/ui/importDatabases.ts +7 -3
- package/ui/index.ts +50 -7
- package/ui/screens/ConnectionsScreen.tsx +46 -29
- package/ui/screens/PairScreen.tsx +12 -12
- package/ui/screens/PayScreen.tsx +130 -10
- package/ui/screens/SettingsScreen.tsx +18 -9
- package/ui/screens/VaultScreen.tsx +925 -171
- package/ui/screens/VaultTransferScreen.tsx +376 -123
- package/ui/screens/WalletCheckScreen.tsx +10 -1
- package/ui/screens/WalletConfigScreen.tsx +42 -20
- package/ui/screens/WalletHomeScreen.tsx +417 -86
- package/ui/screens/homeBadges.ts +9 -1
- package/ui/screens/tokenRowTitle.ts +68 -0
- package/ui/tokenFormat.ts +108 -0
- package/ui/tokenSeen.ts +75 -0
- package/ui/tokenStatus.ts +79 -0
- package/assets/sounds/vault-close.wav +0 -0
- package/assets/sounds/vault-open.wav +0 -0
- package/core/services/vault/k1.ts +0 -75
- package/core/services/vault/sealing.ts +0 -84
- package/core/services/vault/vaultDerivation.ts +0 -152
- package/core/services/vault/vaultPassphrase.ts +0 -287
- package/ui/components/vault/PassphraseField.tsx +0 -306
- package/ui/components/vault/PhraseBackupSheet.tsx +0 -227
- package/ui/screens/VaultRecoverScreen.tsx +0 -226
package/core/index.ts
CHANGED
|
@@ -21,11 +21,25 @@ export {
|
|
|
21
21
|
DEFAULT_WAB_URL,
|
|
22
22
|
DEFAULT_STORAGE_URL,
|
|
23
23
|
DEFAULT_MESSAGEBOX_URL,
|
|
24
|
-
DEFAULT_BACKUP_URL,
|
|
25
24
|
DEFAULT_CHAIN,
|
|
26
25
|
ADMIN_ORIGINATOR
|
|
27
26
|
} from './config'
|
|
28
27
|
|
|
28
|
+
// Host-supplied runtime configuration (backup endpoint, service URLs and keys).
|
|
29
|
+
// Must be installed by the host app before anything here renders — see toolboxConfig.ts.
|
|
30
|
+
export {
|
|
31
|
+
configureToolbox,
|
|
32
|
+
isToolboxConfigured,
|
|
33
|
+
getBackupUrl,
|
|
34
|
+
getServiceConfig,
|
|
35
|
+
getMandalaEndpoints,
|
|
36
|
+
isMandalaAvailable,
|
|
37
|
+
isVaultEnabled,
|
|
38
|
+
isVaultAvailable,
|
|
39
|
+
resetToolboxConfig
|
|
40
|
+
} from './toolboxConfig'
|
|
41
|
+
export type { ToolboxConfig, ToolboxServiceConfig, MandalaEndpointConfig } from './toolboxConfig'
|
|
42
|
+
|
|
29
43
|
// Theme tokens and providers
|
|
30
44
|
export { ThemeProvider, useTheme } from './theme/ThemeContext'
|
|
31
45
|
export { spacing, radii, typography, lightColors, darkColors, hitTargets } from './theme/tokens'
|
|
@@ -84,18 +98,89 @@ export * from './offline/hold'
|
|
|
84
98
|
export * from './offline/order'
|
|
85
99
|
export * from './offline/plan'
|
|
86
100
|
export * from './offline/payerHold'
|
|
101
|
+
export * from './offline/tokenFrames'
|
|
102
|
+
export {
|
|
103
|
+
cancelParkedPayment,
|
|
104
|
+
type CancelParkedOutcome,
|
|
105
|
+
type CancelParkedStorage,
|
|
106
|
+
type CancelParkedWallet,
|
|
107
|
+
type CancelParkedSettlementDeps
|
|
108
|
+
} from './offline/cancelParked'
|
|
109
|
+
|
|
110
|
+
// Mandala token settlement — the four evidence tables, and the
|
|
111
|
+
// submit-before-broadcast drain over them.
|
|
112
|
+
export * from './mandala/types'
|
|
113
|
+
export { createSettlementStore, type SettlementDb, type SqlSettlementStore } from './mandala/settlementStore'
|
|
114
|
+
// Guard #4: an abortAction may not release the inputs of a token payment the
|
|
115
|
+
// overlay already has (the 2026-09-15 incident).
|
|
116
|
+
export {
|
|
117
|
+
abortIsBlockedBy,
|
|
118
|
+
wrapAbortActionForSettlements,
|
|
119
|
+
ABORT_BLOCKED_SETTLEMENT_STATES,
|
|
120
|
+
type AbortableManager,
|
|
121
|
+
type SettlementStoreLookup
|
|
122
|
+
} from './mandala/abortGuard'
|
|
123
|
+
export {
|
|
124
|
+
deriveTokenEdges,
|
|
125
|
+
isRetriableInternalizeFailure,
|
|
126
|
+
listStuckSettlements,
|
|
127
|
+
populateEvidenceFromFrame,
|
|
128
|
+
postTokenStep,
|
|
129
|
+
reconcileSettlements,
|
|
130
|
+
NON_TERMINAL_SETTLEMENT_STATES,
|
|
131
|
+
TERMINAL_SETTLEMENT_STATES,
|
|
132
|
+
type EvidenceFrame,
|
|
133
|
+
type EvidencePopulated,
|
|
134
|
+
type EvidenceTokenBlock,
|
|
135
|
+
type EvidenceTrustAnchor,
|
|
136
|
+
type TokenFrameSource,
|
|
137
|
+
type TokenStepDeps
|
|
138
|
+
} from './mandala/drain'
|
|
139
|
+
// The runtime the UI consumes: its pure interface, and its one construction
|
|
140
|
+
// site. `useMandala()` reads `useWallet().mandala`; nothing above this line in
|
|
141
|
+
// an app may import `@bsv/mandala` itself.
|
|
142
|
+
export type {
|
|
143
|
+
MandalaRuntime,
|
|
144
|
+
TokenActivityRow,
|
|
145
|
+
TokenActivityStatus,
|
|
146
|
+
TokenAssetInfo,
|
|
147
|
+
TokenBalance,
|
|
148
|
+
TokenSendResult
|
|
149
|
+
} from './mandala/runtime'
|
|
150
|
+
export {
|
|
151
|
+
activityStatusOf,
|
|
152
|
+
bindOriginator,
|
|
153
|
+
createMandalaKvStorage,
|
|
154
|
+
createMandalaRuntime,
|
|
155
|
+
verdictFromError,
|
|
156
|
+
type CreateMandalaRuntimeArgs,
|
|
157
|
+
type MandalaKvStorage,
|
|
158
|
+
type MandalaMessageBox
|
|
159
|
+
} from './mandala/createRuntime'
|
|
160
|
+
export {
|
|
161
|
+
assembleBundle,
|
|
162
|
+
coverFromFrame,
|
|
163
|
+
tokenParentsOf,
|
|
164
|
+
type AdmissionBundle,
|
|
165
|
+
type BundleStore,
|
|
166
|
+
type CoverBundle,
|
|
167
|
+
type CoverTip,
|
|
168
|
+
type CoverVerifier
|
|
169
|
+
} from './mandala/bundle'
|
|
87
170
|
|
|
88
171
|
// Local SQLite storage layer
|
|
89
172
|
export { StorageExpoSQLite } from './storage/StorageExpoSQLite'
|
|
90
|
-
export type { StorageExpoSQLiteOptions } from './storage/StorageExpoSQLite'
|
|
91
|
-
export { createTables, ensureOfflineActionsColumns } from './storage/schema/createTables'
|
|
173
|
+
export type { StorageExpoSQLiteOptions, TokenTransactionRepair } from './storage/StorageExpoSQLite'
|
|
174
|
+
export { createTables, ensureOfflineActionsColumns, ensureTokenSettlementColumns } from './storage/schema/createTables'
|
|
92
175
|
export { initializeLocalStorage, isLocalStorage, getStorageDisplayName } from './storage/LocalStorageAdapter'
|
|
93
176
|
export type { LocalStorageConfig } from './storage/LocalStorageAdapter'
|
|
94
|
-
export { findOfflineActions, updateOfflineAction } from './storage/methods/offlineActions'
|
|
177
|
+
export { findOfflineActions, findOfflineActionByTxid, updateOfflineAction } from './storage/methods/offlineActions'
|
|
95
178
|
export type { OfflineActionRow, OfflineActionStatus, BindValue } from './storage/methods/offlineActions'
|
|
96
179
|
export { readWalletBalance } from './storage/methods/walletBalanceSql'
|
|
97
|
-
export { processOfflineActions } from './storage/methods/processOfflineActions'
|
|
180
|
+
export { processOfflineActions, type OfflineTokenDeps } from './storage/methods/processOfflineActions'
|
|
181
|
+
export { createMandalaSettlementTables } from './storage/schema/createTables'
|
|
98
182
|
export * from './storage/skipQueuedAncestors'
|
|
183
|
+
export { prepareSqliteImageForDeserialize } from './storage/dbImage'
|
|
99
184
|
|
|
100
185
|
// Local secrets storage
|
|
101
186
|
export {
|
|
@@ -224,6 +309,7 @@ export * from './services/walletServiceConfig'
|
|
|
224
309
|
export * from './services/arcadeBroadcastProvider'
|
|
225
310
|
export * from './services/walletArgLimits'
|
|
226
311
|
export * from './services/capWalletArgs'
|
|
312
|
+
export * from './services/externalOrigin'
|
|
227
313
|
|
|
228
314
|
// Encrypted wallet backup log
|
|
229
315
|
export * from './backup/RemoteSyncReader'
|
|
@@ -241,9 +327,11 @@ export * from './backup/restoreOnImport'
|
|
|
241
327
|
export * from './walletRepair/runWalletCheck'
|
|
242
328
|
export { TaskBackupPush } from './monitor/TaskBackupPush'
|
|
243
329
|
|
|
244
|
-
// Hardware vault: YubiKey PIV custody
|
|
245
|
-
//
|
|
246
|
-
//
|
|
330
|
+
// Hardware vault: YubiKey PIV custody (1-of-N P-256 comb vault, spec
|
|
331
|
+
// docs/superpowers/specs/2026-09-09-r1-comb-vault-design.md), ceremony state
|
|
332
|
+
// machine, the r1comb template module, session helper, transfers
|
|
333
|
+
// (deposit / withdraw / re-lock), wallet-and-chain-scoped SecureStore
|
|
334
|
+
// persistence, access guard, and backup attestation.
|
|
247
335
|
//
|
|
248
336
|
// 'driver.ts' and 'random.ts' both reach for a native module
|
|
249
337
|
// (react-native-yubikey, expo-crypto) with a `require(...)` INSIDE a
|
|
@@ -255,10 +343,7 @@ export * from './services/vault/types'
|
|
|
255
343
|
export * from './services/vault/driver'
|
|
256
344
|
export * from './services/vault/session'
|
|
257
345
|
export * from './services/vault/random'
|
|
258
|
-
export * from './services/vault/
|
|
259
|
-
export * from './services/vault/k1'
|
|
260
|
-
export * from './services/vault/vaultDerivation'
|
|
261
|
-
export * from './services/vault/vaultPassphrase'
|
|
346
|
+
export * from './services/vault/r1comb'
|
|
262
347
|
export * from './services/vault/vaultStore'
|
|
263
348
|
export * from './services/vault/mockYubiKey'
|
|
264
349
|
export * from './services/vault/devMock'
|
|
@@ -267,6 +352,7 @@ export * from './services/vault/backupAttestation'
|
|
|
267
352
|
export * from './services/vault/ceremony'
|
|
268
353
|
export * from './services/vault/ceremonyHost'
|
|
269
354
|
export * from './services/vault/VaultKeyService'
|
|
355
|
+
export * from './services/vault/pivReset'
|
|
270
356
|
export * from './services/vault/transfers'
|
|
271
357
|
|
|
272
358
|
// Connection/pairing state (QR-paired desktop sessions), the vault ceremony
|
|
@@ -305,6 +391,13 @@ export * from './hooks/useConfirmationSound'
|
|
|
305
391
|
// takes an optional onToast prop (see WalletContext.tsx's WalletContextToast
|
|
306
392
|
// type) rather than importing a ui Toast component directly — core must
|
|
307
393
|
// never import from ui, same boundary as VaultContext's onToast above.
|
|
308
|
-
export {
|
|
309
|
-
|
|
394
|
+
export {
|
|
395
|
+
WalletContextProvider,
|
|
396
|
+
useWallet,
|
|
397
|
+
WalletContext,
|
|
398
|
+
WalletManagersContext,
|
|
399
|
+
useWalletManagers,
|
|
400
|
+
useWalletStatus
|
|
401
|
+
} from './context/WalletContext'
|
|
402
|
+
export type { WalletManagersSlice, WalletStatusSlice } from './context/WalletContext'
|
|
310
403
|
export { usePermissionQueue } from './hooks/usePermissionQueue'
|