@bsv/expo-wallet-toolbox 0.1.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/LICENSE.txt +28 -0
- package/README.md +512 -0
- package/assets/sounds/payment-receive.wav +0 -0
- package/assets/sounds/payment-send.wav +0 -0
- package/assets/sounds/vault-close.wav +0 -0
- package/assets/sounds/vault-open.wav +0 -0
- package/core/amountFormatHelpers.ts +330 -0
- package/core/backup/RemoteSyncReader.ts +94 -0
- package/core/backup/client.ts +111 -0
- package/core/backup/codec.ts +218 -0
- package/core/backup/constants.ts +88 -0
- package/core/backup/cursor.ts +138 -0
- package/core/backup/derive.ts +46 -0
- package/core/backup/deviceId.ts +33 -0
- package/core/backup/erase.ts +67 -0
- package/core/backup/preference.ts +33 -0
- package/core/backup/push.ts +295 -0
- package/core/backup/restore.ts +152 -0
- package/core/backup/restoreOnImport.ts +119 -0
- package/core/backup/status.ts +46 -0
- package/core/config.tsx +47 -0
- package/core/constants.ts +35 -0
- package/core/context/ExchangeRateContext.tsx +69 -0
- package/core/context/LocalStorageProvider.tsx +225 -0
- package/core/context/UserContext.tsx +129 -0
- package/core/context/VaultContext.tsx +79 -0
- package/core/context/WalletConnectionContext.tsx +454 -0
- package/core/context/WalletContext.tsx +2938 -0
- package/core/context/buildGeneration.ts +37 -0
- package/core/deviceTier.ts +89 -0
- package/core/diskSpace.ts +62 -0
- package/core/displayCurrencies.ts +56 -0
- package/core/headers/OfflineFirstChaintracks.ts +176 -0
- package/core/headers/checkpoints.ts +39 -0
- package/core/headers/fs.ts +119 -0
- package/core/headers/headerStore.ts +333 -0
- package/core/headers/prewarm.ts +36 -0
- package/core/headers/syncHeaders.ts +73 -0
- package/core/hooks/useConfirmationSound.ts +135 -0
- package/core/hooks/useHaptics.ts +51 -0
- package/core/hooks/usePermissionQueue.ts +69 -0
- package/core/i18n/translations.tsx +6692 -0
- package/core/index.ts +295 -0
- package/core/localpay/blePermissions.ts +32 -0
- package/core/localpay/build.ts +392 -0
- package/core/localpay/codec.ts +338 -0
- package/core/localpay/deviceCaps.ts +175 -0
- package/core/localpay/nearbyAdvisory.ts +32 -0
- package/core/localpay/nearbyPermissions.ts +34 -0
- package/core/localpay/pending.ts +385 -0
- package/core/localpay/pendingAborts.ts +67 -0
- package/core/localpay/qr.ts +16 -0
- package/core/localpay/session.ts +277 -0
- package/core/localpay/sessionPolicy.ts +5 -0
- package/core/localpay/transport/awdl.ts +11 -0
- package/core/localpay/transport/ble.ts +159 -0
- package/core/localpay/transport/nearby.ts +12 -0
- package/core/localpay/transport/race.ts +110 -0
- package/core/localpay/transport/select.ts +128 -0
- package/core/localpay/transport/socket.ts +244 -0
- package/core/localpay/types.ts +82 -0
- package/core/localpay/verify.ts +204 -0
- package/core/logging.config.ts +10 -0
- package/core/logging.ts +77 -0
- package/core/mnemonicWallet.ts +180 -0
- package/core/monitor/TaskBackupPush.ts +168 -0
- package/core/monitor/TaskCreditInbox.ts +116 -0
- package/core/monitor/TaskDrainOutbox.ts +122 -0
- package/core/monitor/TaskSendOffline.ts +123 -0
- package/core/monitor/unfailRetry.ts +116 -0
- package/core/net/chainMatch.ts +34 -0
- package/core/net/online.ts +34 -0
- package/core/offline/cancelParked.ts +56 -0
- package/core/offline/hold.ts +127 -0
- package/core/offline/order.ts +109 -0
- package/core/offline/payerHold.ts +144 -0
- package/core/offline/plan.ts +264 -0
- package/core/offline/queueGrace.ts +52 -0
- package/core/parsePeerPayURI.ts +119 -0
- package/core/pay/beefRepair.ts +106 -0
- package/core/pay/creditErrors.ts +46 -0
- package/core/pay/creditInbox.ts +202 -0
- package/core/pay/damagedInbox.ts +64 -0
- package/core/pay/proofNudge.ts +23 -0
- package/core/pay/provenTxFromBump.ts +31 -0
- package/core/pay/rails/address.ts +329 -0
- package/core/pay/rails/handle.ts +617 -0
- package/core/pay/rails/index.ts +197 -0
- package/core/pay/rails/nearby.ts +79 -0
- package/core/pay/receiveFocus.ts +13 -0
- package/core/pay/recordProof.ts +91 -0
- package/core/pay/refreshProofGuard.ts +34 -0
- package/core/pay/sweeper.ts +75 -0
- package/core/pay/tokenAmount.ts +18 -0
- package/core/pay/userError.ts +18 -0
- package/core/pay/watchlist.ts +126 -0
- package/core/peerpay/control.ts +122 -0
- package/core/peerpay/handleResendRequests.ts +475 -0
- package/core/peerpay/inboxAttempts.ts +33 -0
- package/core/peerpay/metadataDecryptor.ts +42 -0
- package/core/peerpay/offlineNacks.ts +96 -0
- package/core/peerpay/outbox.ts +209 -0
- package/core/peerpay/rebuildToken.ts +76 -0
- package/core/peerpay/resendBeef.ts +115 -0
- package/core/services/arcadeBroadcastProvider.ts +214 -0
- package/core/services/capWalletArgs.ts +99 -0
- package/core/services/exchangeRate.ts +63 -0
- package/core/services/secrets/envelope.ts +102 -0
- package/core/services/secrets/hkdf.ts +37 -0
- package/core/services/secrets/index.ts +63 -0
- package/core/services/secrets/kek.ts +274 -0
- package/core/services/secrets/migration.ts +188 -0
- package/core/services/secrets/policy.ts +120 -0
- package/core/services/secrets/storage.ts +54 -0
- package/core/services/secrets/store.ts +125 -0
- package/core/services/secrets/types.ts +85 -0
- package/core/services/usdFxRates.ts +101 -0
- package/core/services/vault/VaultKeyService.ts +312 -0
- package/core/services/vault/backupAttestation.ts +136 -0
- package/core/services/vault/ceremony.ts +972 -0
- package/core/services/vault/ceremonyHost.ts +46 -0
- package/core/services/vault/devMock.ts +22 -0
- package/core/services/vault/driver.ts +197 -0
- package/core/services/vault/guard.ts +90 -0
- package/core/services/vault/k1.ts +75 -0
- package/core/services/vault/mockYubiKey.ts +217 -0
- package/core/services/vault/random.ts +20 -0
- package/core/services/vault/sealing.ts +84 -0
- package/core/services/vault/session.ts +59 -0
- package/core/services/vault/transfers.ts +1151 -0
- package/core/services/vault/types.ts +109 -0
- package/core/services/vault/vaultDerivation.ts +152 -0
- package/core/services/vault/vaultPassphrase.ts +287 -0
- package/core/services/vault/vaultStore.ts +104 -0
- package/core/services/walletArgLimits.ts +234 -0
- package/core/services/walletServiceConfig.ts +170 -0
- package/core/storage/LocalStorageAdapter.ts +58 -0
- package/core/storage/README.md +391 -0
- package/core/storage/StorageExpoSQLite.ts +2008 -0
- package/core/storage/errors.ts +73 -0
- package/core/storage/index.ts +3 -0
- package/core/storage/methods/findSql.ts +286 -0
- package/core/storage/methods/historyNotes.ts +61 -0
- package/core/storage/methods/listActionsSql.ts +212 -0
- package/core/storage/methods/listOutputsSql.ts +211 -0
- package/core/storage/methods/offlineActions.ts +156 -0
- package/core/storage/methods/processOfflineActions.ts +503 -0
- package/core/storage/methods/reclaim.ts +135 -0
- package/core/storage/methods/reviewStatusSql.ts +167 -0
- package/core/storage/methods/unprovenWithoutReqSql.ts +26 -0
- package/core/storage/methods/walletBalanceSql.ts +55 -0
- package/core/storage/schema/createTables.ts +385 -0
- package/core/storage/skipQueuedAncestors.ts +29 -0
- package/core/storage/sqlUpdateValue.ts +12 -0
- package/core/stores/ConnectionStore.ts +71 -0
- package/core/theme/ThemeContext.tsx +182 -0
- package/core/theme/assertThemeContrast.ts +109 -0
- package/core/theme/motion.ts +50 -0
- package/core/theme/tokens.ts +232 -0
- package/core/theme/useThemeStyles.tsx +156 -0
- package/core/walletDbRegistry.ts +110 -0
- package/core/walletMonitor.ts +149 -0
- package/core/walletRepair/runWalletCheck.ts +195 -0
- package/core/walletRepair/shouldReleaseUtxo.ts +18 -0
- package/package.json +86 -0
- package/ui/backupShares.ts +367 -0
- package/ui/components/QRScanner.tsx +353 -0
- package/ui/components/pay/AddressReceive.tsx +507 -0
- package/ui/components/pay/AvailableBalance.tsx +61 -0
- package/ui/components/pay/HandleReceive.tsx +896 -0
- package/ui/components/pay/MessageBoxConfig.tsx +256 -0
- package/ui/components/pay/NearbyAdvisoryModal.tsx +111 -0
- package/ui/components/pay/NearbyFlow.tsx +2542 -0
- package/ui/components/pay/OfflineNotice.tsx +337 -0
- package/ui/components/pay/PayCellRow.tsx +101 -0
- package/ui/components/pay/PayForm.tsx +223 -0
- package/ui/components/pay/PaymentQrDisplay.tsx +105 -0
- package/ui/components/pay/PaymentSuccessOverlay.tsx +266 -0
- package/ui/components/pay/RecipientField.tsx +308 -0
- package/ui/components/pay/RequestHub.tsx +75 -0
- package/ui/components/pay/ResultBanner.tsx +69 -0
- package/ui/components/pay/UniversalSend.tsx +687 -0
- package/ui/components/pay/useRecipientInput.ts +270 -0
- package/ui/components/security/WalletLockNotice.tsx +138 -0
- package/ui/components/ui/AlertCard.tsx +223 -0
- package/ui/components/ui/AppLogo.tsx +166 -0
- package/ui/components/ui/BlurChrome.tsx +72 -0
- package/ui/components/ui/Celebration.tsx +84 -0
- package/ui/components/ui/ChoiceSheet.ts +69 -0
- package/ui/components/ui/CustomSafeArea.tsx +74 -0
- package/ui/components/ui/ErrorBoundary.tsx +154 -0
- package/ui/components/ui/GroupedList.tsx +125 -0
- package/ui/components/ui/IconButton.tsx +105 -0
- package/ui/components/ui/ListRow.tsx +197 -0
- package/ui/components/ui/PermissionSheet.tsx +920 -0
- package/ui/components/ui/PresenceRow.tsx +215 -0
- package/ui/components/ui/PressableScale.tsx +105 -0
- package/ui/components/ui/ScreenGradient.tsx +47 -0
- package/ui/components/ui/ScrollFade.tsx +76 -0
- package/ui/components/ui/Sheet.tsx +342 -0
- package/ui/components/ui/Toast.tsx +142 -0
- package/ui/components/ui/index.ts +8 -0
- package/ui/components/vault/EnrollWizard.tsx +627 -0
- package/ui/components/vault/PassphraseField.tsx +306 -0
- package/ui/components/vault/PhraseBackupSheet.tsx +227 -0
- package/ui/components/vault/VaultBackdrop.tsx +354 -0
- package/ui/components/vault/VaultCeremonySheet.tsx +327 -0
- package/ui/components/wallet/ActivityRow.tsx +408 -0
- package/ui/components/wallet/AmountDisplay.tsx +48 -0
- package/ui/components/wallet/AmountInput.tsx +256 -0
- package/ui/components/wallet/BackupReminderSheet.tsx +168 -0
- package/ui/components/wallet/Balance.tsx +144 -0
- package/ui/components/wallet/BiometricAdvisoryModal.tsx +133 -0
- package/ui/components/wallet/ImportFromBackupPrompt.tsx +93 -0
- package/ui/exportDatabases.ts +122 -0
- package/ui/exportTransactions.ts +129 -0
- package/ui/hooks/useOfflineNoticeActions.ts +136 -0
- package/ui/hooks/useOnline.ts +70 -0
- package/ui/hooks/useSpendableBalance.ts +58 -0
- package/ui/hooks/useVaultBalance.ts +50 -0
- package/ui/importDatabases.ts +170 -0
- package/ui/index.ts +136 -0
- package/ui/isImageUrl.ts +10 -0
- package/ui/printRecoveryShares.ts +93 -0
- package/ui/resolveIdentity.ts +125 -0
- package/ui/screens/ConnectionsScreen.tsx +438 -0
- package/ui/screens/LogsScreen.tsx +432 -0
- package/ui/screens/PairScreen.tsx +288 -0
- package/ui/screens/PayScreen.tsx +479 -0
- package/ui/screens/SettingsScreen.tsx +180 -0
- package/ui/screens/TrustScreen.tsx +831 -0
- package/ui/screens/VaultRecoverScreen.tsx +226 -0
- package/ui/screens/VaultScreen.tsx +423 -0
- package/ui/screens/VaultTransferScreen.tsx +293 -0
- package/ui/screens/WalletCheckScreen.tsx +539 -0
- package/ui/screens/WalletConfigScreen.tsx +1095 -0
- package/ui/screens/WalletHomeScreen.tsx +1597 -0
- package/ui/screens/homeBadges.ts +18 -0
- package/ui/txStatus.ts +79 -0
- package/ui/validateTrust.ts +44 -0
package/core/index.ts
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
export const CANARY = 'core'
|
|
2
|
+
|
|
3
|
+
export { recoverMnemonicWallet, generateMnemonicWallet, validateMnemonic } from './mnemonicWallet'
|
|
4
|
+
export {
|
|
5
|
+
getRegisteredDbs,
|
|
6
|
+
registerDb,
|
|
7
|
+
selectLatestDb,
|
|
8
|
+
parseDbFilename,
|
|
9
|
+
parseTimestampFromFilename
|
|
10
|
+
} from './walletDbRegistry'
|
|
11
|
+
export { configureNewHeaderPolling } from './walletMonitor'
|
|
12
|
+
export { TaskSendOffline } from './monitor/TaskSendOffline'
|
|
13
|
+
export { TaskCreditInbox } from './monitor/TaskCreditInbox'
|
|
14
|
+
export { TaskDrainOutbox, drainUnsentEntries } from './monitor/TaskDrainOutbox'
|
|
15
|
+
export { getOnline, subscribeOnline } from './net/online'
|
|
16
|
+
export * from './logging'
|
|
17
|
+
export * from './diskSpace'
|
|
18
|
+
export type { AppChain, WalletChain } from './config'
|
|
19
|
+
export {
|
|
20
|
+
toWalletChain,
|
|
21
|
+
DEFAULT_WAB_URL,
|
|
22
|
+
DEFAULT_STORAGE_URL,
|
|
23
|
+
DEFAULT_MESSAGEBOX_URL,
|
|
24
|
+
DEFAULT_BACKUP_URL,
|
|
25
|
+
DEFAULT_CHAIN,
|
|
26
|
+
ADMIN_ORIGINATOR
|
|
27
|
+
} from './config'
|
|
28
|
+
|
|
29
|
+
// Theme tokens and providers
|
|
30
|
+
export { ThemeProvider, useTheme } from './theme/ThemeContext'
|
|
31
|
+
export { spacing, radii, typography, lightColors, darkColors, hitTargets } from './theme/tokens'
|
|
32
|
+
export { easings, springs, durations } from './theme/motion'
|
|
33
|
+
export { useThemeStyles } from './theme/useThemeStyles'
|
|
34
|
+
|
|
35
|
+
// Amount formatting helpers
|
|
36
|
+
export {
|
|
37
|
+
formatAmount,
|
|
38
|
+
formatAmountParts,
|
|
39
|
+
formatAmountInInputUnit,
|
|
40
|
+
formatSatoshisAsFiat,
|
|
41
|
+
formatSatoshisAsBsv,
|
|
42
|
+
formatSatoshisAsBsvDecimal,
|
|
43
|
+
parseDisplayToSatoshis,
|
|
44
|
+
getUnitLabel,
|
|
45
|
+
formatSatoshis,
|
|
46
|
+
isFiatCurrency,
|
|
47
|
+
satoshisPerFiatUnit,
|
|
48
|
+
fiatFractionDigits
|
|
49
|
+
} from './amountFormatHelpers'
|
|
50
|
+
export type { UsdToFiat, AmountFormatOptions } from './amountFormatHelpers'
|
|
51
|
+
|
|
52
|
+
// Internationalization
|
|
53
|
+
export { LanguageProvider } from './i18n/translations'
|
|
54
|
+
export { default as i18n } from './i18n/translations'
|
|
55
|
+
|
|
56
|
+
// Local peer-to-peer payment transport protocol
|
|
57
|
+
export * from './localpay/codec'
|
|
58
|
+
export * from './localpay/session'
|
|
59
|
+
export * from './localpay/build'
|
|
60
|
+
export * from './localpay/pending'
|
|
61
|
+
export * from './localpay/pendingAborts'
|
|
62
|
+
export * from './localpay/sessionPolicy'
|
|
63
|
+
export * from './localpay/verify'
|
|
64
|
+
export * from './localpay/qr'
|
|
65
|
+
export * from './localpay/nearbyPermissions'
|
|
66
|
+
// The transport interface and its two error classes are part of the public
|
|
67
|
+
// surface now that the screen holds LocalPaymentTransport[] (spec §6) and
|
|
68
|
+
// callers need to tell an AckError (radio failure → fountain) from a decline.
|
|
69
|
+
export { AckError, QrHandoffRequired, type Ack, type LocalPaymentTransport, type ReceivedFrame } from './localpay/types'
|
|
70
|
+
export { selectTransport } from './localpay/transport/select'
|
|
71
|
+
export * from './peerpay/outbox'
|
|
72
|
+
export * from './peerpay/control'
|
|
73
|
+
export * from './peerpay/handleResendRequests'
|
|
74
|
+
export * from './peerpay/resendBeef'
|
|
75
|
+
export * from './backup/status'
|
|
76
|
+
export * from './monitor/unfailRetry'
|
|
77
|
+
export * from './peerpay/offlineNacks'
|
|
78
|
+
export * from './peerpay/inboxAttempts'
|
|
79
|
+
|
|
80
|
+
// Offline-payment queueing
|
|
81
|
+
export * from './offline/hold'
|
|
82
|
+
export * from './offline/order'
|
|
83
|
+
export * from './offline/plan'
|
|
84
|
+
export * from './offline/payerHold'
|
|
85
|
+
|
|
86
|
+
// Local SQLite storage layer
|
|
87
|
+
export { StorageExpoSQLite } from './storage/StorageExpoSQLite'
|
|
88
|
+
export type { StorageExpoSQLiteOptions } from './storage/StorageExpoSQLite'
|
|
89
|
+
export { createTables, ensureOfflineActionsColumns } from './storage/schema/createTables'
|
|
90
|
+
export { initializeLocalStorage, isLocalStorage, getStorageDisplayName } from './storage/LocalStorageAdapter'
|
|
91
|
+
export type { LocalStorageConfig } from './storage/LocalStorageAdapter'
|
|
92
|
+
export { findOfflineActions, updateOfflineAction } from './storage/methods/offlineActions'
|
|
93
|
+
export type { OfflineActionRow, OfflineActionStatus, BindValue } from './storage/methods/offlineActions'
|
|
94
|
+
export { readWalletBalance } from './storage/methods/walletBalanceSql'
|
|
95
|
+
export { processOfflineActions } from './storage/methods/processOfflineActions'
|
|
96
|
+
export * from './storage/skipQueuedAncestors'
|
|
97
|
+
|
|
98
|
+
// Local secrets storage
|
|
99
|
+
export {
|
|
100
|
+
default as LocalStorageProvider,
|
|
101
|
+
useLocalStorage,
|
|
102
|
+
LocalStorageContext,
|
|
103
|
+
type LocalStorageContextType
|
|
104
|
+
} from './context/LocalStorageProvider'
|
|
105
|
+
|
|
106
|
+
// User context and native handlers
|
|
107
|
+
export { UserContextProvider, UserContext } from './context/UserContext'
|
|
108
|
+
export type { NativeHandlers } from './context/UserContext'
|
|
109
|
+
|
|
110
|
+
// Exchange rate context and service
|
|
111
|
+
export { ExchangeRateContextProvider, ExchangeRateContext } from './context/ExchangeRateContext'
|
|
112
|
+
export { getExchangeRate } from './services/exchangeRate'
|
|
113
|
+
export { loadUsdFxRates, FX_CACHE_KEY, FX_TTL_MS } from './services/usdFxRates'
|
|
114
|
+
export {
|
|
115
|
+
FIAT_CURRENCIES,
|
|
116
|
+
DISPLAY_CURRENCIES,
|
|
117
|
+
DISPLAY_CURRENCY_OPTIONS,
|
|
118
|
+
FALLBACK_USD_FX,
|
|
119
|
+
FRANKFURTER_RATES_URL,
|
|
120
|
+
fallbackUsdToFiat
|
|
121
|
+
} from './displayCurrencies'
|
|
122
|
+
export type { FiatCurrency } from './displayCurrencies'
|
|
123
|
+
|
|
124
|
+
// Pay rails
|
|
125
|
+
export * from './pay/rails'
|
|
126
|
+
export * from './pay/beefRepair'
|
|
127
|
+
export * from './pay/creditErrors'
|
|
128
|
+
export * from './pay/creditInbox'
|
|
129
|
+
export * from './pay/userError'
|
|
130
|
+
export * from './pay/rails/address'
|
|
131
|
+
export * from './pay/rails/handle'
|
|
132
|
+
// nearby.ts is a pure re-export barrel over localpay/* (already exported above)
|
|
133
|
+
// and @bsv/air-gap; only its genuinely new names are re-exported here by hand —
|
|
134
|
+
// a blanket `export *` would collide (TS2308) with the localpay/offline exports
|
|
135
|
+
// above, since most of nearby.ts's surface is itself a re-export of those.
|
|
136
|
+
// CAP_BLE is listed although `export * from './localpay/session'` already
|
|
137
|
+
// carries it: an explicit re-export takes precedence over a star export, so
|
|
138
|
+
// this is legal, and it keeps the block a faithful mirror of nearby.ts.
|
|
139
|
+
export {
|
|
140
|
+
AIR_GAP_PREFIX,
|
|
141
|
+
AirGapDecoder,
|
|
142
|
+
AirGapEncoder,
|
|
143
|
+
MAX_MESSAGE_BYTES,
|
|
144
|
+
estimatePartCharLength,
|
|
145
|
+
isAirGapPart,
|
|
146
|
+
awdlTransport,
|
|
147
|
+
nearbyTransport,
|
|
148
|
+
bleTransport,
|
|
149
|
+
localSupportsAwdl,
|
|
150
|
+
localSupportsNearby,
|
|
151
|
+
localSupportsBle,
|
|
152
|
+
describeFloor,
|
|
153
|
+
requestBlePermissions,
|
|
154
|
+
probeDeviceCaps,
|
|
155
|
+
capsFromProbe,
|
|
156
|
+
readBluetoothState,
|
|
157
|
+
prepareBle,
|
|
158
|
+
raceReceivers,
|
|
159
|
+
CAP_BLE,
|
|
160
|
+
isDeclineReason,
|
|
161
|
+
type TransportKind,
|
|
162
|
+
type FloorReason,
|
|
163
|
+
type DeviceProbe,
|
|
164
|
+
type BluetoothState,
|
|
165
|
+
type RaceWinner,
|
|
166
|
+
type RadioKind,
|
|
167
|
+
type ConfirmDelivery,
|
|
168
|
+
type DeclineReason
|
|
169
|
+
} from './pay/rails/nearby'
|
|
170
|
+
export * from './pay/sweeper'
|
|
171
|
+
export * from './pay/proofNudge'
|
|
172
|
+
// watchlist.ts's own KVStorage is omitted: it is structurally identical to the
|
|
173
|
+
// KVStorage already exported from './localpay/pending' above, and re-exporting
|
|
174
|
+
// both would collide (TS2308) on the name.
|
|
175
|
+
export {
|
|
176
|
+
WATCHLIST_KEY,
|
|
177
|
+
MAX_WATCHED,
|
|
178
|
+
WATCH_TTL_MS,
|
|
179
|
+
WATCH_UNSWEPT_TTL_MS,
|
|
180
|
+
MAX_WATCH_DAYS,
|
|
181
|
+
type WatchedAddress,
|
|
182
|
+
pruneWatchlist,
|
|
183
|
+
watchAddress,
|
|
184
|
+
getWatchlist,
|
|
185
|
+
touchWatched,
|
|
186
|
+
unwatchAddress
|
|
187
|
+
} from './pay/watchlist'
|
|
188
|
+
export * from './parsePeerPayURI'
|
|
189
|
+
|
|
190
|
+
// Blockchain header sync / checkpointing
|
|
191
|
+
export * from './headers/checkpoints'
|
|
192
|
+
export * from './headers/fs'
|
|
193
|
+
export * from './headers/headerStore'
|
|
194
|
+
export * from './headers/OfflineFirstChaintracks'
|
|
195
|
+
export * from './headers/prewarm'
|
|
196
|
+
export * from './headers/syncHeaders'
|
|
197
|
+
|
|
198
|
+
// Wallet-relevant constants (auto-approve thresholds, ARC broadcast URLs)
|
|
199
|
+
export * from './constants'
|
|
200
|
+
|
|
201
|
+
// Wallet service configuration, ARC broadcast providers, argument-size cap
|
|
202
|
+
//
|
|
203
|
+
// './deviceTier' is deliberately NOT re-exported here: capWalletArgs.ts loads
|
|
204
|
+
// it with a lazy `require(...)` (not a static import) specifically so that
|
|
205
|
+
// expo-device — a native module unavailable in Jest and any non-native host —
|
|
206
|
+
// is never pulled in at module-load time. A barrel `export *` would undo that
|
|
207
|
+
// by making every consumer of the package eagerly load it, which is exactly
|
|
208
|
+
// what broke the packageResolution canary during this move. It stays an
|
|
209
|
+
// internal implementation file, reached only via relative import from
|
|
210
|
+
// services/capWalletArgs.ts and services/walletArgLimits.ts (the latter as a
|
|
211
|
+
// type-only import, which is erased at compile time).
|
|
212
|
+
export * from './services/walletServiceConfig'
|
|
213
|
+
export * from './services/arcadeBroadcastProvider'
|
|
214
|
+
export * from './services/walletArgLimits'
|
|
215
|
+
export * from './services/capWalletArgs'
|
|
216
|
+
|
|
217
|
+
// Encrypted wallet backup log
|
|
218
|
+
export * from './backup/RemoteSyncReader'
|
|
219
|
+
export * from './backup/client'
|
|
220
|
+
export * from './backup/codec'
|
|
221
|
+
export * from './backup/constants'
|
|
222
|
+
export * from './backup/cursor'
|
|
223
|
+
export * from './backup/derive'
|
|
224
|
+
export * from './backup/deviceId'
|
|
225
|
+
export * from './backup/erase'
|
|
226
|
+
export * from './backup/preference'
|
|
227
|
+
export * from './backup/push'
|
|
228
|
+
export * from './backup/restore'
|
|
229
|
+
export * from './backup/restoreOnImport'
|
|
230
|
+
export * from './walletRepair/runWalletCheck'
|
|
231
|
+
export { TaskBackupPush } from './monitor/TaskBackupPush'
|
|
232
|
+
|
|
233
|
+
// Hardware vault: YubiKey PIV custody, ceremony state machine, K1 script,
|
|
234
|
+
// sealing/session/derivation crypto, transfers (deposit/withdraw/sweep/
|
|
235
|
+
// reclaim), persistence, passphrase policy, access guard, backup attestation.
|
|
236
|
+
//
|
|
237
|
+
// 'driver.ts' and 'random.ts' both reach for a native module
|
|
238
|
+
// (react-native-yubikey, expo-crypto) with a `require(...)` INSIDE a
|
|
239
|
+
// function body (loadNative() / randomBytes()), never at module top level —
|
|
240
|
+
// unlike './deviceTier' (see the comment above), so re-exporting them here
|
|
241
|
+
// does not force either native module to load eagerly; the require only
|
|
242
|
+
// fires when a caller actually invokes getVaultDriver()/randomBytes().
|
|
243
|
+
export * from './services/vault/types'
|
|
244
|
+
export * from './services/vault/driver'
|
|
245
|
+
export * from './services/vault/session'
|
|
246
|
+
export * from './services/vault/random'
|
|
247
|
+
export * from './services/vault/sealing'
|
|
248
|
+
export * from './services/vault/k1'
|
|
249
|
+
export * from './services/vault/vaultDerivation'
|
|
250
|
+
export * from './services/vault/vaultPassphrase'
|
|
251
|
+
export * from './services/vault/vaultStore'
|
|
252
|
+
export * from './services/vault/mockYubiKey'
|
|
253
|
+
export * from './services/vault/devMock'
|
|
254
|
+
export * from './services/vault/guard'
|
|
255
|
+
export * from './services/vault/backupAttestation'
|
|
256
|
+
export * from './services/vault/ceremony'
|
|
257
|
+
export * from './services/vault/ceremonyHost'
|
|
258
|
+
export * from './services/vault/VaultKeyService'
|
|
259
|
+
export * from './services/vault/transfers'
|
|
260
|
+
|
|
261
|
+
// Connection/pairing state (QR-paired desktop sessions), the vault ceremony
|
|
262
|
+
// context (React face of the ceremonyHost singleton), and the shared
|
|
263
|
+
// device-feedback hooks (haptics + confirmation/vault tones) both contexts
|
|
264
|
+
// depend on. VaultContext takes an `onToast` callback rather than importing
|
|
265
|
+
// a ui Toast component directly — core must never import from ui.
|
|
266
|
+
//
|
|
267
|
+
// useHaptics.ts requires expo-haptics lazily (inside each haptics.* call),
|
|
268
|
+
// not at module top level, for the same reason 'deviceTier' and
|
|
269
|
+
// services/vault/driver.ts+random.ts stay lazy: a native module imported
|
|
270
|
+
// statically at the top of a barrel-exported file loads eagerly for every
|
|
271
|
+
// consumer of the package, including hosts (tests, non-native environments)
|
|
272
|
+
// that never trigger a haptic. useConfirmationSound.ts already requires
|
|
273
|
+
// expo-audio the same way.
|
|
274
|
+
export { default as connectionStore } from './stores/ConnectionStore'
|
|
275
|
+
export type { Connection } from './stores/ConnectionStore'
|
|
276
|
+
export * from './context/WalletConnectionContext'
|
|
277
|
+
export * from './context/VaultContext'
|
|
278
|
+
export * from './hooks/useHaptics'
|
|
279
|
+
export * from './hooks/useConfirmationSound'
|
|
280
|
+
|
|
281
|
+
// WalletContext — the core hub wiring together storage, headers, localpay,
|
|
282
|
+
// backup, vault-ceremony bridging, and monitor tasks. Only its two actually-
|
|
283
|
+
// consumed exports are re-exported here (WalletContextProvider, useWallet) —
|
|
284
|
+
// its narrow selector hooks (useWalletStatus, useWalletQueues,
|
|
285
|
+
// useTxStatusVersion), WalletManagersContext, and the various *Value/*Slice
|
|
286
|
+
// types have zero current consumers anywhere in the app, so they are left
|
|
287
|
+
// off the barrel for now (same "only what's actually used" convention as
|
|
288
|
+
// Task 3's motion.ts/useThemeStyles.tsx) — reachable via a relative import
|
|
289
|
+
// from inside the package if a future task needs them, and easy to add here
|
|
290
|
+
// once a real consumer exists. WalletContextProvider takes an optional
|
|
291
|
+
// onToast prop (see WalletContext.tsx's WalletContextToast type) rather than
|
|
292
|
+
// importing a ui Toast component directly — core must never import from ui,
|
|
293
|
+
// same boundary as VaultContext's onToast above.
|
|
294
|
+
export { WalletContextProvider, useWallet, WalletContext } from './context/WalletContext'
|
|
295
|
+
export { usePermissionQueue } from './hooks/usePermissionQueue'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The runtime grants the BLE rung needs, by API level. This is the Bluetooth-
|
|
3
|
+
* only subset of what Nearby Connections asks for: no NEARBY_WIFI_DEVICES,
|
|
4
|
+
* because bsvpay-ble/1 is plain GATT and never touches Wi-Fi. Requested
|
|
5
|
+
* lazily — the payee on entering the nearby flow when Google Play services is
|
|
6
|
+
* absent, the payer inside executeSend only when BLE was selected — never at
|
|
7
|
+
* app start. A denial is a soft degrade to the QR fountain, not an error.
|
|
8
|
+
*
|
|
9
|
+
* iOS has no runtime request API for Bluetooth: the system prompt fires the
|
|
10
|
+
* first time a CB*Manager is instantiated (prepare() / sendFrame), so this
|
|
11
|
+
* resolves false there without asking anything, exactly like the Nearby helper.
|
|
12
|
+
*/
|
|
13
|
+
import { PermissionsAndroid, Platform } from 'react-native'
|
|
14
|
+
|
|
15
|
+
export async function requestBlePermissions(): Promise<boolean> {
|
|
16
|
+
if (Platform.OS !== 'android') return false
|
|
17
|
+
const api = typeof Platform.Version === 'number' ? Platform.Version : parseInt(String(Platform.Version), 10)
|
|
18
|
+
const wanted: string[] =
|
|
19
|
+
api >= 31
|
|
20
|
+
? [
|
|
21
|
+
PermissionsAndroid.PERMISSIONS.BLUETOOTH_SCAN,
|
|
22
|
+
PermissionsAndroid.PERMISSIONS.BLUETOOTH_CONNECT,
|
|
23
|
+
PermissionsAndroid.PERMISSIONS.BLUETOOTH_ADVERTISE
|
|
24
|
+
]
|
|
25
|
+
: [PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION]
|
|
26
|
+
try {
|
|
27
|
+
const results = await PermissionsAndroid.requestMultiple(wanted as never)
|
|
28
|
+
return wanted.every(p => results[p as keyof typeof results] === PermissionsAndroid.RESULTS.GRANTED)
|
|
29
|
+
} catch {
|
|
30
|
+
return false
|
|
31
|
+
}
|
|
32
|
+
}
|