@bsv/expo-wallet-toolbox 0.7.0 → 0.9.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 (151) hide show
  1. package/CHANGELOG.md +1745 -0
  2. package/README.md +47 -1
  3. package/core/amountFormatHelpers.ts +20 -2
  4. package/core/backup/RemoteSyncReader.ts +131 -19
  5. package/core/backup/appData.ts +157 -0
  6. package/core/backup/client.ts +15 -1
  7. package/core/backup/codec.ts +147 -9
  8. package/core/backup/constants.ts +30 -1
  9. package/core/backup/cursor.ts +31 -2
  10. package/core/backup/push.ts +70 -4
  11. package/core/backup/restore.ts +104 -16
  12. package/core/backup/restoreOnImport.ts +94 -30
  13. package/core/backup/status.ts +13 -8
  14. package/core/constants.ts +14 -1
  15. package/core/context/ExchangeRateContext.tsx +34 -27
  16. package/core/context/LocalStorageProvider.tsx +43 -40
  17. package/core/context/UserContext.tsx +18 -7
  18. package/core/context/VaultContext.tsx +49 -2
  19. package/core/context/WalletConnectionContext.tsx +203 -11
  20. package/core/context/WalletContext.tsx +631 -162
  21. package/core/headers/OfflineFirstChaintracks.ts +48 -4
  22. package/core/headers/headerStore.ts +26 -4
  23. package/core/headers/syncHeaders.ts +12 -1
  24. package/core/i18n/translations.tsx +953 -25
  25. package/core/identity/handleRegistry/client.ts +31 -2
  26. package/core/identity/handleRegistry/keyPinStore.ts +70 -0
  27. package/core/identity/handleRegistry/resolver.ts +71 -3
  28. package/core/index.ts +33 -3
  29. package/core/localpay/build.ts +225 -24
  30. package/core/localpay/pending.ts +110 -7
  31. package/core/localpay/pendingAbortAuthority.ts +95 -0
  32. package/core/localpay/pendingAborts.ts +264 -28
  33. package/core/localpay/session.ts +42 -17
  34. package/core/localpay/settlementAck.ts +10 -1
  35. package/core/localpay/transport/socket.ts +52 -3
  36. package/core/localpay/verify.ts +100 -10
  37. package/core/mandala/abortGuard.ts +96 -20
  38. package/core/mandala/createRuntime.ts +206 -33
  39. package/core/mandala/drain.ts +89 -11
  40. package/core/mandala/inboxPrehold.ts +186 -0
  41. package/core/mandala/permissionModule.ts +202 -20
  42. package/core/mandala/settlementStore.ts +24 -2
  43. package/core/mandala/types.ts +40 -5
  44. package/core/monitor/TaskBackupPush.ts +14 -0
  45. package/core/monitor/TaskDrainOutbox.ts +14 -0
  46. package/core/monitor/TaskSendOffline.ts +14 -0
  47. package/core/net/publicDestination.ts +91 -0
  48. package/core/net/validateArcUrl.ts +22 -0
  49. package/core/offline/cancelParked.ts +134 -13
  50. package/core/offline/payerHold.ts +100 -24
  51. package/core/offline/plan.ts +36 -7
  52. package/core/pay/beefRepair.ts +6 -2
  53. package/core/pay/damagedInbox.ts +24 -0
  54. package/core/pay/rails/address.ts +107 -12
  55. package/core/pay/rails/handle.ts +117 -22
  56. package/core/pay/rails/index.ts +45 -7
  57. package/core/pay/rails/nativeIntent.ts +61 -0
  58. package/core/pay/receiveHistory.ts +93 -0
  59. package/core/pay/recordProof.ts +19 -1
  60. package/core/pay/refreshProofGuard.ts +42 -1
  61. package/core/pay/watchlist.ts +5 -2
  62. package/core/peerpay/control.ts +17 -18
  63. package/core/peerpay/handleResendRequests.ts +58 -4
  64. package/core/peerpay/outbox.ts +3 -1
  65. package/core/recovery/backupMaterial.ts +61 -0
  66. package/core/recovery/createWallet.ts +95 -0
  67. package/core/recovery/recoverWallet.ts +120 -0
  68. package/core/recovery/restoreWallet.ts +170 -0
  69. package/core/recovery/secret.ts +92 -0
  70. package/core/recovery/shareCollector.ts +71 -0
  71. package/core/recovery/shareParsing.ts +87 -0
  72. package/core/recovery/shares.ts +116 -0
  73. package/core/recovery/useRecoveryDeps.ts +70 -0
  74. package/core/services/arcTokenStorage.ts +52 -0
  75. package/core/services/arcadeBroadcastProvider.ts +232 -48
  76. package/core/services/autoApprovePolicy.ts +105 -0
  77. package/core/services/callbackToken.ts +19 -0
  78. package/core/services/capWalletArgs.ts +14 -2
  79. package/core/services/connectionAuthority.ts +98 -0
  80. package/core/services/exchangeRate.ts +35 -12
  81. package/core/services/externalOrigin.ts +11 -0
  82. package/core/services/secrets/kek.ts +126 -29
  83. package/core/services/secrets/migration.ts +16 -4
  84. package/core/services/secrets/store.ts +42 -14
  85. package/core/services/vault/VaultKeyService.ts +228 -45
  86. package/core/services/vault/chainRecovery.ts +483 -0
  87. package/core/services/vault/driver.ts +9 -1
  88. package/core/services/vault/enrolledSerialRegistry.ts +150 -0
  89. package/core/services/vault/guard.ts +218 -32
  90. package/core/services/vault/hardwareLease.ts +19 -0
  91. package/core/services/vault/metaAuthority.ts +210 -0
  92. package/core/services/vault/pivReset.ts +64 -23
  93. package/core/services/vault/r1comb.ts +139 -3
  94. package/core/services/vault/session.ts +25 -4
  95. package/core/services/vault/transfers.ts +866 -170
  96. package/core/services/vault/types.ts +19 -4
  97. package/core/services/vault/vaultStore.ts +256 -29
  98. package/core/services/walletArgLimits.ts +45 -2
  99. package/core/services/walletConnectionValidation.ts +76 -6
  100. package/core/services/walletServiceConfig.ts +10 -8
  101. package/core/storage/StorageExpoSQLite.ts +47 -13
  102. package/core/storage/methods/findSql.ts +21 -2
  103. package/core/storage/methods/offlineActions.ts +10 -1
  104. package/core/storage/methods/processOfflineActions.ts +116 -23
  105. package/core/storage/schema/createTables.ts +126 -2
  106. package/core/stores/ConnectionStore.ts +34 -0
  107. package/core/toolboxConfig.ts +45 -11
  108. package/core/walletDbRegistry.ts +63 -0
  109. package/core/walletMonitor.ts +17 -1
  110. package/core/walletRepair/releaseStuckReservations.ts +72 -0
  111. package/core/walletRepair/shouldMarkUnspendable.ts +20 -0
  112. package/core/walletRepair/spenderConsumesOutpoint.ts +29 -0
  113. package/package.json +2 -2
  114. package/ui/backupShares.ts +26 -169
  115. package/ui/components/pay/AddressReceive.tsx +13 -6
  116. package/ui/components/pay/AssetPicker.tsx +30 -9
  117. package/ui/components/pay/MessageBoxConfig.tsx +16 -0
  118. package/ui/components/pay/NearbyFlow.tsx +480 -243
  119. package/ui/components/pay/PaymentSuccessOverlay.tsx +39 -4
  120. package/ui/components/pay/UniversalSend.tsx +167 -73
  121. package/ui/components/ui/AlertCard.tsx +38 -5
  122. package/ui/components/ui/PermissionSheet.tsx +197 -66
  123. package/ui/components/vault/EnrollWizard.tsx +61 -13
  124. package/ui/components/vault/vaultErrorCopy.ts +3 -1
  125. package/ui/components/wallet/ActivityRow.tsx +5 -3
  126. package/ui/components/wallet/AmountInput.tsx +8 -2
  127. package/ui/components/wallet/AssetSwitcherDropdown.tsx +22 -2
  128. package/ui/components/wallet/Balance.tsx +42 -23
  129. package/ui/components/wallet/BiometricAdvisoryModal.tsx +16 -3
  130. package/ui/exportTransactions.ts +36 -4
  131. package/ui/hooks/useExportWalletData.ts +25 -2
  132. package/ui/importDatabases.ts +339 -24
  133. package/ui/index.ts +9 -3
  134. package/ui/isImageUrl.ts +6 -0
  135. package/ui/printRecoveryShares.ts +9 -10
  136. package/ui/recoveryPrompts.ts +91 -0
  137. package/ui/resolveIdentity.ts +31 -9
  138. package/ui/screens/ConnectionsScreen.tsx +86 -19
  139. package/ui/screens/IdentifierScreen.tsx +30 -8
  140. package/ui/screens/PairScreen.tsx +74 -2
  141. package/ui/screens/SettingsScreen.tsx +10 -4
  142. package/ui/screens/TrustScreen.tsx +99 -4
  143. package/ui/screens/VaultScreen.tsx +410 -61
  144. package/ui/screens/VaultTransferScreen.tsx +59 -7
  145. package/ui/screens/WalletCheckScreen.tsx +17 -6
  146. package/ui/screens/WalletConfigScreen.tsx +82 -28
  147. package/ui/screens/WalletHomeScreen.tsx +179 -88
  148. package/ui/screens/detailActionKeys.ts +55 -0
  149. package/ui/tokenFormat.ts +44 -4
  150. package/ui/txStatus.ts +5 -0
  151. package/core/storage/LocalStorageAdapter.ts +0 -58
