@getpara/react-native-wallet 1.7.0 → 2.0.0-dev.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.
|
@@ -16,7 +16,7 @@ export declare class ParaMobile extends ParaCore {
|
|
|
16
16
|
* @param {string} [relyingPartyId] - The relying party ID for WebAuthn.
|
|
17
17
|
* @param {ConstructorOpts} [opts] - Additional constructor options.
|
|
18
18
|
*/
|
|
19
|
-
constructor(env: Environment, apiKey
|
|
19
|
+
constructor(env: Environment, apiKey: string, relyingPartyId?: string, opts?: ConstructorOpts);
|
|
20
20
|
protected getPlatformUtils(): PlatformUtils;
|
|
21
21
|
/**
|
|
22
22
|
* Verifies an email and returns the biometrics ID.
|
|
@@ -169,8 +169,8 @@ export class ParaMobile extends ParaCore {
|
|
|
169
169
|
const publicKeyHex = getPublicKeyHex(keyPair);
|
|
170
170
|
const encryptionKeyHash = getSHA256HashHex(userHandleEncoded);
|
|
171
171
|
const encryptedPrivateKeyHex = yield encryptPrivateKey(keyPair, userHandleEncoded);
|
|
172
|
-
const
|
|
173
|
-
yield this.ctx.client.patchSessionPublicKey(
|
|
172
|
+
const { partnerId } = yield this.ctx.client.touchSession();
|
|
173
|
+
yield this.ctx.client.patchSessionPublicKey(partnerId, this.getUserId(), biometricsId, {
|
|
174
174
|
publicKey: resultJson.id,
|
|
175
175
|
sigDerivedPublicKey: publicKeyHex,
|
|
176
176
|
cosePublicKey,
|
|
@@ -205,9 +205,9 @@ export class ParaMobile extends ParaCore {
|
|
|
205
205
|
else {
|
|
206
206
|
resultJson = result;
|
|
207
207
|
}
|
|
208
|
-
const
|
|
208
|
+
const { partnerId } = yield this.ctx.client.touchSession();
|
|
209
209
|
const publicKey = resultJson.id;
|
|
210
|
-
const verifyWebChallengeResult = yield this.ctx.client.verifyWebChallenge(
|
|
210
|
+
const verifyWebChallengeResult = yield this.ctx.client.verifyWebChallenge(partnerId, {
|
|
211
211
|
publicKey,
|
|
212
212
|
signature: {
|
|
213
213
|
clientDataJSON: resultJson.response.clientDataJSON,
|
|
@@ -254,16 +254,7 @@ export class ParaMobile extends ParaCore {
|
|
|
254
254
|
type: desiredWallet.type || undefined,
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
|
-
const currentWalletIds = {};
|
|
258
|
-
for (const wallet of Object.values(walletsToInsert)) {
|
|
259
|
-
const { id, type } = wallet;
|
|
260
|
-
const currentIdsForType = currentWalletIds[type || 'EVM'] || [];
|
|
261
|
-
currentWalletIds[type || 'EVM'] = [...currentIdsForType, id];
|
|
262
|
-
}
|
|
263
257
|
yield this.setWallets(walletsToInsert);
|
|
264
|
-
yield this.setCurrentWalletIds(currentWalletIds, {
|
|
265
|
-
sessionLookupId: session.data.sessionLookupId,
|
|
266
|
-
});
|
|
267
258
|
});
|
|
268
259
|
}
|
|
269
260
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-native-wallet",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-dev.0",
|
|
4
4
|
"description": "Para Wallet for React Native",
|
|
5
5
|
"homepage": "https://getpara.com",
|
|
6
6
|
"author": "Para Team <hello@getpara.com> (https://getpara.com)",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"compile-signer": "bash ./scripts/compileSigner.sh"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@getpara/core-sdk": "
|
|
26
|
-
"@getpara/user-management-client": "
|
|
27
|
-
"@getpara/web-sdk": "
|
|
25
|
+
"@getpara/core-sdk": "2.0.0-dev.0",
|
|
26
|
+
"@getpara/user-management-client": "2.0.0-dev.0",
|
|
27
|
+
"@getpara/web-sdk": "2.0.0-dev.0",
|
|
28
28
|
"@peculiar/webcrypto": "^1.5.0",
|
|
29
29
|
"@sentry/react-native": "^6.7.0",
|
|
30
30
|
"node-forge": "1.3.1",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "f94ef031ef0e1894f5f0800e55f6ca2904641780"
|
|
64
64
|
}
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
PasskeyGetRequest,
|
|
23
23
|
PasskeyGetResult,
|
|
24
24
|
} from 'react-native-passkey';
|
|
25
|
-
import { Auth,
|
|
25
|
+
import { Auth, extractAuthInfo, PublicKeyStatus, WalletScheme } from '@getpara/user-management-client';
|
|
26
26
|
import { setEnv } from '../config.js';
|
|
27
27
|
import base64url from 'base64url';
|
|
28
28
|
import { webcrypto } from 'crypto';
|
|
@@ -46,7 +46,7 @@ export class ParaMobile extends ParaCore {
|
|
|
46
46
|
* @param {string} [relyingPartyId] - The relying party ID for WebAuthn.
|
|
47
47
|
* @param {ConstructorOpts} [opts] - Additional constructor options.
|
|
48
48
|
*/
|
|
49
|
-
constructor(env: Environment, apiKey
|
|
49
|
+
constructor(env: Environment, apiKey: string, relyingPartyId?: string, opts?: ConstructorOpts) {
|
|
50
50
|
super(env, apiKey, opts);
|
|
51
51
|
|
|
52
52
|
// starting with non-prod to see what kind of errors we get and if sensitive data is tracked
|
|
@@ -174,8 +174,8 @@ export class ParaMobile extends ParaCore {
|
|
|
174
174
|
const encryptionKeyHash = getSHA256HashHex(userHandleEncoded);
|
|
175
175
|
const encryptedPrivateKeyHex = await encryptPrivateKey(keyPair, userHandleEncoded);
|
|
176
176
|
|
|
177
|
-
const
|
|
178
|
-
await this.ctx.client.patchSessionPublicKey(
|
|
177
|
+
const { partnerId } = await this.ctx.client.touchSession();
|
|
178
|
+
await this.ctx.client.patchSessionPublicKey(partnerId, this.getUserId()!, biometricsId, {
|
|
179
179
|
publicKey: resultJson.id,
|
|
180
180
|
sigDerivedPublicKey: publicKeyHex,
|
|
181
181
|
cosePublicKey,
|
|
@@ -220,9 +220,9 @@ export class ParaMobile extends ParaCore {
|
|
|
220
220
|
resultJson = result;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
const
|
|
223
|
+
const { partnerId } = await this.ctx.client.touchSession();
|
|
224
224
|
const publicKey = resultJson.id;
|
|
225
|
-
const verifyWebChallengeResult = await this.ctx.client.verifyWebChallenge(
|
|
225
|
+
const verifyWebChallengeResult = await this.ctx.client.verifyWebChallenge(partnerId, {
|
|
226
226
|
publicKey,
|
|
227
227
|
signature: {
|
|
228
228
|
clientDataJSON: resultJson.response.clientDataJSON,
|
|
@@ -293,16 +293,6 @@ export class ParaMobile extends ParaCore {
|
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
const currentWalletIds: CurrentWalletIds = {};
|
|
297
|
-
for (const wallet of Object.values(walletsToInsert)) {
|
|
298
|
-
const { id, type } = wallet;
|
|
299
|
-
const currentIdsForType = currentWalletIds[type || 'EVM'] || [];
|
|
300
|
-
currentWalletIds[type || 'EVM'] = [...currentIdsForType, id];
|
|
301
|
-
}
|
|
302
|
-
|
|
303
296
|
await this.setWallets(walletsToInsert);
|
|
304
|
-
await this.setCurrentWalletIds(currentWalletIds, {
|
|
305
|
-
sessionLookupId: session.data.sessionLookupId,
|
|
306
|
-
});
|
|
307
297
|
}
|
|
308
298
|
}
|