@bsv/expo-wallet-toolbox 0.15.1 → 0.16.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 +174 -0
- package/core/backup/appData.ts +5 -1
- package/core/backup/codec.ts +9 -3
- package/core/backup/contactsBackup.ts +145 -0
- package/core/backup/push.ts +14 -0
- package/core/backup/restoreOnImport.ts +15 -0
- package/core/contacts/contactsStore.ts +47 -3
- package/core/context/LocalStorageProvider.tsx +3 -1
- package/core/context/WalletContext.tsx +5 -2
- package/core/context/startupPrewarm.ts +54 -0
- package/core/hooks/useConfirmationSound.ts +7 -0
- package/core/identity/handleRegistry/client.ts +2 -1
- package/core/identity/handleRegistry/profileKeys.ts +16 -0
- package/core/identity/handleRegistry/resolver.ts +2 -1
- package/core/identity/handleRegistry/rules.ts +7 -3
- package/core/index.ts +2 -1
- package/core/localpay/build.ts +4 -3
- package/core/localpay/session.ts +6 -0
- package/core/localpay/transport/select.ts +64 -3
- package/core/localpay/verify.ts +2 -1
- package/core/mandala/permissionModule.ts +19 -3
- package/core/net/trimTrailingSlashes.ts +13 -0
- package/core/parsePeerPayURI.ts +25 -2
- package/core/pay/creditInbox.ts +31 -1
- package/core/pay/rails/address.ts +3 -2
- package/core/pay/rails/handle.ts +8 -2
- package/core/pay/rails/index.ts +6 -4
- package/core/pos/protocol.ts +172 -0
- package/core/profiles/removalProblems.ts +41 -0
- package/core/push/registration.ts +2 -1
- package/core/services/revokeConnection.ts +98 -0
- package/core/storage/schema/createTables.ts +24 -0
- package/core/toolboxConfig.ts +22 -4
- package/package.json +2 -2
- package/ui/components/pay/MessageBoxConfig.tsx +2 -1
- package/ui/components/pay/NearbyFlow.tsx +410 -7
- package/ui/exportTransactions.ts +26 -13
- package/ui/index.ts +2 -2
- package/ui/screens/ConnectionsScreen.tsx +8 -63
- package/ui/screens/ProfileScreen.tsx +2 -40
- package/ui/screens/WalletConfigScreen.tsx +57 -51
|
@@ -44,7 +44,7 @@ import { makeIdentityClient, resolveIdentity } from '../resolveIdentity'
|
|
|
44
44
|
import { getHandleRegistryConfig } from '../../core/toolboxConfig'
|
|
45
45
|
import { bindOriginator } from '../../core/mandala/createRuntime'
|
|
46
46
|
import { profileLabel } from '../../core/profiles/profileLabel'
|
|
47
|
-
import type
|
|
47
|
+
import { removalProblemKeys, type RemovalProblem } from '../../core/profiles/removalProblems'
|
|
48
48
|
import type { ProfileRemovalCheck, RemoveProfileResult } from '../../core/profiles/removeProfile'
|
|
49
49
|
import {
|
|
50
50
|
MAX_PROFILE_NAME_LENGTH,
|
|
@@ -53,6 +53,7 @@ import {
|
|
|
53
53
|
} from '../../core/profiles/profileStore'
|
|
54
54
|
import { isValidHandleFormat, parsePaymail } from '../../core/identity/handleRegistry/rules'
|
|
55
55
|
import type { ProfileSigner } from '../../core/identity/handleRegistry/profileCert'
|
|
56
|
+
import { DISPLAY_NAME_KV_KEY, HANDLE_KV_KEY } from '../../core/identity/handleRegistry/profileKeys'
|
|
56
57
|
import { createHandleRegistryClient, type AvailabilityReason } from '../../core/identity/handleRegistry/client'
|
|
57
58
|
import {
|
|
58
59
|
changeHandle,
|
|
@@ -86,29 +87,9 @@ function loadExpoRouter(): ExpoRouterModule {
|
|
|
86
87
|
return expoRouterMod
|
|
87
88
|
}
|
|
88
89
|
|
|
89
|
-
/** The full `handle@domain`, cached for a cold start. The registry decides. */
|
|
90
|
-
const HANDLE_KV_KEY = 'profile_registered_handle'
|
|
91
|
-
/**
|
|
92
|
-
* The display name lives here on this device, and — once a handle is
|
|
93
|
-
* registered — as a PUBLIC plaintext field of the profile certificate
|
|
94
|
-
* (2026-09-18 ruling). The identity overlay's `name` is only a fallback for a
|
|
95
|
-
* wallet that has never set one.
|
|
96
|
-
*/
|
|
97
|
-
const DISPLAY_NAME_KV_KEY = 'profile_display_name'
|
|
98
90
|
const HANDLE_CHECK_DEBOUNCE_MS = 400
|
|
99
91
|
|
|
100
|
-
/** What can stand in the way of removing a profile, grouped the way the user is told about it. */
|
|
101
|
-
const FUNDS_BLOCKERS: RemovalBlocker[] = ['spendable-outputs', 'token-balance']
|
|
102
|
-
const PENDING_BLOCKERS: RemovalBlocker[] = [
|
|
103
|
-
'pending-transactions',
|
|
104
|
-
'offline-queue',
|
|
105
|
-
'token-settlements',
|
|
106
|
-
'localpay-pending',
|
|
107
|
-
'peerpay-outbox',
|
|
108
|
-
'inbox-pending'
|
|
109
|
-
]
|
|
110
92
|
|
|
111
|
-
type RemovalProblem = Exclude<ProfileRemovalCheck, { kind: 'ok' }> | Exclude<RemoveProfileResult, { kind: 'removed' }>
|
|
112
93
|
|
|
113
94
|
/**
|
|
114
95
|
* How long the switch cover takes to leave. A removal runs under it (a Modal on
|
|
@@ -121,25 +102,6 @@ type RemovalProblem = Exclude<ProfileRemovalCheck, { kind: 'ok' }> | Exclude<Rem
|
|
|
121
102
|
export const PROFILE_COVER_FADE_MS = 500
|
|
122
103
|
const untilCoverGone = () => new Promise<void>(resolve => setTimeout(resolve, PROFILE_COVER_FADE_MS))
|
|
123
104
|
|
|
124
|
-
/** The i18n keys that explain a refusal or failure, one paragraph per kind of reason. */
|
|
125
|
-
function removalProblemKeys(problem: RemovalProblem): string[] {
|
|
126
|
-
if (problem.kind === 'refused')
|
|
127
|
-
return [problem.reason === 'offline' ? 'profile_remove_offline' : 'profile_remove_failed']
|
|
128
|
-
if (problem.kind === 'handle-failed') return ['profile_remove_failed_handle']
|
|
129
|
-
if (problem.kind === 'blocked') {
|
|
130
|
-
const keys: string[] = []
|
|
131
|
-
const has = (group: RemovalBlocker[]) => problem.reasons.some(r => group.includes(r))
|
|
132
|
-
if (has(FUNDS_BLOCKERS)) keys.push('profile_remove_blocked_funds')
|
|
133
|
-
if (has(PENDING_BLOCKERS)) keys.push('profile_remove_blocked_pending')
|
|
134
|
-
// Funds or pending activity in the databases of its other networks, which the open one never shows.
|
|
135
|
-
if (problem.reasons.includes('other-network')) keys.push('profile_remove_blocked_network')
|
|
136
|
-
// An unfinished handle write is the same thing to the user as a handle that would not release.
|
|
137
|
-
if (problem.reasons.includes('handle-journal')) keys.push('profile_remove_failed_handle')
|
|
138
|
-
if (problem.reasons.includes('check-failed')) keys.push('profile_remove_blocked_check')
|
|
139
|
-
if (keys.length > 0) return keys
|
|
140
|
-
}
|
|
141
|
-
return ['profile_remove_failed']
|
|
142
|
-
}
|
|
143
105
|
|
|
144
106
|
export function ProfileScreen() {
|
|
145
107
|
const { t } = useTranslation()
|
|
@@ -132,7 +132,11 @@ const NEXT_MOCK_KEY: Record<MockPresentKey, MockPresentKey> = {
|
|
|
132
132
|
'MOCK-DEV-3': 'MOCK-DEV-1'
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
/**
|
|
136
|
+
* `hideLogout`: for an app that forgets wallets its own way (and shows this
|
|
137
|
+
* screen only as developer tools), the Log Out row is left out.
|
|
138
|
+
*/
|
|
139
|
+
export function WalletConfigScreen({ hideLogout = false }: { hideLogout?: boolean } = {}) {
|
|
136
140
|
const versionLabel = useMemo(() => appVersionLabel(), [])
|
|
137
141
|
const { t } = useTranslation()
|
|
138
142
|
const { colors } = useTheme()
|
|
@@ -1004,57 +1008,59 @@ export function WalletConfigScreen() {
|
|
|
1004
1008
|
)}
|
|
1005
1009
|
|
|
1006
1010
|
{/* ── Account ── */}
|
|
1007
|
-
|
|
1008
|
-
<
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
if (choice !== 'delete') return
|
|
1023
|
-
setLoggingOut(true)
|
|
1024
|
-
// No artificial yield before this call, unlike the wallet-creation
|
|
1025
|
-
// spinner: logout()'s synchronous prefix (which stops the
|
|
1026
|
-
// background monitor's task loop) still runs before its first
|
|
1027
|
-
// await, exactly as before — a gap here let the monitor's own
|
|
1028
|
-
// pending tick sneak in a fresh task run against storage that
|
|
1029
|
-
// was about to be torn down (WERR_UNKNOWN "Database not
|
|
1030
|
-
// initialized" from a task caught mid-flight). Awaiting the
|
|
1031
|
-
// result below only affects what happens AFTER that teardown.
|
|
1032
|
-
//
|
|
1033
|
-
// XR-107: logout() now resolves to whether the secrets layer
|
|
1034
|
-
// verified every legacy plaintext item erased. A persistent
|
|
1035
|
-
// SecureStore delete failure must be reported, not silently
|
|
1036
|
-
// treated as a completed "Delete Wallet" — the user needs to
|
|
1037
|
-
// know and be able to retry, rather than being navigated away
|
|
1038
|
-
// as though nothing were left behind.
|
|
1039
|
-
const erased = await logout()
|
|
1040
|
-
if (!erased) {
|
|
1041
|
-
setLoggingOut(false)
|
|
1042
|
-
await showAlert({
|
|
1043
|
-
title: t('delete_wallet_failed_title'),
|
|
1044
|
-
message: t('delete_wallet_failed_body'),
|
|
1045
|
-
buttons: [{ text: t('vault_ok'), key: 'ok' }],
|
|
1011
|
+
{!hideLogout && (
|
|
1012
|
+
<GroupedSection>
|
|
1013
|
+
<ListRow
|
|
1014
|
+
label={t('log_out')}
|
|
1015
|
+
icon="log-out-outline"
|
|
1016
|
+
iconColor={colors.error}
|
|
1017
|
+
onPress={async () => {
|
|
1018
|
+
if (loggingOut) return
|
|
1019
|
+
const choice = await showAlert({
|
|
1020
|
+
title: t('delete_wallet_warning_title'),
|
|
1021
|
+
message: t('delete_wallet_warning_body'),
|
|
1022
|
+
buttons: [
|
|
1023
|
+
{ text: t('cancel'), style: 'cancel', key: 'cancel' },
|
|
1024
|
+
{ text: t('delete_wallet_confirm'), style: 'destructive', key: 'delete' },
|
|
1025
|
+
],
|
|
1046
1026
|
})
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1027
|
+
if (choice !== 'delete') return
|
|
1028
|
+
setLoggingOut(true)
|
|
1029
|
+
// No artificial yield before this call, unlike the wallet-creation
|
|
1030
|
+
// spinner: logout()'s synchronous prefix (which stops the
|
|
1031
|
+
// background monitor's task loop) still runs before its first
|
|
1032
|
+
// await, exactly as before — a gap here let the monitor's own
|
|
1033
|
+
// pending tick sneak in a fresh task run against storage that
|
|
1034
|
+
// was about to be torn down (WERR_UNKNOWN "Database not
|
|
1035
|
+
// initialized" from a task caught mid-flight). Awaiting the
|
|
1036
|
+
// result below only affects what happens AFTER that teardown.
|
|
1037
|
+
//
|
|
1038
|
+
// XR-107: logout() now resolves to whether the secrets layer
|
|
1039
|
+
// verified every legacy plaintext item erased. A persistent
|
|
1040
|
+
// SecureStore delete failure must be reported, not silently
|
|
1041
|
+
// treated as a completed "Delete Wallet" — the user needs to
|
|
1042
|
+
// know and be able to retry, rather than being navigated away
|
|
1043
|
+
// as though nothing were left behind.
|
|
1044
|
+
const erased = await logout()
|
|
1045
|
+
if (!erased) {
|
|
1046
|
+
setLoggingOut(false)
|
|
1047
|
+
await showAlert({
|
|
1048
|
+
title: t('delete_wallet_failed_title'),
|
|
1049
|
+
message: t('delete_wallet_failed_body'),
|
|
1050
|
+
buttons: [{ text: t('vault_ok'), key: 'ok' }],
|
|
1051
|
+
})
|
|
1052
|
+
}
|
|
1053
|
+
// On success logout() has already navigated away — the screen
|
|
1054
|
+
// that owns `loggingOut` is gone, so there is nothing left to
|
|
1055
|
+
// reset here.
|
|
1056
|
+
}}
|
|
1057
|
+
destructive
|
|
1058
|
+
showChevron={false}
|
|
1059
|
+
trailing={loggingOut ? <ActivityIndicator size="small" color={colors.error} /> : undefined}
|
|
1060
|
+
isLast
|
|
1061
|
+
/>
|
|
1062
|
+
</GroupedSection>
|
|
1063
|
+
)}
|
|
1058
1064
|
|
|
1059
1065
|
{/* The number we ask people to quote when something goes wrong, so it is
|
|
1060
1066
|
always to hand without being something to read. Quiet on purpose:
|