@@ -22,6 +22,7 @@ import {
22
22
  } from './rules'
23
23
  import { verifyProfileCertificate, type ProfileCertJson, type RegistryProfile } from './profileCert'
24
24
  import { createRegistryResolver, fetchWithTimeout, type RegistryPin, type RegistryResolver } from './resolver'
25
+ import { createKeyPinStore, type KeyPinStore } from './keyPinStore'
25
26
 
26
27
  /** Why a handle is not free. The server's `stale` arrives as `cooldown`. */
27
28
  export type AvailabilityReason = 'taken' | 'too_similar' | 'reserved' | 'invalid' | 'cooldown'
@@ -84,14 +85,35 @@ export function createHandleRegistryClient(args: {
84
85
  fetchImpl?: typeof fetch
85
86
  now?: () => number
86
87
  resolver?: RegistryResolver
88
+ pinStore?: KeyPinStore
87
89
  }): HandleRegistryClient {
88
90
  const fetchImpl = args.fetchImpl ?? ((input: RequestInfo | URL, init?: RequestInit) => fetch(input, init))
89
91
  const now = args.now ?? (() => Date.now())
90
92
  const domain = args.pinned.domain.trim().toLowerCase()
91
93
  const origin = args.pinned.url.trim().replace(/\/+$/, '')
92
94
  const resolver = args.resolver ?? createRegistryResolver({ pinned: args.pinned, fetchImpl, now })
95
+ const pinStore = args.pinStore ?? createKeyPinStore()
93
96
  let skewMs = 0
94
97
 
98
+ /**
99
+ * XR-071: the registry a certificate came from — pinned or foreign — is not
100
+ * a naming authority, so a structurally valid, self-signed certificate is
101
+ * only as trustworthy as "nobody has shown us a different key for this
102
+ * paymail before". The first key ever seen for a paymail is remembered;
103
+ * a later certificate for the same paymail under a DIFFERENT key is refused
104
+ * rather than treated as an update, because from a static check alone that
105
+ * is indistinguishable from a compromised or malicious registry redirecting
106
+ * the paymail to an attacker.
107
+ */
108
+ async function pinnedOrNull(profile: RegistryProfile): Promise<RegistryProfile | null> {
109
+ const known = await pinStore.get(profile.paymail)
110
+ if (known === null) {
111
+ await pinStore.set(profile.paymail, profile.identityKey)
112
+ return profile
113
+ }
114
+ return known.toLowerCase() === profile.identityKey.toLowerCase() ? profile : null
115
+ }
116
+
95
117
  /** Only ever from the registry we write to: a foreign host's clock is not
96
118
  * the one our `issuedAt` has to beat. */
97
119
  function notePinnedSkew(res: Response): void {
@@ -187,7 +209,8 @@ export function createHandleRegistryClient(args: {
187
209
  if (res.status === 404) return { kind: 'none' }
188
210
  if (!res.ok) return { kind: 'failed' }
189
211
  const profile = await verifyProfileCertificate(await res.json(), { domain: target, identityKey: key })
190
- return profile ? { kind: 'found', profile } : { kind: 'none' }
212
+ const pinned = profile ? await pinnedOrNull(profile) : null
213
+ return pinned ? { kind: 'found', profile: pinned } : { kind: 'none' }
191
214
  } catch {
192
215
  return { kind: 'failed' }
193
216
  }
@@ -268,7 +291,13 @@ export function createHandleRegistryClient(args: {
268
291
  })
269
292
  )
270
293
  )
271
- return verified.filter((profile): profile is RegistryProfile => profile !== null)
294
+ const certified = verified.filter((profile): profile is RegistryProfile => profile !== null)
295
+ // Each row is checked against this device's own key-pin history
296
+ // (XR-071) — a row whose certificate verifies but whose key contradicts
297
+ // one already accepted for that paymail is dropped like any other row
298
+ // that failed verification.
299
+ const pinned = await Promise.all(certified.map(profile => pinnedOrNull(profile)))
300
+ return pinned.filter((profile): profile is RegistryProfile => profile !== null)
272
301
  },
