@bsv/expo-wallet-toolbox 0.25.1 → 0.26.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 +31 -0
- package/core/context/WalletContext.tsx +3 -1
- package/core/i18n/translations.tsx +221 -36
- package/core/identity/handleRegistry/client.ts +110 -16
- package/core/identity/handleRegistry/registration.ts +115 -17
- package/core/profiles/profileStore.ts +4 -1
- package/core/services/groupSpendingLimit.ts +26 -0
- package/core/services/signingPermissionPolicy.ts +14 -8
- package/core/services/vault/ceremony.ts +13 -0
- package/core/services/vault/ceremonyHost.ts +58 -0
- package/core/services/vault/failedVaultSpend.ts +40 -0
- package/core/services/vault/outputAuthority.ts +13 -6
- package/core/services/vault/transfers.ts +56 -12
- package/core/storage/encryptedDbImage.ts +11 -2
- package/core/theme/tokens.ts +26 -12
- package/package.json +2 -1
- package/ui/components/QRScanner.tsx +24 -22
- package/ui/components/pay/MessageBoxConfig.tsx +10 -16
- package/ui/components/pay/NearbyAdvisoryModal.tsx +6 -13
- package/ui/components/pay/NearbyFlow.tsx +72 -35
- package/ui/components/pay/PayForm.tsx +27 -19
- package/ui/components/pay/PaymentSuccessOverlay.tsx +8 -6
- package/ui/components/pay/UniversalSend.tsx +4 -1
- package/ui/components/ui/AlertCard.tsx +3 -2
- package/ui/components/ui/BalancedText.tsx +117 -0
- package/ui/components/ui/ErrorBoundary.tsx +31 -14
- package/ui/components/ui/GroupedList.tsx +28 -22
- package/ui/components/ui/ListRow.tsx +126 -35
- package/ui/components/ui/PermissionSheet.tsx +31 -24
- package/ui/components/ui/PresenceRow.tsx +15 -23
- package/ui/components/ui/Sheet.tsx +11 -17
- package/ui/components/ui/Toast.tsx +13 -17
- package/ui/components/vault/EnrollWizard.tsx +446 -196
- package/ui/components/vault/KeyChooser.tsx +7 -20
- package/ui/components/vault/VaultCeremonySheet.tsx +44 -36
- package/ui/components/wallet/AmountInput.tsx +11 -17
- package/ui/components/wallet/BiometricAdvisoryModal.tsx +13 -17
- package/ui/index.ts +1 -1
- package/ui/screens/TrustScreen.tsx +49 -61
- package/ui/screens/VaultScreen.tsx +99 -60
- package/ui/screens/VaultTransferScreen.tsx +34 -27
- package/ui/screens/WalletCheckScreen.tsx +25 -24
- package/ui/screens/WalletConfigScreen.tsx +66 -72
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* to, for this exact output, before any funding action is created. */
|
|
5
5
|
import { Hash, Utils } from '@bsv/sdk'
|
|
6
6
|
import { p256 } from '@noble/curves/nist.js'
|
|
7
|
-
import { requestVaultSigner } from './ceremonyHost'
|
|
7
|
+
import { requestVaultSigner, type VaultSignerSession } from './ceremonyHost'
|
|
8
8
|
import { randomBytes } from './random'
|
|
9
9
|
import { VaultError } from './types'
|
|
10
10
|
import { vaultStore, type VaultMeta, type VaultScopeToken } from './vaultStore'
|
|
@@ -19,7 +19,11 @@ export async function requireVaultOutputKeyPossession(
|
|
|
19
19
|
meta: Pick<VaultMeta, 'vaultId' | 'revision' | 'createdAt' | 'keys' | 'lastUsedSerial'>,
|
|
20
20
|
scope: VaultScopeToken,
|
|
21
21
|
output: VaultOutputAuthorityContext,
|
|
22
|
-
chosenSerial?: string
|
|
22
|
+
chosenSerial?: string,
|
|
23
|
+
/** A spend's own key session: the proof is signed in it and the session
|
|
24
|
+
* stays open for the input signatures (one PIN, one tap). `reason` is the
|
|
25
|
+
* spend's, because the first ceremony fixes the NFC alert text. */
|
|
26
|
+
shared?: { session: VaultSignerSession; reason: string }
|
|
23
27
|
): Promise<void> {
|
|
24
28
|
vaultStore.assertScopeToken(scope)
|
|
25
29
|
const chosen =
|
|
@@ -46,7 +50,7 @@ export async function requireVaultOutputKeyPossession(
|
|
|
46
50
|
'utf8'
|
|
47
51
|
)
|
|
48
52
|
)
|
|
49
|
-
await proveKeyPossession(scope, chosen, digest, 'Verify vault key for new funds')
|
|
53
|
+
await proveKeyPossession(scope, chosen, digest, shared?.reason ?? 'Verify vault key for new funds', shared?.session)
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
/** Fresh hardware authority to promote a staged key (add-key, late-key) when
|
|
@@ -89,9 +93,12 @@ async function proveKeyPossession(
|
|
|
89
93
|
scope: VaultScopeToken,
|
|
90
94
|
chosen: VaultMeta['keys'][number],
|
|
91
95
|
digest: number[],
|
|
92
|
-
reason: string
|
|
96
|
+
reason: string,
|
|
97
|
+
/** When given, the signer belongs to the caller's session: it is not
|
|
98
|
+
* released here. The session's owner closes it, also when this throws. */
|
|
99
|
+
session?: VaultSignerSession
|
|
93
100
|
): Promise<void> {
|
|
94
|
-
const signer = await requestVaultSigner(reason, chosen.serial)
|
|
101
|
+
const signer = session ? await session.acquire(reason, chosen.serial) : await requestVaultSigner(reason, chosen.serial)
|
|
95
102
|
try {
|
|
96
103
|
vaultStore.assertScopeToken(scope)
|
|
97
104
|
if (signer.serial !== chosen.serial || signer.pubkey !== chosen.pubkey) {
|
|
@@ -116,6 +123,6 @@ async function proveKeyPossession(
|
|
|
116
123
|
}
|
|
117
124
|
if (!valid) throw new VaultError('wrong-key', 'Hardware failed the new vault output possession challenge')
|
|
118
125
|
} finally {
|
|
119
|
-
signer.release()
|
|
126
|
+
if (!session) signer.release()
|
|
120
127
|
}
|
|
121
128
|
}
|
|
@@ -45,7 +45,7 @@ import { Beef, Hash, LockingScript, OP, P2PKH, PublicKey, Script, Transaction, U
|
|
|
45
45
|
import { isBackupPushEnabled } from '../../backup/preference'
|
|
46
46
|
import { getBackupUrl, isVaultAvailable, isVaultEnabled } from '../../toolboxConfig'
|
|
47
47
|
import { sdk as toolboxSdk } from '@bsv/wallet-toolbox-mobile'
|
|
48
|
-
import { noteVaultProgress, requestVaultSigner } from './ceremonyHost'
|
|
48
|
+
import { noteVaultProgress, openVaultSignerSession, requestVaultSigner, type VaultSignerSession } from './ceremonyHost'
|
|
49
49
|
import {
|
|
50
50
|
MAX_DESCRIPTOR_CIPHERTEXT_BYTES,
|
|
51
51
|
R1C_LOCK_LEN,
|
|
@@ -72,6 +72,7 @@ import { VaultError } from './types'
|
|
|
72
72
|
import { metaFromVerifiedOutputs, VAULT_MAX_KEYS, VAULT_MIN_KEYS } from './VaultKeyService'
|
|
73
73
|
import { vaultStore, VaultKeyRecord, VaultMeta, type VaultScopeToken, type VaultStoreScope } from './vaultStore'
|
|
74
74
|
import { computeVaultMetaAuthorityTag, verifyVaultMetaAuthorityTag, type HmacCapableWallet } from './metaAuthority'
|
|
75
|
+
import { failedVaultSpendBlocksRemoval } from './failedVaultSpend'
|
|
75
76
|
import { requireVaultKeyChallenge, requireVaultOutputKeyPossession } from './outputAuthority'
|
|
76
77
|
import { planLockKeys, type LockKeyPlan } from './lockKeys'
|
|
77
78
|
import { forgetSerialsNoLongerEnrolledForIdentity } from './enrolledSerialRegistry'
|
|
@@ -380,6 +381,10 @@ function asHmacWallet(w: VaultWallet): HmacCapableWallet {
|
|
|
380
381
|
export interface VaultActionRow {
|
|
381
382
|
txid?: string
|
|
382
383
|
status: string
|
|
384
|
+
/** When the wallet recorded the action. Not part of BRC-100's listActions
|
|
385
|
+
* result; the wallet core returns it with each row. Read only by
|
|
386
|
+
* failedVaultSpendBlocksRemoval, which blocks when it is missing. */
|
|
387
|
+
created_at?: string | Date
|
|
383
388
|
reference?: string
|
|
384
389
|
labels?: string[]
|
|
385
390
|
inputs?: { sourceOutpoint?: string; sourceSatoshis?: number; sourceLockingScript?: string }[]
|
|
@@ -2316,7 +2321,11 @@ async function newVaultOutput(
|
|
|
2316
2321
|
outputDescription: string,
|
|
2317
2322
|
inventory: VaultSaltInventory,
|
|
2318
2323
|
scopeToken: VaultScopeToken,
|
|
2319
|
-
chosenSerial?: string
|
|
2324
|
+
chosenSerial?: string,
|
|
2325
|
+
/** A spend's key session and reason: the possession proof below is signed in
|
|
2326
|
+
* it, and spendVaultOutputs signs the inputs in the same session. A deposit
|
|
2327
|
+
* passes none (it signs no Vault input) and keeps its own ceremony. */
|
|
2328
|
+
shared?: { session: VaultSignerSession; reason: string }
|
|
2320
2329
|
): Promise<[vault: VaultOutputSpec, marker: VaultOutputSpec, descriptor: VaultOutputSpec]> {
|
|
2321
2330
|
// Every output-creating path (deposit, re-lock, partial-withdrawal
|
|
2322
2331
|
// remainder) comes through here. The key list may briefly hold one key more
|
|
@@ -2354,8 +2363,12 @@ async function newVaultOutput(
|
|
|
2354
2363
|
saltKeyId,
|
|
2355
2364
|
lockingScript: lockingScript.toHex()
|
|
2356
2365
|
},
|
|
2357
|
-
chosenSerial
|
|
2366
|
+
chosenSerial,
|
|
2367
|
+
shared
|
|
2358
2368
|
)
|
|
2369
|
+
// The shared session stays armed while the transaction is built: say so, and
|
|
2370
|
+
// restart its retention window. A no-op with nothing armed.
|
|
2371
|
+
if (shared) noteVaultProgress({ phase: 'preparing' })
|
|
2359
2372
|
const v7: VaultInstructionsV7 = {
|
|
2360
2373
|
v: 7,
|
|
2361
2374
|
type: 'R1C',
|
|
@@ -3249,7 +3262,11 @@ async function spendVaultOutputs(
|
|
|
3249
3262
|
reason: string,
|
|
3250
3263
|
plan: VaultSpendPlan,
|
|
3251
3264
|
opts?: VaultTransferOptions,
|
|
3252
|
-
scopeToken?: VaultScopeToken
|
|
3265
|
+
scopeToken?: VaultScopeToken,
|
|
3266
|
+
/** The operation's key session. When a new Vault output's possession proof
|
|
3267
|
+
* already armed the chosen key in it, the inputs are signed in that same
|
|
3268
|
+
* session: no second PIN entry or tap. */
|
|
3269
|
+
session?: VaultSignerSession
|
|
3253
3270
|
): Promise<VaultSpendResult> {
|
|
3254
3271
|
const { tx, reference, prepared } = await createSignableVaultTx(
|
|
3255
3272
|
w,
|
|
@@ -3271,7 +3288,9 @@ async function spendVaultOutputs(
|
|
|
3271
3288
|
const unlocks: { inputIndex: number; unlockingScript: UnlockingScript }[] = []
|
|
3272
3289
|
try {
|
|
3273
3290
|
// ── the tap(s): one on-card signature per input ────────────────────
|
|
3274
|
-
const signer =
|
|
3291
|
+
const signer = session
|
|
3292
|
+
? await session.acquire(reason, chosen.serial)
|
|
3293
|
+
: await requestVaultSigner(reason, chosen.serial)
|
|
3275
3294
|
assertVaultScope(scopeToken)
|
|
3276
3295
|
// The commitment check above ran against chosen.pubkey, but every unlock
|
|
3277
3296
|
// is built with signer.pubkey — they must be the same key, or the card
|
|
@@ -3516,6 +3535,9 @@ export async function withdrawFromVault(
|
|
|
3516
3535
|
const scopeToken = vaultStore.captureScopeToken()
|
|
3517
3536
|
return await withVaultMutation(async () => {
|
|
3518
3537
|
assertVaultScope(scopeToken)
|
|
3538
|
+
// One key session for the remainder's possession proof and the inputs.
|
|
3539
|
+
const session = openVaultSignerSession()
|
|
3540
|
+
try {
|
|
3519
3541
|
// Cheapest refusal first, as in depositToVault — see requireWithdrawalAmount.
|
|
3520
3542
|
requireWithdrawalAmount(amount)
|
|
3521
3543
|
// An offline user is never asked to present a key for a transfer that
|
|
@@ -3568,7 +3590,8 @@ export async function withdrawFromVault(
|
|
|
3568
3590
|
'Vault change',
|
|
3569
3591
|
sel.saltInventory,
|
|
3570
3592
|
scopeToken,
|
|
3571
|
-
chosenSerial
|
|
3593
|
+
chosenSerial,
|
|
3594
|
+
{ session, reason }
|
|
3572
3595
|
))
|
|
3573
3596
|
)
|
|
3574
3597
|
}
|
|
@@ -3584,10 +3607,15 @@ export async function withdrawFromVault(
|
|
|
3584
3607
|
description: 'Vault withdrawal'
|
|
3585
3608
|
},
|
|
3586
3609
|
opts,
|
|
3587
|
-
scopeToken
|
|
3610
|
+
scopeToken,
|
|
3611
|
+
session
|
|
3588
3612
|
)
|
|
3589
3613
|
if (remainderPlan?.changesKeySet) await commitPlannedKeySet(w, adminOriginator, scopeToken, remainderPlan)
|
|
3590
3614
|
return result
|
|
3615
|
+
} finally {
|
|
3616
|
+
// Also the way out when anything between the proof and the inputs throws.
|
|
3617
|
+
session.close()
|
|
3618
|
+
}
|
|
3591
3619
|
})
|
|
3592
3620
|
}
|
|
3593
3621
|
|
|
@@ -3660,6 +3688,9 @@ export async function relockVault(
|
|
|
3660
3688
|
const scopeToken = vaultStore.captureScopeToken()
|
|
3661
3689
|
return await withVaultMutation(async () => {
|
|
3662
3690
|
assertVaultScope(scopeToken)
|
|
3691
|
+
// One key session for the new lock's possession proof and the inputs.
|
|
3692
|
+
const session = openVaultSignerSession()
|
|
3693
|
+
try {
|
|
3663
3694
|
requireReleased(opts, scopeToken, 'Re-locking the vault')
|
|
3664
3695
|
await requireOnline(opts)
|
|
3665
3696
|
assertVaultScope(scopeToken)
|
|
@@ -3720,7 +3751,8 @@ export async function relockVault(
|
|
|
3720
3751
|
'Vault re-lock',
|
|
3721
3752
|
sel.saltInventory,
|
|
3722
3753
|
scopeToken,
|
|
3723
|
-
chosenSerial
|
|
3754
|
+
chosenSerial,
|
|
3755
|
+
{ session, reason }
|
|
3724
3756
|
),
|
|
3725
3757
|
labels: ['vault', 'vault-relock'],
|
|
3726
3758
|
inputDescription: 'Vault re-lock',
|
|
@@ -3730,7 +3762,8 @@ export async function relockVault(
|
|
|
3730
3762
|
description: 'Vault relock'
|
|
3731
3763
|
},
|
|
3732
3764
|
opts,
|
|
3733
|
-
scopeToken
|
|
3765
|
+
scopeToken,
|
|
3766
|
+
session
|
|
3734
3767
|
)
|
|
3735
3768
|
if (revokePubkey) {
|
|
3736
3769
|
// The tag covers pendingRemoval.state, so the 'broadcast' write must be
|
|
@@ -3748,6 +3781,10 @@ export async function relockVault(
|
|
|
3748
3781
|
}
|
|
3749
3782
|
if (plan.changesKeySet) await commitPlannedKeySet(w, adminOriginator, scopeToken, plan)
|
|
3750
3783
|
return result
|
|
3784
|
+
} finally {
|
|
3785
|
+
// Also the way out when anything between the proof and the inputs throws.
|
|
3786
|
+
session.close()
|
|
3787
|
+
}
|
|
3751
3788
|
})
|
|
3752
3789
|
}
|
|
3753
3790
|
|
|
@@ -4209,8 +4246,10 @@ async function isUnbroadcastPendingRemovalRelock(
|
|
|
4209
4246
|
/** Reconcile a durable pending removal. A bounded broadcast marker is inferred
|
|
4210
4247
|
* after a crash only from an authenticated matching re-lock action. The
|
|
4211
4248
|
* tombstone is cleared only when every Vault action is accepted by the network
|
|
4212
|
-
* (ACCEPTED_ACTION_STATUSES)
|
|
4213
|
-
*
|
|
4249
|
+
* (ACCEPTED_ACTION_STATUSES), is a failed deposit, or is a failed spend that
|
|
4250
|
+
* can no longer reach the network for this removal
|
|
4251
|
+
* (failedVaultSpendBlocksRemoval), a matching re-lock is accepted, and two
|
|
4252
|
+
* authenticated scans find no lock authorizing the key. */
|
|
4214
4253
|
export async function finalizeVaultKeyRemoval(w: VaultWallet, adminOriginator: string): Promise<boolean> {
|
|
4215
4254
|
const scopeToken = vaultStore.captureScopeToken()
|
|
4216
4255
|
return await withVaultMutation(async () => {
|
|
@@ -4284,7 +4323,12 @@ export async function finalizeVaultKeyRemoval(w: VaultWallet, adminOriginator: s
|
|
|
4284
4323
|
if (ACCEPTED_ACTION_STATUSES.has(action.status)) return
|
|
4285
4324
|
if (action.status === 'failed') {
|
|
4286
4325
|
const labels = new Set(action.labels ?? [])
|
|
4287
|
-
|
|
4326
|
+
// A failed deposit never blocks. A failed spend blocks only while it
|
|
4327
|
+
// may still reach the network for THIS removal: see failedVaultSpend.ts.
|
|
4328
|
+
if (
|
|
4329
|
+
!(labels.has('vault-deposit') && !labels.has('vault-withdraw') && !labels.has('vault-relock')) &&
|
|
4330
|
+
failedVaultSpendBlocksRemoval(action, pendingAtStart.startedAt)
|
|
4331
|
+
) {
|
|
4288
4332
|
actionStateBlocks = true
|
|
4289
4333
|
}
|
|
4290
4334
|
} else {
|
|
@@ -147,9 +147,18 @@ function nativeCrypto(): NativeCrypto {
|
|
|
147
147
|
return backend
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* quick-crypto hands back ArrayBuffers and wants Buffers in; Node wants Buffers too.
|
|
152
|
+
*
|
|
153
|
+
* The result is always a PLAIN Uint8Array. quick-crypto's getAuthTag (and all of
|
|
154
|
+
* Node's crypto) answers with a Buffer, which is a Uint8Array subclass. A sink
|
|
155
|
+
* such as expo-file-system's writeBytes finds the array kind from
|
|
156
|
+
* `constructor.name` and ends the app on a name it does not know ("Buffer").
|
|
157
|
+
* The view shares the same memory: nothing is copied.
|
|
158
|
+
*/
|
|
151
159
|
function toU8(x: ArrayBuffer | Uint8Array): Uint8Array {
|
|
152
|
-
|
|
160
|
+
if (!(x instanceof Uint8Array)) return new Uint8Array(x)
|
|
161
|
+
return x.constructor === Uint8Array ? x : new Uint8Array(x.buffer, x.byteOffset, x.byteLength)
|
|
153
162
|
}
|
|
154
163
|
function toBuf(x: Uint8Array): Uint8Array {
|
|
155
164
|
const B = (globalThis as { Buffer?: { from(b: ArrayBufferLike, o: number, l: number): Uint8Array } }).Buffer
|
package/core/theme/tokens.ts
CHANGED
|
@@ -55,20 +55,34 @@ export const radii = {
|
|
|
55
55
|
* rounded to 44 to sit on the 4pt grid). It is for a single focal figure on a
|
|
56
56
|
* screen that has one — an amount being handed to another person — and nothing
|
|
57
57
|
* else. Two `display` elements on one view means the view has no focal point.
|
|
58
|
+
*
|
|
59
|
+
* Every ramp names the family as well as the metrics. Without it each ramp is
|
|
60
|
+
* a size and a weight on whatever face the platform happens to default to, so
|
|
61
|
+
* a screen built from these tokens renders in San Francisco (or Roboto) while
|
|
62
|
+
* the host app around it renders in its own face -- and the seam shows on any
|
|
63
|
+
* screen that has both, which is most of them. The host's family is the one
|
|
64
|
+
* correct answer here, so it is set once, here, rather than overridden per
|
|
65
|
+
* component: a component that forgets to override is the bug this prevents.
|
|
66
|
+
*
|
|
67
|
+
* Nunito ships embedded at build time (app.config.js, expo-font plugin), with
|
|
68
|
+
* one static file per weight below -- 400/600/700 -- so there is no window
|
|
69
|
+
* during startup where this family is unregistered and no flash of a fallback
|
|
70
|
+
* face. A weight with no embedded file falls back to the nearest one, so keep
|
|
71
|
+
* these three in step with that plugin's list.
|
|
58
72
|
*/
|
|
59
73
|
export const typography = {
|
|
60
|
-
display: { fontSize: 44, fontWeight: '700' as const, lineHeight: 52, letterSpacing: -0.5 },
|
|
61
|
-
largeTitle: { fontSize: 34, fontWeight: '700' as const, lineHeight: 41 },
|
|
62
|
-
title1: { fontSize: 28, fontWeight: '700' as const, lineHeight: 34 },
|
|
63
|
-
title2: { fontSize: 22, fontWeight: '700' as const, lineHeight: 28 },
|
|
64
|
-
title3: { fontSize: 20, fontWeight: '600' as const, lineHeight: 25 },
|
|
65
|
-
headline: { fontSize: 17, fontWeight: '600' as const, lineHeight: 22 },
|
|
66
|
-
body: { fontSize: 17, fontWeight: '400' as const, lineHeight: 22 },
|
|
67
|
-
callout: { fontSize: 16, fontWeight: '400' as const, lineHeight: 21 },
|
|
68
|
-
subhead: { fontSize: 15, fontWeight: '400' as const, lineHeight: 20 },
|
|
69
|
-
footnote: { fontSize: 13, fontWeight: '400' as const, lineHeight: 18 },
|
|
70
|
-
caption1: { fontSize: 12, fontWeight: '400' as const, lineHeight: 16 },
|
|
71
|
-
caption2: { fontSize: 11, fontWeight: '400' as const, lineHeight: 13 }
|
|
74
|
+
display: { fontFamily: 'Nunito', fontSize: 44, fontWeight: '700' as const, lineHeight: 52, letterSpacing: -0.5 },
|
|
75
|
+
largeTitle: { fontFamily: 'Nunito', fontSize: 34, fontWeight: '700' as const, lineHeight: 41 },
|
|
76
|
+
title1: { fontFamily: 'Nunito', fontSize: 28, fontWeight: '700' as const, lineHeight: 34 },
|
|
77
|
+
title2: { fontFamily: 'Nunito', fontSize: 22, fontWeight: '700' as const, lineHeight: 28 },
|
|
78
|
+
title3: { fontFamily: 'Nunito', fontSize: 20, fontWeight: '600' as const, lineHeight: 25 },
|
|
79
|
+
headline: { fontFamily: 'Nunito', fontSize: 17, fontWeight: '600' as const, lineHeight: 22 },
|
|
80
|
+
body: { fontFamily: 'Nunito', fontSize: 17, fontWeight: '400' as const, lineHeight: 22 },
|
|
81
|
+
callout: { fontFamily: 'Nunito', fontSize: 16, fontWeight: '400' as const, lineHeight: 21 },
|
|
82
|
+
subhead: { fontFamily: 'Nunito', fontSize: 15, fontWeight: '400' as const, lineHeight: 20 },
|
|
83
|
+
footnote: { fontFamily: 'Nunito', fontSize: 13, fontWeight: '400' as const, lineHeight: 18 },
|
|
84
|
+
caption1: { fontFamily: 'Nunito', fontSize: 12, fontWeight: '400' as const, lineHeight: 16 },
|
|
85
|
+
caption2: { fontFamily: 'Nunito', fontSize: 11, fontWeight: '400' as const, lineHeight: 13 }
|
|
72
86
|
} as const
|
|
73
87
|
|
|
74
88
|
/* --------------------------------- Colors -------------------------------- */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bsv/expo-wallet-toolbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Wallet screens and P2P local-payment backend for Expo/React Native apps, extracted from BSV Wallet.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"expo-sqlite": "~57.0.3",
|
|
76
76
|
"expo-status-bar": "~57.0.1",
|
|
77
77
|
"i18next": "^25.2.1",
|
|
78
|
+
"lucide-react-native": "^1.27.0",
|
|
78
79
|
"mobx": "^6.13.7",
|
|
79
80
|
"mobx-react-lite": "^4.1.0",
|
|
80
81
|
"qrcode": "^1.5.4",
|
|
@@ -26,21 +26,18 @@ function loadExpoCamera(): ExpoCameraModule {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
29
|
+
* lucide, like every other glyph this app draws.
|
|
30
|
+
*
|
|
31
|
+
* Imported at module scope rather than behind a lazy loader. What had to be
|
|
32
|
+
* deferred is @expo/vector-icons' index barrel, which re-exports every icon
|
|
33
|
+
* set and so reaches expo-font -> expo-asset as untransformed ESM; nothing
|
|
34
|
+
* here pulls that barrel in any more. lucide publishes both module formats
|
|
35
|
+
* and Jest resolves the ESM one, so the app pins this name to lucide's CJS
|
|
36
|
+
* entry in jest.moduleNameMapper (package.json), as it already does for its
|
|
37
|
+
* other ESM-only dependencies.
|
|
34
38
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function loadIonicons(): IoniconsComponent {
|
|
38
|
-
if (!ioniconsComponent) {
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
40
|
-
ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
|
|
41
|
-
}
|
|
42
|
-
return ioniconsComponent
|
|
43
|
-
}
|
|
39
|
+
import { Camera, X } from 'lucide-react-native'
|
|
40
|
+
import { BalancedText } from './ui/BalancedText'
|
|
44
41
|
|
|
45
42
|
/* -------------------------------------------------------------------------- */
|
|
46
43
|
/* Types */
|
|
@@ -97,7 +94,6 @@ export default function QRScanner({
|
|
|
97
94
|
}: QRScannerProps) {
|
|
98
95
|
const { t } = useTranslation()
|
|
99
96
|
const { colors } = useTheme()
|
|
100
|
-
const Ionicons = loadIonicons()
|
|
101
97
|
const { CameraView, useCameraPermissions } = loadExpoCamera()
|
|
102
98
|
const [permission, requestPermission] = useCameraPermissions()
|
|
103
99
|
|
|
@@ -144,10 +140,10 @@ export default function QRScanner({
|
|
|
144
140
|
return (
|
|
145
141
|
<View style={styles.permScreen}>
|
|
146
142
|
<View style={styles.permIconWrap}>
|
|
147
|
-
<
|
|
143
|
+
<Camera size={40} color="#fff" />
|
|
148
144
|
</View>
|
|
149
145
|
<Text style={styles.permTitle}>{t('scan_shares_camera_needed')}</Text>
|
|
150
|
-
<
|
|
146
|
+
<BalancedText style={styles.permBody}>{t('camera_denied_description')}</BalancedText>
|
|
151
147
|
<TouchableOpacity style={styles.permBtn} onPress={() => Linking.openSettings()}>
|
|
152
148
|
<Text style={styles.permBtnText}>{t('open_settings')}</Text>
|
|
153
149
|
</TouchableOpacity>
|
|
@@ -163,10 +159,10 @@ export default function QRScanner({
|
|
|
163
159
|
return (
|
|
164
160
|
<View style={styles.permScreen}>
|
|
165
161
|
<View style={styles.permIconWrap}>
|
|
166
|
-
<
|
|
162
|
+
<Camera size={40} color="#fff" />
|
|
167
163
|
</View>
|
|
168
164
|
<Text style={styles.permTitle}>{t('scan_shares_camera_needed')}</Text>
|
|
169
|
-
<
|
|
165
|
+
<BalancedText style={styles.permBody}>{t('scan_shares_camera_description')}</BalancedText>
|
|
170
166
|
<TouchableOpacity style={styles.permBtn} onPress={requestPermission}>
|
|
171
167
|
<Text style={styles.permBtnText}>{t('continue_action')}</Text>
|
|
172
168
|
</TouchableOpacity>
|
|
@@ -188,8 +184,14 @@ export default function QRScanner({
|
|
|
188
184
|
<View style={styles.overlay}>
|
|
189
185
|
{/* Top bar */}
|
|
190
186
|
<View style={styles.overlayTop}>
|
|
191
|
-
<TouchableOpacity
|
|
192
|
-
|
|
187
|
+
<TouchableOpacity
|
|
188
|
+
style={styles.closeButton}
|
|
189
|
+
onPress={onClose}
|
|
190
|
+
accessibilityRole="button"
|
|
191
|
+
accessibilityLabel="Close"
|
|
192
|
+
testID="scanner-close"
|
|
193
|
+
>
|
|
194
|
+
<X size={26} color="#fff" />
|
|
193
195
|
</TouchableOpacity>
|
|
194
196
|
</View>
|
|
195
197
|
|
|
@@ -207,7 +209,7 @@ export default function QRScanner({
|
|
|
207
209
|
|
|
208
210
|
{/* Bottom info */}
|
|
209
211
|
<View style={styles.overlayBottom}>
|
|
210
|
-
<
|
|
212
|
+
<BalancedText style={styles.hintText}>{hintText ?? t('scan_qr_default_hint')}</BalancedText>
|
|
211
213
|
{renderBottom?.()}
|
|
212
214
|
</View>
|
|
213
215
|
</View>
|
|
@@ -26,21 +26,16 @@ import { defaultMessageBoxUrlFor, resolveMessageBoxUrl } from '../../../core/pay
|
|
|
26
26
|
import type { AppChain } from '../../../core/networks'
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
29
|
+
* lucide, like every other glyph this app draws. Imported at module scope
|
|
30
|
+
* rather than behind a lazy loader: what had to be deferred is
|
|
31
|
+
* @expo/vector-icons' index barrel, which re-exports every icon set and so
|
|
32
|
+
* reaches expo-font -> expo-asset as untransformed ESM; nothing here pulls
|
|
33
|
+
* that barrel in any more. lucide publishes both module formats and Jest
|
|
34
|
+
* resolves the ESM one, so the app pins this name to lucide's CJS entry in
|
|
35
|
+
* jest.moduleNameMapper (package.json), as it already does for its other
|
|
36
|
+
* ESM-only dependencies.
|
|
34
37
|
*/
|
|
35
|
-
|
|
36
|
-
let ioniconsComponent: IoniconsComponent | undefined
|
|
37
|
-
function loadIonicons(): IoniconsComponent {
|
|
38
|
-
if (!ioniconsComponent) {
|
|
39
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
40
|
-
ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
|
|
41
|
-
}
|
|
42
|
-
return ioniconsComponent
|
|
43
|
-
}
|
|
38
|
+
import { RefreshCw } from 'lucide-react-native'
|
|
44
39
|
|
|
45
40
|
export function useMessageBoxConfig(
|
|
46
41
|
t: ReturnType<typeof import('react-i18next').useTranslation>['t'],
|
|
@@ -175,7 +170,6 @@ export function ConfigPanel({
|
|
|
175
170
|
onReset,
|
|
176
171
|
onNone
|
|
177
172
|
}: ConfigPanelProps) {
|
|
178
|
-
const Ionicons = loadIonicons()
|
|
179
173
|
const hasUrl = !!urlInput.trim()
|
|
180
174
|
const isNonDefault = urlInput.trim() !== defaultUrl && urlInput !== NO_MESSAGE_BOX
|
|
181
175
|
return (
|
|
@@ -220,7 +214,7 @@ export function ConfigPanel({
|
|
|
220
214
|
<View style={styles.configSecondaryActions}>
|
|
221
215
|
{isNonDefault && (
|
|
222
216
|
<TouchableOpacity onPress={onReset} style={[styles.configResetPill, { borderColor: colors.textSecondary }]}>
|
|
223
|
-
<
|
|
217
|
+
<RefreshCw size={12} color={colors.textSecondary} />
|
|
224
218
|
<Text style={[styles.configResetText, { color: colors.textSecondary }]}>Default</Text>
|
|
225
219
|
</TouchableOpacity>
|
|
226
220
|
)}
|
|
@@ -13,26 +13,17 @@ import React from 'react'
|
|
|
13
13
|
import { Modal, Platform, Pressable, StyleSheet, Text, View } from 'react-native'
|
|
14
14
|
import { useTheme, spacing, radii, typography, i18n } from '@bsv/expo-wallet-toolbox'
|
|
15
15
|
import PressableScale from '../ui/PressableScale'
|
|
16
|
+
import { Wifi } from 'lucide-react-native'
|
|
17
|
+
import { BalancedText } from '../ui/BalancedText'
|
|
16
18
|
|
|
17
19
|
const t = (k: string, o?: Record<string, unknown>) => i18n.t(k, o) as string
|
|
18
20
|
|
|
19
|
-
type IoniconsComponent = typeof import('@expo/vector-icons').Ionicons
|
|
20
|
-
let ioniconsComponent: IoniconsComponent | undefined
|
|
21
|
-
function loadIonicons(): IoniconsComponent {
|
|
22
|
-
if (!ioniconsComponent) {
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
24
|
-
ioniconsComponent = require('@expo/vector-icons').Ionicons as IoniconsComponent
|
|
25
|
-
}
|
|
26
|
-
return ioniconsComponent
|
|
27
|
-
}
|
|
28
|
-
|
|
29
21
|
export const NearbyAdvisoryModal: React.FC<{
|
|
30
22
|
visible: boolean
|
|
31
23
|
onCancel: () => void
|
|
32
24
|
onContinue: () => void
|
|
33
25
|
}> = ({ visible, onCancel, onContinue }) => {
|
|
34
26
|
const { colors } = useTheme()
|
|
35
|
-
const Ionicons = loadIonicons()
|
|
36
27
|
|
|
37
28
|
if (!visible) return null
|
|
38
29
|
|
|
@@ -56,10 +47,12 @@ export const NearbyAdvisoryModal: React.FC<{
|
|
|
56
47
|
/>
|
|
57
48
|
<View style={[styles.card, { backgroundColor: colors.sheetBackground, borderColor: colors.separator }]}>
|
|
58
49
|
<View style={[styles.heroIcon, { backgroundColor: colors.fillTertiary }]}>
|
|
59
|
-
<
|
|
50
|
+
<Wifi size={26} color={colors.accent} />
|
|
60
51
|
</View>
|
|
61
52
|
<Text style={[styles.title, { color: colors.textPrimary }]}>{t('nearby_advisory_title')}</Text>
|
|
62
|
-
<
|
|
53
|
+
<BalancedText style={[styles.body, { color: colors.textSecondary }]}>
|
|
54
|
+
{t('nearby_advisory_body')}
|
|
55
|
+
</BalancedText>
|
|
63
56
|
|
|
64
57
|
<PressableScale
|
|
65
58
|
haptic="confirm"
|