@bsv/expo-wallet-toolbox 0.23.0 → 0.24.1
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 +147 -0
- package/README.md +1 -4
- package/android/build.gradle +15 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/org/bsv/boundedfetch/BoundedBody.java +19 -0
- package/android/src/main/java/org/bsv/boundedfetch/BoundedConnection.java +28 -0
- package/android/src/main/java/org/bsv/boundedfetch/BsvBoundedFetchModule.kt +114 -0
- package/core/backup/RemoteSyncReader.ts +71 -46
- package/core/backup/client.ts +6 -15
- package/core/backup/codec.ts +78 -13
- package/core/backup/constants.ts +3 -9
- package/core/backup/cursor.ts +8 -0
- package/core/backup/push.ts +26 -16
- package/core/backup/restore.ts +6 -5
- package/core/bridge/inbox.ts +169 -64
- package/core/bridge/memoryInboxStore.ts +10 -1
- package/core/constants.ts +7 -11
- package/core/context/WalletConnectionContext.tsx +85 -48
- package/core/context/WalletContext.tsx +30 -32
- package/core/context/usePairingAttempt.ts +31 -0
- package/core/e2e/broadcaster.ts +25 -0
- package/core/e2e/consentFixture.ts +46 -0
- package/core/e2e/mode.ts +42 -0
- package/core/headers/OfflineFirstChaintracks.ts +57 -107
- package/core/headers/headerConsensus.ts +230 -0
- package/core/headers/headerStore.ts +344 -122
- package/core/headers/prewarm.ts +4 -7
- package/core/headers/syncHeaders.ts +82 -12
- package/core/i18n/translations.tsx +47 -12
- package/core/identity/handleRegistry/client.ts +4 -2
- package/core/identity/handleRegistry/resolver.ts +7 -11
- package/core/index.ts +2 -0
- package/core/localpay/pending.ts +39 -4
- package/core/network/boundedFetch.ts +101 -0
- package/core/networks.ts +11 -13
- package/core/pay/rails/address.ts +5 -4
- package/core/pay/rails/handle.ts +3 -1
- package/core/pay/rails/sweep.ts +791 -0
- package/core/peerpay/brc29.ts +4 -0
- package/core/peerpay/handleResendRequests.ts +15 -2
- package/core/peerpay/outbox.ts +115 -2
- package/core/profiles/assertProfileEmpty.ts +2 -2
- package/core/profiles/profileStore.ts +3 -2
- package/core/services/arcadeBroadcastProvider.ts +260 -114
- package/core/services/secrets/kek.ts +5 -0
- package/core/services/secrets/migration.ts +27 -2
- package/core/services/secrets/policy.ts +6 -0
- package/core/services/vault/VaultKeyService.ts +5 -2
- package/core/services/vault/ceremony.ts +2 -2
- package/core/services/vault/ceremonyHost.ts +1 -1
- package/core/services/vault/guard.ts +10 -0
- package/core/services/vault/outputAuthority.ts +76 -0
- package/core/services/vault/transfers.ts +52 -28
- package/core/services/vault/vaultStore.ts +60 -14
- package/core/services/walletConnectionValidation.ts +13 -1
- package/core/services/walletServiceConfig.ts +8 -7
- package/core/stores/ConnectionStore.ts +17 -0
- package/core/toolboxConfig.ts +60 -1
- package/expo-module.config.json +5 -0
- package/ios/BoundedBody.swift +15 -0
- package/ios/BsvBoundedFetch.podspec +17 -0
- package/ios/BsvBoundedFetchModule.swift +134 -0
- package/package.json +7 -3
- package/ui/components/pay/AddressReceive.tsx +6 -2
- package/ui/components/pay/ImportedOutboxApproval.tsx +142 -0
- package/ui/components/pay/PayCellRow.tsx +3 -1
- package/ui/components/pay/PayForm.tsx +12 -2
- package/ui/components/pay/RecipientField.tsx +1 -0
- package/ui/components/pay/RequestHub.tsx +1 -0
- package/ui/components/pay/UniversalSend.tsx +110 -42
- package/ui/components/ui/ListRow.tsx +10 -2
- package/ui/components/vault/KeyChooser.tsx +1 -1
- package/ui/components/wallet/AmountInput.tsx +4 -1
- package/ui/components/wallet/BackupReminderSheet.tsx +8 -1
- package/ui/components/wallet/BiometricAdvisoryModal.tsx +2 -0
- package/ui/components/wallet/ImportFromBackupPrompt.tsx +6 -1
- package/ui/components/wallet/ProfileButton.tsx +1 -0
- package/ui/importDatabases.ts +31 -6
- package/ui/screens/ConnectionsScreen.tsx +12 -3
- package/ui/screens/PairScreen.tsx +10 -3
- package/ui/screens/PayScreen.tsx +1 -0
- package/ui/screens/TrustScreen.tsx +6 -3
- package/ui/screens/VaultScreen.tsx +13 -3
- package/ui/screens/VaultTransferScreen.tsx +6 -3
- package/ui/screens/WalletConfigScreen.tsx +17 -2
- package/ui/screens/WalletHomeScreen.tsx +7 -1
|
@@ -9,6 +9,7 @@ import { useTranslation } from 'react-i18next'
|
|
|
9
9
|
import type { Certifier as WalletCertifier } from '@bsv/wallet-toolbox-mobile'
|
|
10
10
|
import validateTrust from '../validateTrust'
|
|
11
11
|
import { isPublicHttpsUrl } from '../../core/net/publicDestination'
|
|
12
|
+
import { createBoundedNativeFetch } from '../../core/network/boundedFetch'
|
|
12
13
|
import { GroupedSection } from '../components/ui/GroupedList'
|
|
13
14
|
import { showAlert } from '../components/ui/AlertCard'
|
|
14
15
|
import { haptics, useTheme, spacing, radii, typography, useWallet } from '@bsv/expo-wallet-toolbox'
|
|
@@ -156,7 +157,7 @@ const fetchWithTimeout = async (url: string, ms: number) => {
|
|
|
156
157
|
// a trust-provider manifest is fetched from by redirecting the entered
|
|
157
158
|
// HTTPS origin somewhere else (XR-076 / SEC2-011) — a legitimate provider
|
|
158
159
|
// has no reason to redirect its own manifest.json.
|
|
159
|
-
res = await
|
|
160
|
+
res = await createBoundedNativeFetch(MAX_TRUST_MANIFEST_BYTES)(url, { signal: controller.signal, redirect: 'error' })
|
|
160
161
|
} finally {
|
|
161
162
|
clearTimeout(id)
|
|
162
163
|
}
|
|
@@ -198,12 +199,14 @@ const fetchWithTimeout = async (url: string, ms: number) => {
|
|
|
198
199
|
const MAX_TRUST_MANIFEST_BYTES = 64 * 1024
|
|
199
200
|
|
|
200
201
|
/**
|
|
201
|
-
*
|
|
202
|
+
* The native receiver enforces the actual byte ceiling before returning this
|
|
203
|
+
* Response, including on runtimes without WHATWG streams. This additional
|
|
204
|
+
* reader check bounds trusted injected transports in tests. A
|
|
202
205
|
* declared Content-Length over the cap is refused before anything is read;
|
|
203
206
|
* otherwise, when the runtime exposes the body as a stream, chunks are
|
|
204
207
|
* counted as they arrive and the read is aborted the instant the running
|
|
205
208
|
* total crosses the cap. `fallback` (the runtime's own `response.json`) is
|
|
206
|
-
* used
|
|
209
|
+
* used on native Response implementations after receive-time enforcement.
|
|
207
210
|
*/
|
|
208
211
|
async function readBoundedManifestJson(res: Response, fallback: () => Promise<unknown>): Promise<unknown> {
|
|
209
212
|
const declared = res.headers?.get?.('content-length')
|
|
@@ -749,11 +749,21 @@ export function VaultScreen() {
|
|
|
749
749
|
const currentMeta = metaRef.current
|
|
750
750
|
if (!currentMeta) throw new VaultError('not-enrolled', 'Vault is not set up')
|
|
751
751
|
const scopeToken = vaultStore.captureScopeToken()
|
|
752
|
-
await requireAuthenticatedMeta(
|
|
752
|
+
const authenticatedMeta = await requireAuthenticatedMeta(
|
|
753
|
+
pm as unknown as VaultWallet,
|
|
754
|
+
adminOriginator,
|
|
755
|
+
scopeToken,
|
|
756
|
+
currentMeta
|
|
757
|
+
)
|
|
753
758
|
const scope = vaultStore.getScope()
|
|
754
759
|
if (!scope) throw new VaultError('not-enrolled', 'Wallet vault scope is not configured')
|
|
755
|
-
await vaultStore.renameKey(
|
|
756
|
-
|
|
760
|
+
await vaultStore.renameKey(
|
|
761
|
+
renaming.serial,
|
|
762
|
+
next,
|
|
763
|
+
scopeToken,
|
|
764
|
+
nextMeta =>
|
|
765
|
+
computeVaultMetaAuthorityTag(pm as unknown as HmacCapableWallet, adminOriginator, nextMeta, scope),
|
|
766
|
+
authenticatedMeta
|
|
757
767
|
)
|
|
758
768
|
await reload()
|
|
759
769
|
} catch (e) {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Direction comes from the `direction` search param ('deposit' | 'withdraw').
|
|
5
5
|
*
|
|
6
|
-
* Deposit
|
|
6
|
+
* Deposit proves a live enrolled key, then builds an R1C output committed to every
|
|
7
7
|
* enrolled key and broadcasts it (depositToVault). The screen shows the floor
|
|
8
8
|
* and the fee inline, confirms the FIRST deposit into an empty vault, and
|
|
9
9
|
* refuses while encrypted private backup is unavailable. The salt is
|
|
@@ -219,7 +219,8 @@ export function VaultTransferScreen() {
|
|
|
219
219
|
!(isDeposit && overLockLimit) &&
|
|
220
220
|
!!pm &&
|
|
221
221
|
balance !== null &&
|
|
222
|
-
|
|
222
|
+
chosen !== undefined &&
|
|
223
|
+
(!isDeposit || released)
|
|
223
224
|
|
|
224
225
|
/** `nickname · …tail4` for each referenced key; a key no longer in meta shows its pubkey tail. */
|
|
225
226
|
const namesFor = useCallback(
|
|
@@ -312,6 +313,7 @@ export function VaultTransferScreen() {
|
|
|
312
313
|
setError(null)
|
|
313
314
|
try {
|
|
314
315
|
if (isDeposit) {
|
|
316
|
+
if (!chosen) return
|
|
315
317
|
// XR-003: checked before privateBackupEnabled and before the
|
|
316
318
|
// first-deposit confirmation, for the same reason both of those run
|
|
317
319
|
// early — the user must never be asked to approve a transfer that a
|
|
@@ -343,6 +345,7 @@ export function VaultTransferScreen() {
|
|
|
343
345
|
}
|
|
344
346
|
setBusy(true)
|
|
345
347
|
await depositToVault(w, adminOriginator, sats, {
|
|
348
|
+
outputKeySerial: chosen.serial,
|
|
346
349
|
isOnline: getOnline,
|
|
347
350
|
backupEnabled: privateBackupEnabled
|
|
348
351
|
})
|
|
@@ -526,7 +529,7 @@ export function VaultTransferScreen() {
|
|
|
526
529
|
{isDeposit ? t('vault_deposit_sub') : t('vault_withdraw_sub')}
|
|
527
530
|
</Text>
|
|
528
531
|
|
|
529
|
-
{
|
|
532
|
+
{keys.length > 0 && (
|
|
530
533
|
<View style={styles.chooser}>
|
|
531
534
|
<Text style={[styles.chooserLabel, { color: colors.textPrimary }]}>{t('vault_choose_key')}</Text>
|
|
532
535
|
{/* Frozen while a ceremony runs: the highlighted key must stay the
|
|
@@ -71,6 +71,7 @@ import { PrivateKey } from '@bsv/sdk'
|
|
|
71
71
|
import { useExportWalletData } from '../hooks/useExportWalletData'
|
|
72
72
|
import { importWalletDatabase } from '../importDatabases'
|
|
73
73
|
import { useSafeAreaInsets } from 'react-native-safe-area-context'
|
|
74
|
+
import { isE2eBuild } from '../../core/e2e/mode'
|
|
74
75
|
import { profileScopedKey } from '../../core/profiles/profileStore'
|
|
75
76
|
import { profileLabel } from '../../core/profiles/profileLabel'
|
|
76
77
|
import { NETWORKS } from '../../core/networks'
|
|
@@ -536,9 +537,10 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
|
|
|
536
537
|
{ id: 'teratest', label: t('teratest'), color: colors.info },
|
|
537
538
|
{ id: 'scaletest', label: t('scaletest'), color: colors.accent }
|
|
538
539
|
] as { id: AppChain; label: string; color: string }[]
|
|
539
|
-
).filter(n => NETWORKS[n.id].available || n.id === selectedNetwork)
|
|
540
|
+
).filter(n => (isE2eBuild() ? n.id !== 'main' : true) && (NETWORKS[n.id].available || n.id === selectedNetwork))
|
|
540
541
|
|
|
541
542
|
const handleSelectNetwork = async (target: AppChain) => {
|
|
543
|
+
if (isE2eBuild() && target === 'main') return
|
|
542
544
|
if (target === selectedNetwork) {
|
|
543
545
|
setNetworkExpanded(false)
|
|
544
546
|
return
|
|
@@ -558,7 +560,13 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
|
|
|
558
560
|
<View style={{ flex: 1, backgroundColor: colors.backgroundSecondary, paddingTop: insets.top }}>
|
|
559
561
|
{/* Header */}
|
|
560
562
|
<View style={[localStyles.header, { borderBottomColor: colors.separator }]}>
|
|
561
|
-
<TouchableOpacity
|
|
563
|
+
<TouchableOpacity
|
|
564
|
+
onPress={() => router.back()}
|
|
565
|
+
testID="settings-back"
|
|
566
|
+
accessibilityRole="button"
|
|
567
|
+
accessibilityLabel={t('go_back')}
|
|
568
|
+
style={localStyles.headerBack}
|
|
569
|
+
>
|
|
562
570
|
<Ionicons name="chevron-back" size={24} color={colors.textSecondary} />
|
|
563
571
|
</TouchableOpacity>
|
|
564
572
|
<Text style={[localStyles.headerTitle, { color: colors.textPrimary }]}>{t('settings')}</Text>
|
|
@@ -611,6 +619,7 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
|
|
|
611
619
|
</View>
|
|
612
620
|
)}
|
|
613
621
|
<ListRow
|
|
622
|
+
testID="settings-connections"
|
|
614
623
|
label={t('connect_to_app')}
|
|
615
624
|
icon="qr-code-outline"
|
|
616
625
|
iconColor="#0A84FF"
|
|
@@ -620,6 +629,7 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
|
|
|
620
629
|
reaches for when something looks wrong, and they must not have to
|
|
621
630
|
open a section labelled "Advanced" to find it. */}
|
|
622
631
|
<ListRow
|
|
632
|
+
testID="settings-troubleshooting"
|
|
623
633
|
label={t('check_wallet')}
|
|
624
634
|
icon="checkmark-done-circle-outline"
|
|
625
635
|
iconColor="#30D158"
|
|
@@ -631,6 +641,7 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
|
|
|
631
641
|
{/* ── Advanced ── */}
|
|
632
642
|
<GroupedSection>
|
|
633
643
|
<ListRow
|
|
644
|
+
testID="settings-advanced"
|
|
634
645
|
label={t('advanced')}
|
|
635
646
|
icon="construct-outline"
|
|
636
647
|
iconColor="#8E8E93"
|
|
@@ -657,6 +668,7 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
|
|
|
657
668
|
}
|
|
658
669
|
>
|
|
659
670
|
<ListRow
|
|
671
|
+
testID="settings-network"
|
|
660
672
|
label={t('bsv_network')}
|
|
661
673
|
value={
|
|
662
674
|
switchingNetwork
|
|
@@ -901,6 +913,7 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
|
|
|
901
913
|
</View>
|
|
902
914
|
)}
|
|
903
915
|
<ListRow
|
|
916
|
+
testID="settings-trust"
|
|
904
917
|
label={t('trust_network')}
|
|
905
918
|
icon="shield-checkmark-outline"
|
|
906
919
|
iconColor="#BF5AF2"
|
|
@@ -1016,6 +1029,7 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
|
|
|
1016
1029
|
trailing={isImporting ? <ActivityIndicator size="small" /> : undefined}
|
|
1017
1030
|
/>
|
|
1018
1031
|
<ListRow
|
|
1032
|
+
testID="settings-logs"
|
|
1019
1033
|
label="Debugging"
|
|
1020
1034
|
icon="terminal-outline"
|
|
1021
1035
|
iconColor="#8E8E93"
|
|
@@ -1061,6 +1075,7 @@ export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolea
|
|
|
1061
1075
|
{!hideLogout && (
|
|
1062
1076
|
<GroupedSection>
|
|
1063
1077
|
<ListRow
|
|
1078
|
+
testID="settings-log-out"
|
|
1064
1079
|
label={t('log_out')}
|
|
1065
1080
|
icon="log-out-outline"
|
|
1066
1081
|
iconColor={colors.error}
|
|
@@ -1741,6 +1741,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1741
1741
|
onPress={heldAsset ? undefined : () => setFlipped(f => !f)}
|
|
1742
1742
|
disabled={Boolean(heldAsset)}
|
|
1743
1743
|
activeOpacity={0.7}
|
|
1744
|
+
testID="home-balance"
|
|
1744
1745
|
style={styles.balanceBlock}
|
|
1745
1746
|
accessibilityLabel={
|
|
1746
1747
|
heldAsset
|
|
@@ -1798,6 +1799,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1798
1799
|
<PressableScale
|
|
1799
1800
|
haptic="confirm"
|
|
1800
1801
|
onPress={() => destinationPress(payDestination('pay'))}
|
|
1802
|
+
testID="home-pay"
|
|
1801
1803
|
style={[styles.dest, styles.destPrimary, { backgroundColor: colors.accent }]}
|
|
1802
1804
|
>
|
|
1803
1805
|
<MaterialCommunityIcons name="arrow-top-right" size={19} color={colors.textOnAccent} />
|
|
@@ -1809,6 +1811,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1809
1811
|
<PressableScale
|
|
1810
1812
|
haptic="confirm"
|
|
1811
1813
|
onPress={() => destinationPress(payDestination('get'))}
|
|
1814
|
+
testID="home-receive"
|
|
1812
1815
|
style={[styles.dest, { backgroundColor: colors.surfaceRaised, borderColor: colors.surfaceRaisedBorder }]}
|
|
1813
1816
|
>
|
|
1814
1817
|
<MaterialCommunityIcons name="arrow-bottom-left" size={19} color={colors.textPrimary} />
|
|
@@ -1830,6 +1833,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1830
1833
|
<PressableScale
|
|
1831
1834
|
haptic="confirm"
|
|
1832
1835
|
onPress={() => router.push('/vault')}
|
|
1836
|
+
testID="home-vault"
|
|
1833
1837
|
style={[styles.dest, { backgroundColor: colors.surfaceRaised, borderColor: colors.surfaceRaisedBorder }]}
|
|
1834
1838
|
>
|
|
1835
1839
|
<MaterialCommunityIcons name="safe" size={19} color={colors.textPrimary} />
|
|
@@ -1966,6 +1970,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
1966
1970
|
controls is on screen, so the button says it is on. */}
|
|
1967
1971
|
<TouchableOpacity
|
|
1968
1972
|
onPress={toggleFilter}
|
|
1973
|
+
testID="activity-filter"
|
|
1969
1974
|
// Never disabled while open: an emptied list (a network switch)
|
|
1970
1975
|
// must not strand the panel with no way to close it.
|
|
1971
1976
|
disabled={actions.length === 0 && !filterOpen}
|
|
@@ -2159,6 +2164,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
2159
2164
|
<View style={[styles.headerSide, styles.headerSideEnd]}>
|
|
2160
2165
|
<TouchableOpacity
|
|
2161
2166
|
onPress={() => router.push('/wallet-config')}
|
|
2167
|
+
testID="home-settings"
|
|
2162
2168
|
style={[styles.iconBtn, { backgroundColor: colors.surfaceRaised, borderColor: colors.surfaceRaisedBorder }]}
|
|
2163
2169
|
accessibilityRole="button"
|
|
2164
2170
|
accessibilityLabel={t('wallet_settings')}
|
|
@@ -2214,7 +2220,7 @@ export function WalletHomeScreen({ topLeft }: WalletHomeScreenProps = {}) {
|
|
|
2214
2220
|
<ActivityIndicator style={styles.pad} color={colors.textSecondary} />
|
|
2215
2221
|
)
|
|
2216
2222
|
) : (
|
|
2217
|
-
<Text style={[styles.empty, { color: colors.textSecondary }]}>
|
|
2223
|
+
<Text testID="activity-empty" style={[styles.empty, { color: colors.textSecondary }]}>
|
|
2218
2224
|
{heldAsset
|
|
2219
2225
|
? t('wallet_activity_empty_asset', { ticker: heldAsset.asset.ticker })
|
|
2220
2226
|
: t('no_transactions')}
|