accounts 0.5.7 → 0.5.9
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 +13 -0
- package/dist/core/Dialog.d.ts.map +1 -1
- package/dist/core/Dialog.js +21 -1
- package/dist/core/Dialog.js.map +1 -1
- package/dist/core/Provider.js +1 -1
- package/dist/core/Provider.js.map +1 -1
- package/dist/react-native/Provider.d.ts +12 -0
- package/dist/react-native/Provider.d.ts.map +1 -0
- package/dist/react-native/Provider.js +16 -0
- package/dist/react-native/Provider.js.map +1 -0
- package/dist/react-native/adapter.d.ts +29 -0
- package/dist/react-native/adapter.d.ts.map +1 -0
- package/dist/react-native/adapter.js +314 -0
- package/dist/react-native/adapter.js.map +1 -0
- package/dist/react-native/index.d.ts +4 -0
- package/dist/react-native/index.d.ts.map +1 -0
- package/dist/react-native/index.js +4 -0
- package/dist/react-native/index.js.map +1 -0
- package/dist/react-native/storage.d.ts +12 -0
- package/dist/react-native/storage.d.ts.map +1 -0
- package/dist/react-native/storage.js +53 -0
- package/dist/react-native/storage.js.map +1 -0
- package/package.json +20 -1
- package/src/core/Dialog.ts +26 -1
- package/src/core/Provider.ts +1 -1
- package/src/react-native/Provider.ts +28 -0
- package/src/react-native/adapter.ts +441 -0
- package/src/react-native/index.ts +3 -0
- package/src/react-native/storage.ts +65 -0
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { Address as core_Address, Base64, Hex, P256, Provider as core_Provider, PublicKey, RpcResponse, } from 'ox';
|
|
2
|
+
import { KeyAuthorization } from 'ox/tempo';
|
|
3
|
+
import { prepareTransactionRequest } from 'viem/actions';
|
|
4
|
+
import { Account as TempoAccount, Secp256k1 } from 'viem/tempo';
|
|
5
|
+
import * as AccessKey from '../core/AccessKey.js';
|
|
6
|
+
import * as Adapter from '../core/Adapter.js';
|
|
7
|
+
/**
|
|
8
|
+
* Creates a React Native adapter that authorizes access keys via the system browser.
|
|
9
|
+
*
|
|
10
|
+
* Authentication opens a browser session and completes via a redirect callback
|
|
11
|
+
* that returns the signed key authorization.
|
|
12
|
+
*/
|
|
13
|
+
export function reactNative(options) {
|
|
14
|
+
const { name = 'Tempo Mobile', rdns = 'xyz.tempo.mobile' } = options;
|
|
15
|
+
return Adapter.define({ name, rdns }, ({ getAccount, getClient, store }) => {
|
|
16
|
+
async function loadManagedKey(address, parameters = {}) {
|
|
17
|
+
const { keyType } = parameters;
|
|
18
|
+
const { secureStorage } = options;
|
|
19
|
+
if (!secureStorage)
|
|
20
|
+
return undefined;
|
|
21
|
+
const { chainId } = store.getState();
|
|
22
|
+
const storageKey = managedKeyStorageKey(address, chainId, keyType);
|
|
23
|
+
const entry = await secureStorage.getItem(storageKey);
|
|
24
|
+
if (!entry)
|
|
25
|
+
return undefined;
|
|
26
|
+
const deserialized = KeyAuthorization.deserialize(entry.keyAuthorization);
|
|
27
|
+
if (!deserialized.signature)
|
|
28
|
+
throw new Error('Managed access key is missing a signature.');
|
|
29
|
+
const keyAuthorization = deserialized;
|
|
30
|
+
AccessKey.save({
|
|
31
|
+
address,
|
|
32
|
+
keyAuthorization,
|
|
33
|
+
privateKey: entry.key,
|
|
34
|
+
store,
|
|
35
|
+
});
|
|
36
|
+
return entry;
|
|
37
|
+
}
|
|
38
|
+
async function resolveManagedKey(resolveOptions = {}) {
|
|
39
|
+
const { address, keyType } = resolveOptions;
|
|
40
|
+
const requestedKeyType = keyType === 'p256' || keyType === 'secp256k1' ? keyType : undefined;
|
|
41
|
+
const entry = address
|
|
42
|
+
? await loadManagedKey(address, requestedKeyType ? { keyType: requestedKeyType } : {})
|
|
43
|
+
: undefined;
|
|
44
|
+
if (entry) {
|
|
45
|
+
const account = entry.keyType === 'p256'
|
|
46
|
+
? TempoAccount.fromP256(entry.key, { access: address })
|
|
47
|
+
: TempoAccount.fromSecp256k1(entry.key, { access: address });
|
|
48
|
+
return {
|
|
49
|
+
account,
|
|
50
|
+
key: entry.key,
|
|
51
|
+
keyAddress: entry.keyAddress,
|
|
52
|
+
keyType: entry.keyType,
|
|
53
|
+
publicKey: account.publicKey,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
const nextKeyType = requestedKeyType === 'p256' ? 'p256' : 'secp256k1';
|
|
57
|
+
const key = nextKeyType === 'p256' ? P256.randomPrivateKey() : Secp256k1.randomPrivateKey();
|
|
58
|
+
const account = nextKeyType === 'p256'
|
|
59
|
+
? TempoAccount.fromP256(key, address ? { access: address } : undefined)
|
|
60
|
+
: TempoAccount.fromSecp256k1(key, address ? { access: address } : undefined);
|
|
61
|
+
return {
|
|
62
|
+
account,
|
|
63
|
+
key,
|
|
64
|
+
keyAddress: core_Address.fromPublicKey(PublicKey.from(account.publicKey)),
|
|
65
|
+
keyType: nextKeyType,
|
|
66
|
+
publicKey: account.publicKey,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
async function saveManagedKey(address, managedKey, keyAuthorization) {
|
|
70
|
+
if (!managedKey)
|
|
71
|
+
return;
|
|
72
|
+
AccessKey.save({
|
|
73
|
+
address,
|
|
74
|
+
keyAuthorization,
|
|
75
|
+
privateKey: managedKey.key,
|
|
76
|
+
store,
|
|
77
|
+
});
|
|
78
|
+
const { secureStorage } = options;
|
|
79
|
+
if (!secureStorage)
|
|
80
|
+
return;
|
|
81
|
+
const { chainId } = store.getState();
|
|
82
|
+
const storageKey = managedKeyStorageKey(address, chainId, managedKey.keyType);
|
|
83
|
+
const entry = {
|
|
84
|
+
chainId,
|
|
85
|
+
expiry: keyAuthorization.expiry ?? 0,
|
|
86
|
+
key: managedKey.key,
|
|
87
|
+
keyAddress: managedKey.keyAddress,
|
|
88
|
+
keyAuthorization: KeyAuthorization.serialize(keyAuthorization),
|
|
89
|
+
keyType: managedKey.keyType,
|
|
90
|
+
walletAddress: address,
|
|
91
|
+
};
|
|
92
|
+
await secureStorage.setItem(storageKey, entry);
|
|
93
|
+
}
|
|
94
|
+
async function withManagedAccessKey(fn) {
|
|
95
|
+
const rootAddress = store.getState().accounts[store.getState().activeAccount]?.address;
|
|
96
|
+
if (rootAddress)
|
|
97
|
+
await loadManagedKey(rootAddress);
|
|
98
|
+
const account = getAccount({ signable: true });
|
|
99
|
+
const keyAuthorization = AccessKey.getPending(account, { store });
|
|
100
|
+
try {
|
|
101
|
+
const result = await fn(account, keyAuthorization ?? undefined);
|
|
102
|
+
AccessKey.removePending(account, { store });
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
AccessKey.remove(account, { store });
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async function authorize(request) {
|
|
111
|
+
const { host, redirectUri, open = defaultOpen } = options;
|
|
112
|
+
const { account, authorizeAccessKey, method } = request;
|
|
113
|
+
const managedKey = authorizeAccessKey && !authorizeAccessKey.publicKey && !authorizeAccessKey.address
|
|
114
|
+
? await resolveManagedKey({
|
|
115
|
+
...(account ? { address: account } : {}),
|
|
116
|
+
...(authorizeAccessKey.keyType ? { keyType: authorizeAccessKey.keyType } : {}),
|
|
117
|
+
})
|
|
118
|
+
: undefined;
|
|
119
|
+
const publicKey = authorizeAccessKey?.publicKey ?? managedKey?.publicKey;
|
|
120
|
+
const keyType = authorizeAccessKey?.keyType ?? managedKey?.keyType;
|
|
121
|
+
if (!publicKey)
|
|
122
|
+
throw new RpcResponse.InvalidParamsError({
|
|
123
|
+
message: method === 'wallet_connect'
|
|
124
|
+
? '`wallet_connect` on the React Native adapter requires `capabilities.authorizeAccessKey`.'
|
|
125
|
+
: '`wallet_authorizeAccessKey` on the React Native adapter requires key parameters.',
|
|
126
|
+
});
|
|
127
|
+
const state = Base64.fromBytes(Hex.toBytes(Hex.random(16)), { pad: false, url: true });
|
|
128
|
+
const authUrl = buildAuthUrl(host, {
|
|
129
|
+
callback: redirectUri,
|
|
130
|
+
chainId: store.getState().chainId,
|
|
131
|
+
...(typeof authorizeAccessKey?.expiry !== 'undefined'
|
|
132
|
+
? { expiry: authorizeAccessKey.expiry }
|
|
133
|
+
: {}),
|
|
134
|
+
...(keyType ? { keyType } : {}),
|
|
135
|
+
...(authorizeAccessKey?.limits
|
|
136
|
+
? { limits: authorizeAccessKey.limits.map((l) => ({ ...l, limit: String(l.limit) })) }
|
|
137
|
+
: {}),
|
|
138
|
+
pubKey: publicKey,
|
|
139
|
+
state,
|
|
140
|
+
});
|
|
141
|
+
const callbackUrl = await open(authUrl, redirectUri);
|
|
142
|
+
if (!callbackUrl)
|
|
143
|
+
throw new AuthCancelledError();
|
|
144
|
+
const params = new URL(callbackUrl).searchParams;
|
|
145
|
+
const returnedState = params.get('state');
|
|
146
|
+
if (returnedState !== state)
|
|
147
|
+
throw new StateMismatchError();
|
|
148
|
+
const accountAddress = params.get('accountAddress');
|
|
149
|
+
if (!accountAddress)
|
|
150
|
+
throw new Error('Missing accountAddress in callback.');
|
|
151
|
+
const keyAuthorizationHex = params.get('keyAuthorization');
|
|
152
|
+
if (!keyAuthorizationHex)
|
|
153
|
+
throw new Error('Missing keyAuthorization in callback.');
|
|
154
|
+
const keyAuthorization = KeyAuthorization.deserialize(keyAuthorizationHex);
|
|
155
|
+
if (!keyAuthorization.signature)
|
|
156
|
+
throw new Error('Key authorization in callback is missing a signature.');
|
|
157
|
+
const signed = keyAuthorization;
|
|
158
|
+
if (managedKey)
|
|
159
|
+
await saveManagedKey(accountAddress, managedKey, signed);
|
|
160
|
+
return {
|
|
161
|
+
accountAddress: accountAddress,
|
|
162
|
+
keyAuthorization: signed,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
actions: {
|
|
167
|
+
async authorizeAccessKey(parameters) {
|
|
168
|
+
const { accounts, activeAccount } = store.getState();
|
|
169
|
+
const account = accounts[activeAccount]?.address;
|
|
170
|
+
const result = await authorize({
|
|
171
|
+
...(account ? { account } : {}),
|
|
172
|
+
authorizeAccessKey: parameters,
|
|
173
|
+
method: 'wallet_authorizeAccessKey',
|
|
174
|
+
});
|
|
175
|
+
if (!account)
|
|
176
|
+
store.setState({
|
|
177
|
+
accounts: [{ address: result.accountAddress }],
|
|
178
|
+
activeAccount: 0,
|
|
179
|
+
});
|
|
180
|
+
return {
|
|
181
|
+
keyAuthorization: KeyAuthorization.toRpc(result.keyAuthorization),
|
|
182
|
+
rootAddress: result.accountAddress,
|
|
183
|
+
};
|
|
184
|
+
},
|
|
185
|
+
async createAccount(params, request) {
|
|
186
|
+
return this.loadAccounts(params, request);
|
|
187
|
+
},
|
|
188
|
+
async loadAccounts(parameters) {
|
|
189
|
+
if (parameters?.digest)
|
|
190
|
+
throw unsupported('`wallet_connect` digest signing not supported by React Native adapter.');
|
|
191
|
+
const result = await authorize({
|
|
192
|
+
authorizeAccessKey: parameters?.authorizeAccessKey,
|
|
193
|
+
method: 'wallet_connect',
|
|
194
|
+
});
|
|
195
|
+
return {
|
|
196
|
+
accounts: [
|
|
197
|
+
{
|
|
198
|
+
address: result.accountAddress,
|
|
199
|
+
capabilities: {},
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
keyAuthorization: KeyAuthorization.toRpc(result.keyAuthorization),
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
async revokeAccessKey() {
|
|
206
|
+
throw unsupported('`wallet_revokeAccessKey` not supported by React Native adapter.');
|
|
207
|
+
},
|
|
208
|
+
async sendTransaction(parameters) {
|
|
209
|
+
const { feePayer, ...rest } = parameters;
|
|
210
|
+
const client = getClient(typeof feePayer === 'string' ? { feePayer } : {});
|
|
211
|
+
const { account, prepared } = await withManagedAccessKey(async (account, keyAuthorization) => ({
|
|
212
|
+
account,
|
|
213
|
+
prepared: await prepareTransactionRequest(client, {
|
|
214
|
+
account,
|
|
215
|
+
...rest,
|
|
216
|
+
...(feePayer ? { feePayer: true } : {}),
|
|
217
|
+
...(keyAuthorization ? { keyAuthorization } : {}),
|
|
218
|
+
type: 'tempo',
|
|
219
|
+
}),
|
|
220
|
+
}));
|
|
221
|
+
const signed = await account.signTransaction(prepared);
|
|
222
|
+
return await client.request({
|
|
223
|
+
method: 'eth_sendRawTransaction',
|
|
224
|
+
params: [signed],
|
|
225
|
+
});
|
|
226
|
+
},
|
|
227
|
+
async sendTransactionSync(parameters) {
|
|
228
|
+
const { feePayer, ...rest } = parameters;
|
|
229
|
+
const client = getClient(typeof feePayer === 'string' ? { feePayer } : {});
|
|
230
|
+
const { account, prepared } = await withManagedAccessKey(async (account, keyAuthorization) => ({
|
|
231
|
+
account,
|
|
232
|
+
prepared: await prepareTransactionRequest(client, {
|
|
233
|
+
account,
|
|
234
|
+
...rest,
|
|
235
|
+
...(feePayer ? { feePayer: true } : {}),
|
|
236
|
+
...(keyAuthorization ? { keyAuthorization } : {}),
|
|
237
|
+
type: 'tempo',
|
|
238
|
+
}),
|
|
239
|
+
}));
|
|
240
|
+
const signed = await account.signTransaction(prepared);
|
|
241
|
+
return await client.request({
|
|
242
|
+
method: 'eth_sendRawTransactionSync',
|
|
243
|
+
params: [signed],
|
|
244
|
+
});
|
|
245
|
+
},
|
|
246
|
+
async signPersonalMessage({ address, data }) {
|
|
247
|
+
await loadManagedKey(address);
|
|
248
|
+
const account = getAccount({ address, signable: true });
|
|
249
|
+
return await account.signMessage({ message: { raw: data } });
|
|
250
|
+
},
|
|
251
|
+
async signTransaction(parameters) {
|
|
252
|
+
const { feePayer, ...rest } = parameters;
|
|
253
|
+
const client = getClient(typeof feePayer === 'string' ? { feePayer } : {});
|
|
254
|
+
const { account, prepared } = await withManagedAccessKey(async (account, keyAuthorization) => ({
|
|
255
|
+
account,
|
|
256
|
+
prepared: await prepareTransactionRequest(client, {
|
|
257
|
+
account,
|
|
258
|
+
...rest,
|
|
259
|
+
...(feePayer ? { feePayer: true } : {}),
|
|
260
|
+
...(keyAuthorization ? { keyAuthorization } : {}),
|
|
261
|
+
type: 'tempo',
|
|
262
|
+
}),
|
|
263
|
+
}));
|
|
264
|
+
return await account.signTransaction(prepared);
|
|
265
|
+
},
|
|
266
|
+
async signTypedData({ address, data }) {
|
|
267
|
+
await loadManagedKey(address);
|
|
268
|
+
const account = getAccount({ address, signable: true });
|
|
269
|
+
return await account.signTypedData(JSON.parse(data));
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
class AuthCancelledError extends Error {
|
|
276
|
+
constructor() {
|
|
277
|
+
super('Authentication was cancelled by the user.');
|
|
278
|
+
this.name = 'AuthCancelledError';
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
class StateMismatchError extends Error {
|
|
282
|
+
constructor() {
|
|
283
|
+
super('State parameter mismatch — possible CSRF attack.');
|
|
284
|
+
this.name = 'StateMismatchError';
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
async function defaultOpen(url, redirectUri) {
|
|
288
|
+
const { openAuthSessionAsync } = await import('expo-web-browser');
|
|
289
|
+
const result = await openAuthSessionAsync(url, redirectUri);
|
|
290
|
+
if (result.type !== 'success')
|
|
291
|
+
return null;
|
|
292
|
+
return result.url;
|
|
293
|
+
}
|
|
294
|
+
function buildAuthUrl(host, params) {
|
|
295
|
+
const url = new URL('/mobile-auth', host);
|
|
296
|
+
url.searchParams.set('pubKey', params.pubKey);
|
|
297
|
+
if (params.keyType)
|
|
298
|
+
url.searchParams.set('keyType', params.keyType);
|
|
299
|
+
url.searchParams.set('chainId', String(params.chainId));
|
|
300
|
+
if (typeof params.expiry !== 'undefined')
|
|
301
|
+
url.searchParams.set('expiry', String(params.expiry));
|
|
302
|
+
if (params.limits)
|
|
303
|
+
url.searchParams.set('limits', JSON.stringify(params.limits));
|
|
304
|
+
url.searchParams.set('callback', params.callback);
|
|
305
|
+
url.searchParams.set('state', params.state);
|
|
306
|
+
return url.toString();
|
|
307
|
+
}
|
|
308
|
+
function managedKeyStorageKey(address, chainId, keyType) {
|
|
309
|
+
return `managedKey.${address.toLowerCase()}.${chainId}${keyType ? `.${keyType}` : ''}`;
|
|
310
|
+
}
|
|
311
|
+
function unsupported(message) {
|
|
312
|
+
return new core_Provider.UnsupportedMethodError({ message });
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/react-native/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,YAAY,EACvB,MAAM,EACN,GAAG,EACH,IAAI,EACJ,QAAQ,IAAI,aAAa,EACzB,SAAS,EACT,WAAW,GACZ,MAAM,IAAI,CAAA;AACX,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE/D,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAG7C;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,OAA4B;IACtD,MAAM,EAAE,IAAI,GAAG,cAAc,EAAE,IAAI,GAAG,kBAAkB,EAAE,GAAG,OAAO,CAAA;IAEpE,OAAO,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE;QACzE,KAAK,UAAU,cAAc,CAC3B,OAA6D,EAC7D,aAAqC,EAAE;YAEvC,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,CAAA;YAC9B,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAA;YACjC,IAAI,CAAC,aAAa;gBAAE,OAAO,SAAS,CAAA;YAEpC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAA;YACpC,MAAM,UAAU,GAAG,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;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Ac,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react-native/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as Storage from '../core/Storage.js';
|
|
2
|
+
/** Creates a storage adapter backed by `expo-secure-store`. For private key material. */
|
|
3
|
+
export declare function secureStorage(options?: secureStorage.Options): Storage.Storage;
|
|
4
|
+
export declare namespace secureStorage {
|
|
5
|
+
type Options = Storage.from.Options;
|
|
6
|
+
}
|
|
7
|
+
/** Creates a storage adapter backed by `@react-native-async-storage/async-storage`. */
|
|
8
|
+
export declare function asyncStorage(options?: asyncStorage.Options): Storage.Storage;
|
|
9
|
+
export declare namespace asyncStorage {
|
|
10
|
+
type Options = Storage.from.Options;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/react-native/storage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAE7C,yFAAyF;AACzF,wBAAgB,aAAa,CAAC,OAAO,GAAE,aAAa,CAAC,OAAY,GAAG,OAAO,CAAC,OAAO,CAwBlF;AAED,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC;IACrC,KAAK,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAA;CACpC;AAED,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,OAAO,GAAE,YAAY,CAAC,OAAY,GAAG,OAAO,CAAC,OAAO,CAwBhF;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,KAAK,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAA;CACpC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Json } from 'ox';
|
|
2
|
+
import * as Storage from '../core/Storage.js';
|
|
3
|
+
/** Creates a storage adapter backed by `expo-secure-store`. For private key material. */
|
|
4
|
+
export function secureStorage(options = {}) {
|
|
5
|
+
return Storage.from({
|
|
6
|
+
async getItem(name) {
|
|
7
|
+
const { getItemAsync } = await import('expo-secure-store');
|
|
8
|
+
const raw = await getItemAsync(name);
|
|
9
|
+
if (raw === null)
|
|
10
|
+
return null;
|
|
11
|
+
try {
|
|
12
|
+
return Json.parse(raw);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
async setItem(name, value) {
|
|
19
|
+
const { setItemAsync } = await import('expo-secure-store');
|
|
20
|
+
await setItemAsync(name, Json.stringify(value));
|
|
21
|
+
},
|
|
22
|
+
async removeItem(name) {
|
|
23
|
+
const { deleteItemAsync } = await import('expo-secure-store');
|
|
24
|
+
await deleteItemAsync(name);
|
|
25
|
+
},
|
|
26
|
+
}, options);
|
|
27
|
+
}
|
|
28
|
+
/** Creates a storage adapter backed by `@react-native-async-storage/async-storage`. */
|
|
29
|
+
export function asyncStorage(options = {}) {
|
|
30
|
+
return Storage.from({
|
|
31
|
+
async getItem(name) {
|
|
32
|
+
const AsyncStorage = (await import('@react-native-async-storage/async-storage')).default;
|
|
33
|
+
const raw = await AsyncStorage.getItem(name);
|
|
34
|
+
if (raw === null)
|
|
35
|
+
return null;
|
|
36
|
+
try {
|
|
37
|
+
return Json.parse(raw);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
async setItem(name, value) {
|
|
44
|
+
const AsyncStorage = (await import('@react-native-async-storage/async-storage')).default;
|
|
45
|
+
await AsyncStorage.setItem(name, Json.stringify(value));
|
|
46
|
+
},
|
|
47
|
+
async removeItem(name) {
|
|
48
|
+
const AsyncStorage = (await import('@react-native-async-storage/async-storage')).default;
|
|
49
|
+
await AsyncStorage.removeItem(name);
|
|
50
|
+
},
|
|
51
|
+
}, options);
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/react-native/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AAEzB,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAE7C,yFAAyF;AACzF,MAAM,UAAU,aAAa,CAAC,UAAiC,EAAE;IAC/D,OAAO,OAAO,CAAC,IAAI,CACjB;QACE,KAAK,CAAC,OAAO,CAAC,IAAI;YAChB,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAA;YAC1D,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAA;YACpC,IAAI,GAAG,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAA;YAC7B,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACxB,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,IAAI,CAAA;YACb,CAAC;QACH,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK;YACvB,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAA;YAC1D,MAAM,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;QACjD,CAAC;QACD,KAAK,CAAC,UAAU,CAAC,IAAI;YACnB,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,MAAM,CAAC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version": "0.5.9",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"hono": "^4.12.12",
|
|
8
8
|
"idb-keyval": "^6.2.2",
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
"zustand": "^5.0.11"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
+
"@react-native-async-storage/async-storage": "^3.0.2",
|
|
17
18
|
"@wagmi/core": ">=2",
|
|
19
|
+
"expo-secure-store": "^55.0.12",
|
|
20
|
+
"expo-web-browser": "^55.0.13",
|
|
18
21
|
"react": ">=18",
|
|
19
22
|
"viem": ">=2.43.3"
|
|
20
23
|
},
|
|
@@ -27,6 +30,15 @@
|
|
|
27
30
|
},
|
|
28
31
|
"viem": {
|
|
29
32
|
"optional": true
|
|
33
|
+
},
|
|
34
|
+
"expo-web-browser": {
|
|
35
|
+
"optional": true
|
|
36
|
+
},
|
|
37
|
+
"expo-secure-store": {
|
|
38
|
+
"optional": true
|
|
39
|
+
},
|
|
40
|
+
"@react-native-async-storage/async-storage": {
|
|
41
|
+
"optional": true
|
|
30
42
|
}
|
|
31
43
|
},
|
|
32
44
|
"repository": {
|
|
@@ -46,6 +58,7 @@
|
|
|
46
58
|
".": {
|
|
47
59
|
"types": "./dist/index.d.ts",
|
|
48
60
|
"src": "./src/index.ts",
|
|
61
|
+
"react-native": "./dist/index.js",
|
|
49
62
|
"default": "./dist/index.js"
|
|
50
63
|
},
|
|
51
64
|
"./server": {
|
|
@@ -67,6 +80,12 @@
|
|
|
67
80
|
"types": "./dist/wagmi/index.d.ts",
|
|
68
81
|
"src": "./src/wagmi/index.ts",
|
|
69
82
|
"default": "./dist/wagmi/index.js"
|
|
83
|
+
},
|
|
84
|
+
"./react-native": {
|
|
85
|
+
"types": "./dist/react-native/index.d.ts",
|
|
86
|
+
"src": "./src/react-native/index.ts",
|
|
87
|
+
"react-native": "./dist/react-native/index.js",
|
|
88
|
+
"default": "./dist/react-native/index.js"
|
|
70
89
|
}
|
|
71
90
|
}
|
|
72
91
|
}
|
package/src/core/Dialog.ts
CHANGED
|
@@ -65,6 +65,8 @@ let cached: { host: string; instance: Instance } | undefined
|
|
|
65
65
|
/** Mutable refs swapped on re-entry so the singleton always uses the latest caller's state. */
|
|
66
66
|
let store: Store.Store | undefined
|
|
67
67
|
let fallback: Instance | undefined
|
|
68
|
+
/** Previous stores kept alive so in-flight responses find their matching request. */
|
|
69
|
+
let previousStores: Store.Store[] = []
|
|
68
70
|
|
|
69
71
|
/** Creates an iframe dialog that embeds the auth app in a `<dialog>` element. */
|
|
70
72
|
export function iframe(): Dialog {
|
|
@@ -75,7 +77,13 @@ export function iframe(): Dialog {
|
|
|
75
77
|
|
|
76
78
|
// Reuse existing iframe if the host matches — just swap the store/fallback refs.
|
|
77
79
|
if (cached && cached.host === host) {
|
|
80
|
+
const oldStore = store
|
|
78
81
|
store = parameters.store
|
|
82
|
+
|
|
83
|
+
// Keep the old store so in-flight responses can find their matching request.
|
|
84
|
+
if (oldStore && oldStore !== store && !previousStores.includes(oldStore))
|
|
85
|
+
previousStores.push(oldStore)
|
|
86
|
+
|
|
79
87
|
fallback?.destroy()
|
|
80
88
|
fallback = popup()(parameters)
|
|
81
89
|
return cached.instance
|
|
@@ -168,7 +176,10 @@ export function iframe(): Dialog {
|
|
|
168
176
|
}),
|
|
169
177
|
waitForReady: true,
|
|
170
178
|
})
|
|
171
|
-
m.on('rpc-response', (response) =>
|
|
179
|
+
m.on('rpc-response', (response) => {
|
|
180
|
+
const targetStore = findStoreForResponse(store!, previousStores, response.id)
|
|
181
|
+
handleResponse(targetStore, response)
|
|
182
|
+
})
|
|
172
183
|
m.waitForReady().then((result) => {
|
|
173
184
|
readyResult = result
|
|
174
185
|
if (result.colorScheme) frame.style.colorScheme = result.colorScheme
|
|
@@ -300,6 +311,7 @@ export function iframe(): Dialog {
|
|
|
300
311
|
|
|
301
312
|
store = undefined
|
|
302
313
|
fallback = undefined
|
|
314
|
+
previousStores = []
|
|
303
315
|
},
|
|
304
316
|
open() {
|
|
305
317
|
if (open) return
|
|
@@ -494,6 +506,19 @@ export function noop(): Dialog {
|
|
|
494
506
|
}))
|
|
495
507
|
}
|
|
496
508
|
|
|
509
|
+
/** Finds the store that owns the request matching the given response id. */
|
|
510
|
+
function findStoreForResponse(
|
|
511
|
+
current: Store.Store,
|
|
512
|
+
previous: Store.Store[],
|
|
513
|
+
id: number,
|
|
514
|
+
): Store.Store {
|
|
515
|
+
if (current.getState().requestQueue.some((q) => q.request.id === id)) return current
|
|
516
|
+
for (const s of previous) {
|
|
517
|
+
if (s.getState().requestQueue.some((q) => q.request.id === id)) return s
|
|
518
|
+
}
|
|
519
|
+
return current
|
|
520
|
+
}
|
|
521
|
+
|
|
497
522
|
/** Updates the store with an RPC response from the remote auth app. */
|
|
498
523
|
function handleResponse(
|
|
499
524
|
store: Store.Store,
|
package/src/core/Provider.ts
CHANGED
|
@@ -607,7 +607,7 @@ export function create(options: create.Options = {}): create.ReturnType {
|
|
|
607
607
|
},
|
|
608
608
|
)
|
|
609
609
|
|
|
610
|
-
if (typeof window !== 'undefined') {
|
|
610
|
+
if (typeof window !== 'undefined' && typeof CustomEvent !== 'undefined') {
|
|
611
611
|
const rdns =
|
|
612
612
|
adapter.rdns ?? `com.${(adapter.name ?? 'Injected Wallet').toLowerCase().replace(/\s+/g, '')}`
|
|
613
613
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as CoreProvider from '../core/Provider.js'
|
|
2
|
+
import { reactNative } from './adapter.js'
|
|
3
|
+
|
|
4
|
+
/** Creates a provider for React Native apps using system browser authentication. */
|
|
5
|
+
export function create(options: create.Options): create.ReturnType {
|
|
6
|
+
const { host = 'https://wallet.tempo.xyz', redirectUri, open, secureStorage, ...rest } = options
|
|
7
|
+
|
|
8
|
+
return CoreProvider.create({
|
|
9
|
+
...rest,
|
|
10
|
+
adapter: reactNative({
|
|
11
|
+
host,
|
|
12
|
+
redirectUri,
|
|
13
|
+
...(open ? { open } : {}),
|
|
14
|
+
...(secureStorage ? { secureStorage } : {}),
|
|
15
|
+
}),
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export declare namespace create {
|
|
20
|
+
export type Options = Omit<
|
|
21
|
+
CoreProvider.create.Options & reactNative.Options,
|
|
22
|
+
'adapter' | 'host'
|
|
23
|
+
> & {
|
|
24
|
+
/** Host URL for the mobile auth page. @default "https://wallet.tempo.xyz" */
|
|
25
|
+
host?: string | undefined
|
|
26
|
+
}
|
|
27
|
+
export type ReturnType = CoreProvider.create.ReturnType
|
|
28
|
+
}
|