273
302
 
274
303
  lookupProfile,
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Trust-on-first-use for paymail → identityKey.
3
+ *
4
+ * A profile certificate only proves the subject signed it as its own
5
+ * certifier — it says nothing about who is entitled to a paymail. A registry
6
+ * (any registry, including our pinned one) that turns malicious or is
7
+ * compromised can therefore mint a fresh, self-signed certificate for
8
+ * `victim@domain` under an attacker key, and `verifyProfileCertificate` has
9
+ * no naming authority to check it against (XR-071 / SEC2-079).
10
+ *
11
+ * What we CAN check is continuity: once this device has resolved a key for a
12
+ * paymail, a different key showing up later for the same paymail is either a
13
+ * real, rare re-key or an attack, and the two are indistinguishable from a
14
+ * static check alone — so a later different key is refused rather than
15
+ * silently accepted. This is deliberately per-device, not synced through
16
+ * backup: it protects against what the paymail's OWN registry does after the
17
+ * fact, so it must not be something a compromised backup or that same
18
+ * registry could also rewrite.
19
+ */
20
+ import AsyncStorage from '@react-native-async-storage/async-storage'
21
+
22
+ const STORAGE_KEY = 'handleRegistry.keyPins.v1'
23
+
24
+ export interface KeyPinStore {
25
+ /** The identityKey this device has previously accepted for `paymail`, or null. */
26
+ get(paymail: string): Promise<string | null>
27
+ /** Records `identityKey` as the accepted key for `paymail`, if none is pinned yet. */
28
+ set(paymail: string, identityKey: string): Promise<void>
29
+ }
30
+
31
+ let pins: Record<string, string> | null = null
32
+
33
+ async function load(): Promise<Record<string, string>> {
34
+ if (pins) return pins
35
+ try {
36
+ const raw = await AsyncStorage.getItem(STORAGE_KEY)
37
+ const parsed: unknown = raw ? JSON.parse(raw) : {}
38
+ pins = parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? (parsed as Record<string, string>) : {}
39
+ } catch {
40
+ pins = {}
41
+ }
42
+ return pins
43
+ }
44
+
45
+ /** One store, backed by the same on-device AsyncStorage every client instance
46
+ * shares — a paymail resolved from one screen must still be pinned the next
47
+ * time any other screen resolves it. */
48
+ export function createKeyPinStore(): KeyPinStore {
49
+ return {
50
+ async get(paymail) {
51
+ const table = await load()
52
+ return table[paymail] ?? null
53
+ },
54
+ async set(paymail, identityKey) {
55
+ const table = await load()
56
+ if (table[paymail] === identityKey) return
57
+ table[paymail] = identityKey
58
+ try {
59
+ await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(table))
60
+ } catch (e) {
61
+ console.warn('[handleRegistry] failed to persist a key pin', e)
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ /** Test-only: forget every pin and the in-memory cache. */
68
+ export function resetKeyPinsForTests(): void {
69
+ pins = null
70
+ }
@@ -12,6 +12,7 @@
12
12
  * nothing that `https://<domain>` would not already have reached.
13
13
  */
14
14
  import { BRFC_LOOKUP, BRFC_REVERSE_LOOKUP, looksLikeDomain } from './rules'
15
+ import { isPublicHttpsUrl } from '../../net/publicDestination'
15
16
 
16
17
  /** The domain this build's own handles live under, and the host serving it. */
17
18
  export interface RegistryPin {
@@ -38,11 +39,61 @@ export const REGISTRY_TIMEOUT_MS = 8000
38
39
  export const RESOLVER_SUCCESS_TTL_MS = 10 * 60 * 1000
39
40
  export const RESOLVER_FAILURE_TTL_MS = 60 * 1000
40
41
  export const DOH_ENDPOINTS: readonly string[] = ['https://cloudflare-dns.com/dns-query', 'https://dns.google/resolve']
42
+ /**
43
+ * Comfortably over ten capped profile certificates (MAX_SEARCH_RESULTS *
44
+ * MAX_CERT_BODY_BYTES, ~160 KiB) plus JSON overhead — nothing this feature
45
+ * legitimately reads is anywhere near this large (XR-077 / SEC2-027).
46
+ */
47
+ export const REGISTRY_MAX_BODY_BYTES = 256 * 1024
41
48
 
42
49
  const SRV_TYPE = 33
43
50
  const NOERROR = 0
44
51
  const NXDOMAIN = 3
45
52
 
53
+ /**
54
+ * Reads a body no bigger than `maxBytes`, in whatever way the runtime allows.
55
+ * A declared `Content-Length` over the cap is refused before anything is
56
+ * read; otherwise, when the runtime exposes the body as a stream, chunks are
57
+ * counted as they arrive and the read is aborted the instant the running
58
+ * total crosses the cap — an untrusted host cannot make this allocate more
59
+ * than the cap regardless of what it claims or how it paces the bytes
60
+ * (XR-077 / SEC2-027). `fallback` (the original, unbounded `response.json`)
61
+ * is used only when the runtime gives no stream to count from at all, which
62
+ * this feature's own test doubles do — a floor, not a firewall, on a runtime
63
+ * where nothing better is available.
64
+ */
65
+ async function readBoundedJson(res: Response, fallback: () => Promise<unknown>, url: string): Promise<unknown> {
66
+ const declared = res.headers?.get?.('content-length')
67
+ if (declared) {
68
+ const n = Number(declared)
69
+ if (Number.isFinite(n) && n > REGISTRY_MAX_BODY_BYTES) {
70
+ throw new Error(`handleRegistry: ${url} declared ${n} bytes, over the ${REGISTRY_MAX_BODY_BYTES} byte limit`)
71
+ }
72
+ }
73
+ const reader = (res as { body?: ReadableStream<Uint8Array> | null }).body?.getReader?.()
74
+ if (!reader) return await fallback()
75
+ const chunks: Uint8Array[] = []
76
+ let total = 0
77
+ for (;;) {
78
+ const { done, value } = await reader.read()
79
+ if (done) break
80
+ if (!value) continue
81
+ total += value.byteLength
82
+ if (total > REGISTRY_MAX_BODY_BYTES) {
83
+ await reader.cancel().catch(() => {})
84
+ throw new Error(`handleRegistry: ${url} exceeded the ${REGISTRY_MAX_BODY_BYTES} byte limit while streaming`)
85
+ }
86
+ chunks.push(value)
87
+ }
88
+ const merged = new Uint8Array(total)
89
+ let offset = 0
90
+ for (const chunk of chunks) {
91
+ merged.set(chunk, offset)
92
+ offset += chunk.byteLength
93
+ }
94
+ return JSON.parse(new TextDecoder().decode(merged))
95
+ }
96
+
46
97
  /**
47
98
  * One attempt, bounded — headers AND body. There is no shared fetch helper in
48
99
  * this codebase — every call site hand-rolls this — so this feature's two
@@ -78,10 +129,12 @@ export async function fetchWithTimeout(fetchImpl: typeof fetch, url: string, ini
78
129
  clearTimeout(timer)
79
130
  }
80
131
  const readJson = typeof response.json === 'function' ? response.json.bind(response) : null
81
- if (!readJson) {
132
+ const hasBody = !!(response as { body?: unknown }).body
133
+ if (!readJson && !hasBody) {
82
134
  release()
83
135
  return response
84
136
  }
137
+ const fallback = readJson ?? (() => Promise.reject(new Error(`handleRegistry: ${url} has no json() and no body`)))
85
138
  // Rebinding the reader rather than buffering the body here: what each caller
86
139
  // asks for is all that is ever allocated. The abort is what stops a real
87
140
  // stalled stream; the rejection is what stops a transport that ignores it.
@@ -96,7 +149,7 @@ export async function fetchWithTimeout(fetchImpl: typeof fetch, url: string, ini
96
149
  },
97
150
  Math.max(0, REGISTRY_TIMEOUT_MS - (Date.now() - startedAt))
98
151
  )
99
- void readJson().then(resolve, reject)
152
+ void readBoundedJson(response, fallback, url).then(resolve, reject)
100
153
  })
101
154
  } finally {
102
155
  if (bodyTimer !== undefined) clearTimeout(bodyTimer)
@@ -138,9 +191,19 @@ function parseSrv(data: string): SrvRecord | null {
138
191
  return { priority, weight, port, target }
139
192
  }
140
193
 
194
+ /**
195
+ * A foreign domain's own `.well-known/bsvalias` document names WHERE its
196
+ * search/reverse routes live — nothing binds that to the domain the request
197
+ * was made about. Without a host-class check, a foreign domain (no DNSSEC
198
+ * spoofing needed against anyone else — an attacker publishing this for their
199
+ * own domain is enough) could advertise a capability template rooted at a
200
+ * loopback or private address and have every later search/reverse request
201
+ * this feature makes land there instead (XR-073 / SEC2-057, SEC2-076).
202
+ */
141
203
  function templateOf(value: unknown, placeholder: string): string | null {
142
204
  if (typeof value !== 'string' || !value.startsWith('https://')) return null
143
- return value.includes(placeholder) ? value : null
205
+ if (!value.includes(placeholder)) return null
206
+ return isPublicHttpsUrl(value) ? value : null
144
207
  }
145
208
 
146
209
  export function createRegistryResolver(args: {
@@ -205,6 +268,11 @@ export function createRegistryResolver(args: {
205
268
  const host = await lookupSrv(domain)
206
269
  if (!host) return null
207
270
  const origin = `https://${host.target}${host.port === 443 ? '' : `:${host.port}`}`
271
+ // An SRV target is ordinarily just a hostname, but nothing stops one from
272
+ // being an IP literal, `localhost`, or a `.local` name — and DNSSEC only
273
+ // authenticates that the domain's own zone said so, not that it is a
274
+ // sensible destination (XR-073 / SEC2-057, SEC2-076).
275
+ if (!isPublicHttpsUrl(`${origin}/`)) return null
208
276
  let capabilities: Record<string, unknown>
209
277
  try {
210
278
  const res = await fetchWithTimeout(fetchImpl, `${origin}/.well-known/bsvalias`, {
package/core/index.ts CHANGED
@@ -13,6 +13,7 @@ export { TaskSendOffline } from './monitor/TaskSendOffline'
13
13
  export { TaskCreditInbox } from './monitor/TaskCreditInbox'
14
14
  export { TaskDrainOutbox, drainUnsentEntries } from './monitor/TaskDrainOutbox'
15
15
  export { getOnline, subscribeOnline, probeOnline } from './net/online'
16
+ export { validateArcUrl } from './net/validateArcUrl'
16
17
  export * from './logging'
17
18
  export * from './diskSpace'
18
19
  export type { AppChain, WalletChain } from './config'
@@ -34,6 +35,7 @@ export {
34
35
  getServiceConfig,
35
36
  getMandalaEndpoints,
36
37
  getHandleRegistryConfig,
38
+ isAllowedServiceOrigin,
37
39
  isMandalaAvailable,
38
40
  isVaultEnabled,
39
41
  isVaultAvailable,
@@ -64,7 +66,8 @@ export {
64
66
  formatSatoshis,
65
67
  isFiatCurrency,
66
68
  satoshisPerFiatUnit,
67
- fiatFractionDigits
69
+ fiatFractionDigits,
70
+ decimalSeparator
68
71
  } from './amountFormatHelpers'
69
72
  export type { UsdToFiat, AmountFormatOptions } from './amountFormatHelpers'
70
73
 
@@ -104,6 +107,7 @@ export * from './offline/payerHold'
104
107
  export * from './offline/tokenFrames'
105
108
  export {
106
109
  cancelParkedPayment,
110
+ chainAlreadyKnows,
107
111
  type CancelParkedOutcome,
108
112
  type CancelParkedStorage,
109
113
  type CancelParkedWallet,
@@ -178,8 +182,6 @@ export { mergeContactCache, type ContactCache } from './contacts/contactCache'
178
182
  export { StorageExpoSQLite } from './storage/StorageExpoSQLite'
179
183
  export type { StorageExpoSQLiteOptions, TokenTransactionRepair } from './storage/StorageExpoSQLite'
180
184
  export { createTables, ensureOfflineActionsColumns, ensureTokenSettlementColumns } from './storage/schema/createTables'
181
- export { initializeLocalStorage, isLocalStorage, getStorageDisplayName } from './storage/LocalStorageAdapter'
182
- export type { LocalStorageConfig } from './storage/LocalStorageAdapter'
183
185
  export { findOfflineActions, findOfflineActionByTxid, updateOfflineAction } from './storage/methods/offlineActions'
184
186
  export type { OfflineActionRow, OfflineActionStatus, BindValue } from './storage/methods/offlineActions'
185
187
  export { readWalletBalance } from './storage/methods/walletBalanceSql'
@@ -195,6 +197,10 @@ export {
195
197
  LocalStorageContext,
196
198
  type LocalStorageContextType
197
199
  } from './context/LocalStorageProvider'
200
+ // XR-114: lets a consent screen check, before it promises biometric
201
+ // protection, whether provisioning would actually land on a disclosed
202
+ // (non-biometric) policy for this device/build.
203
+ export { resolveProvisioningPolicy, type ResolvedPolicy } from './services/secrets/policy'
198
204
 
199
205
  // User context and native handlers
200
206
  export { UserContextProvider, UserContext } from './context/UserContext'
@@ -216,6 +222,7 @@ export type { FiatCurrency } from './displayCurrencies'
216
222
 
217
223
  // Pay rails
218
224
  export * from './pay/rails'
225
+ export * from './pay/rails/nativeIntent'
219
226
  export * from './pay/beefRepair'
220
227
  export * from './pay/creditErrors'
221
228
  export * from './pay/creditInbox'
@@ -279,6 +286,14 @@ export {
279
286
  touchWatched,
280
287
  unwatchAddress
281
288
  } from './pay/watchlist'
289
+ // receiveHistory.ts's own KVStorage is omitted for the same reason watchlist.ts's is above.
290
+ export {
291
+ RECEIVE_HISTORY_KEY,
292
+ MAX_RECEIVE_HISTORY,
293
+ recordIssuedDate,
294
+ getIssuedDates,
295
+ setIssuedDates
296
+ } from './pay/receiveHistory'
282
297
  // isCompressedPublicKey is omitted here because './pay/rails' above already
283
298
  // re-exports the same binding; naming it twice trips eslint's import/export rule.
284
299
  export {
@@ -316,6 +331,7 @@ export * from './services/arcadeBroadcastProvider'
316
331
  export * from './services/walletArgLimits'
317
332
  export * from './services/capWalletArgs'
318
333
  export * from './services/externalOrigin'
334
+ export * from './services/arcTokenStorage'
319
335
 
320
336
  // Encrypted wallet backup log
321
337
  export * from './backup/RemoteSyncReader'
@@ -333,6 +349,18 @@ export * from './backup/restoreOnImport'
333
349
  export * from './walletRepair/runWalletCheck'
334
350
  export { TaskBackupPush } from './monitor/TaskBackupPush'
335
351
 
352
+ // Wallet recovery and creation: headless orchestration behind the mnemonic /
353
+ // shares screens (store secret → build → attest), the share primitives, and the
354
+ // hook that wires them to the providers. Screens only render the outcomes.
355
+ export * from './recovery/shares'
356
+ export * from './recovery/secret'
357
+ export * from './recovery/shareCollector'
358
+ export * from './recovery/backupMaterial'
359
+ export * from './recovery/restoreWallet'
360
+ export * from './recovery/recoverWallet'
361
+ export * from './recovery/createWallet'
362
+ export * from './recovery/useRecoveryDeps'
363
+
336
364
  // Hardware vault: YubiKey PIV custody (1-of-N P-256 comb vault, spec
337
365
  // docs/superpowers/specs/2026-09-09-r1-comb-vault-design.md), ceremony state
338
366
  // machine, the r1comb template module, session helper, transfers
@@ -351,6 +379,7 @@ export * from './services/vault/session'
351
379
  export * from './services/vault/random'
352
380
  export * from './services/vault/r1comb'
353
381
  export * from './services/vault/vaultStore'
382
+ export * from './services/vault/metaAuthority'
354
383
  export * from './services/vault/mockYubiKey'
355
384
  export * from './services/vault/devMock'
356
385
  export * from './services/vault/guard'
@@ -360,6 +389,7 @@ export * from './services/vault/ceremonyHost'
360
389
  export * from './services/vault/VaultKeyService'
361
390
  export * from './services/vault/pivReset'
362
391
  export * from './services/vault/transfers'
392
+ export * from './services/vault/chainRecovery'
363
393
 
364
394
  // Connection/pairing state (QR-paired desktop sessions), the vault ceremony
365
395
  // context (React face of the ceremonyHost singleton), and the shared