@getpara/react-native-wallet 2.18.0 → 2.19.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.
@@ -64,7 +64,7 @@ dependencies {
64
64
  // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
65
65
  //noinspection GradleDynamicVersion
66
66
  implementation "com.facebook.react:react-native:+"
67
- implementation 'com.github.briancorbin:aar-testing:0.0.4@aar'
67
+ implementation 'com.github.getpara:react-native-signer:1.0.0@aar'
68
68
  }
69
69
 
70
70
  if (isNewArchitectureEnabled()) {
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export * from '@getpara/web-sdk';
2
2
  export { ParaMobile } from './react-native/ParaMobile.js';
3
- export * from '@getpara/viem-v2-integration/aa';
3
+ export type * from '@getpara/viem-v2-integration/aa';
4
+ export * from './provider/index.js';
5
+ export * from '@getpara/react-core';
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  export * from '@getpara/web-sdk';
2
2
  export { ParaMobile } from './react-native/ParaMobile.js';
3
- // Smart Account types, errors, utilities re-exported from viem-v2-integration/aa
4
- export * from '@getpara/viem-v2-integration/aa';
3
+ // React Native provider (wraps ParaProviderCore with AsyncStorage persistence)
4
+ export * from './provider/index.js';
5
+ // Core provider hooks and config types — platform-agnostic, work with any ParaCore subclass
6
+ export * from '@getpara/react-core';
@@ -0,0 +1,19 @@
1
+ import { type ParaProviderCoreProps, type ParaClientConfig } from '@getpara/react-core/internal';
2
+ import { ParaMobile } from '../react-native/ParaMobile.js';
3
+ /**
4
+ * RN provider props. Same as ParaProviderCoreProps but:
5
+ * - Defaults to ParaMobile
6
+ * - paraClientConfig accepts a simple { apiKey, env?, opts? } config (no createClient needed)
7
+ * - storageAdapter defaults to AsyncStorage
8
+ * - Omits configureClient, waitForReady, store (internal concerns)
9
+ */
10
+ export type ParaProviderProps = Omit<ParaProviderCoreProps<ParaMobile>, 'paraClientConfig' | 'configureClient' | 'waitForReady' | 'store'> & {
11
+ /** A pre-instantiated ParaMobile, or a config with apiKey + optional env/opts. */
12
+ paraClientConfig: ParaMobile | ParaClientConfig;
13
+ };
14
+ /**
15
+ * React Native Para provider. Wraps ParaProviderCore with AsyncStorage-backed
16
+ * persistence by default. Accepts either a ParaMobile instance or a simple
17
+ * `{ apiKey, env?, opts? }` config — the provider creates the client internally.
18
+ */
19
+ export declare function ParaProvider({ children, paraClientConfig: paraClientInput, config, callbacks, storageAdapter, }: ParaProviderProps): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { useMemo } from 'react';
2
+ import { ParaProviderCore, } from '@getpara/react-core/internal';
3
+ import { asyncStorageAdapter } from './asyncStorageAdapter.js';
4
+ import { ParaMobile } from '../react-native/ParaMobile.js';
5
+ /**
6
+ * React Native Para provider. Wraps ParaProviderCore with AsyncStorage-backed
7
+ * persistence by default. Accepts either a ParaMobile instance or a simple
8
+ * `{ apiKey, env?, opts? }` config — the provider creates the client internally.
9
+ */
10
+ export function ParaProvider({ children, paraClientConfig: paraClientInput, config, callbacks, storageAdapter = asyncStorageAdapter, }) {
11
+ const coreInput = useMemo(() => {
12
+ if (paraClientInput instanceof ParaMobile)
13
+ return paraClientInput;
14
+ return Object.assign(Object.assign({}, paraClientInput), { createClient: (apiKey, env, opts) => new ParaMobile(apiKey, env, opts) });
15
+ }, [paraClientInput]);
16
+ return (<ParaProviderCore paraClientConfig={coreInput} config={config} callbacks={callbacks} storageAdapter={storageAdapter}>
17
+ {children}
18
+ </ParaProviderCore>);
19
+ }
@@ -0,0 +1,6 @@
1
+ import type { ParaStorageAdapter } from '@getpara/react-core';
2
+ /**
3
+ * ParaStorageAdapter backed by React Native AsyncStorage.
4
+ * Used by the core Zustand store for state persistence.
5
+ */
6
+ export declare const asyncStorageAdapter: ParaStorageAdapter;
@@ -0,0 +1,41 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import RNAsyncStorage from '@react-native-async-storage/async-storage';
11
+ /**
12
+ * ParaStorageAdapter backed by React Native AsyncStorage.
13
+ * Used by the core Zustand store for state persistence.
14
+ */
15
+ export const asyncStorageAdapter = {
16
+ getItem: (key) => __awaiter(void 0, void 0, void 0, function* () {
17
+ try {
18
+ return yield RNAsyncStorage.getItem(key);
19
+ }
20
+ catch (error) {
21
+ console.warn('[Para] Error reading from AsyncStorage:', error);
22
+ return null;
23
+ }
24
+ }),
25
+ setItem: (key, value) => __awaiter(void 0, void 0, void 0, function* () {
26
+ try {
27
+ yield RNAsyncStorage.setItem(key, value);
28
+ }
29
+ catch (error) {
30
+ console.warn(`[Para] Error writing to AsyncStorage (key: ${key}):`, error);
31
+ }
32
+ }),
33
+ removeItem: (key) => __awaiter(void 0, void 0, void 0, function* () {
34
+ try {
35
+ yield RNAsyncStorage.removeItem(key);
36
+ }
37
+ catch (error) {
38
+ console.warn(`[Para] Error removing from AsyncStorage (key: ${key}):`, error);
39
+ }
40
+ }),
41
+ };
@@ -0,0 +1,2 @@
1
+ export { ParaProvider, type ParaProviderProps } from './ParaProvider.js';
2
+ export { asyncStorageAdapter } from './asyncStorageAdapter.js';
@@ -0,0 +1,2 @@
1
+ export { ParaProvider } from './ParaProvider.js';
2
+ export { asyncStorageAdapter } from './asyncStorageAdapter.js';
@@ -13,7 +13,6 @@ import { Passkey, } from 'react-native-passkey';
13
13
  import { AuthMethodStatus } from '@getpara/user-management-client';
14
14
  import { setEnv } from '../config.js';
15
15
  import base64url from 'base64url';
16
- import { webcrypto } from 'crypto';
17
16
  const ES256_ALGORITHM = -7;
18
17
  const RS256_ALGORITHM = -257;
19
18
  /**
@@ -120,11 +119,11 @@ export class ParaMobile extends ParaCore {
120
119
  }
121
120
  const userId = this.assertUserId();
122
121
  const authInfo = this.assertIsAuthSet();
123
- if (!webcrypto || !webcrypto.getRandomValues) {
122
+ if (!globalThis.crypto || !globalThis.crypto.getRandomValues) {
124
123
  throw new Error('Web crypto is not available. Ensure you have imported the shim from @getpara/react-native-wallet.');
125
124
  }
126
125
  const userHandle = new Uint8Array(32);
127
- webcrypto.getRandomValues(userHandle);
126
+ globalThis.crypto.getRandomValues(userHandle);
128
127
  const userHandleEncoded = base64url.encode(userHandle);
129
128
  const requestJson = {
130
129
  authenticatorSelection: {
@@ -1,6 +1,4 @@
1
- import { PlatformUtils, TPregenIdentifierType, EventHandler, EventData } from '@getpara/web-sdk';
2
- import { Ctx } from '@getpara/web-sdk';
3
- import { SignatureRes } from '@getpara/web-sdk';
1
+ import type { PlatformUtils, TPregenIdentifierType, EventHandler, EventData, Ctx, SignatureRes } from '@getpara/web-sdk';
4
2
  import { BackupKitEmailProps, TWalletType, SDKType } from '@getpara/user-management-client';
5
3
  import { AsyncStorage } from '../AsyncStorage.js';
6
4
  import { KeychainStorage } from '../KeychainStorage.js';
package/dist/shim.d.ts CHANGED
@@ -1,130 +1,178 @@
1
1
  export function ensureParaCrypto(): {
2
- baseCrypto: webcrypto.Crypto | {
3
- getCiphers: () => string[];
4
- getHashes: () => string[];
5
- webcrypto: {
6
- subtle: import("react-native-quick-crypto/lib/typescript/src/subtle").Subtle;
7
- SubtleCrypto: typeof import("react-native-quick-crypto/lib/typescript/src/subtle").Subtle;
8
- CryptoKey: typeof import("react-native-quick-crypto/lib/typescript/src/keys").CryptoKey;
2
+ baseCrypto: import("crypto").webcrypto.Crypto | {
3
+ Certificate: typeof import("react-native-quick-crypto").Certificate;
4
+ X509Certificate: typeof import("react-native-quick-crypto").X509Certificate;
5
+ getCurves: typeof import("react-native-quick-crypto").getCurves;
6
+ constants: {
7
+ readonly RSA_PKCS1_PADDING: 1;
8
+ readonly RSA_NO_PADDING: 3;
9
+ readonly RSA_PKCS1_OAEP_PADDING: 4;
10
+ readonly RSA_X931_PADDING: 5;
11
+ readonly RSA_PKCS1_PSS_PADDING: 6;
12
+ readonly RSA_PSS_SALTLEN_DIGEST: -1;
13
+ readonly RSA_PSS_SALTLEN_MAX_SIGN: -2;
14
+ readonly RSA_PSS_SALTLEN_AUTO: -2;
15
+ readonly POINT_CONVERSION_COMPRESSED: 2;
16
+ readonly POINT_CONVERSION_UNCOMPRESSED: 4;
17
+ readonly POINT_CONVERSION_HYBRID: 6;
18
+ readonly DH_CHECK_P_NOT_PRIME: 1;
19
+ readonly DH_CHECK_P_NOT_SAFE_PRIME: 2;
20
+ readonly DH_UNABLE_TO_CHECK_GENERATOR: 4;
21
+ readonly DH_NOT_SUITABLE_GENERATOR: 8;
22
+ readonly OPENSSL_VERSION_NUMBER: 805306368;
23
+ };
24
+ Buffer: typeof Buffer;
25
+ isCryptoKeyPair(result: import("react-native-quick-crypto").CryptoKey | import("react-native-quick-crypto").CryptoKeyPair): result is import("react-native-quick-crypto").CryptoKeyPair;
26
+ Subtle: typeof import("react-native-quick-crypto").Subtle;
27
+ subtle: import("react-native-quick-crypto").Subtle;
28
+ toArrayBuffer(buf: Buffer | import("safe-buffer").Buffer | ArrayBufferView): ArrayBuffer;
29
+ bufferLikeToArrayBuffer(buf: import("react-native-quick-crypto").BufferLike): ArrayBuffer;
30
+ binaryLikeToArrayBuffer(input: import("react-native-quick-crypto").BinaryLikeNode, encoding?: string): ArrayBuffer;
31
+ ab2str(buf: ArrayBuffer, encoding?: string): string;
32
+ bufferToString(buf: ArrayBuffer, encoding?: string): string;
33
+ stringToBuffer(str: string, encoding?: string): ArrayBuffer;
34
+ abvToArrayBuffer: (buf: import("react-native-quick-crypto").ABV) => ArrayBuffer;
35
+ kEmptyObject: any;
36
+ ensureBytes(title: string, hex: import("react-native-quick-crypto").Hex, expectedLength?: number): Uint8Array;
37
+ isBytes(a: unknown): a is Uint8Array;
38
+ hexToBytes(hex: string): Uint8Array;
39
+ lazyDOMException(message: string, domName: string | {
40
+ name: string;
41
+ cause: unknown;
42
+ }): Error;
43
+ normalizeHashName(algo: string | import("react-native-quick-crypto").HashAlgorithm | {
44
+ name: string;
45
+ } | undefined, context?: import("react-native-quick-crypto").HashContext): string;
46
+ HashContext: typeof import("react-native-quick-crypto").HashContext;
47
+ timingSafeEqual(a: import("react-native-quick-crypto").ABV, b: import("react-native-quick-crypto").ABV): boolean;
48
+ KFormatType: typeof import("react-native-quick-crypto").KFormatType;
49
+ KeyType: typeof import("react-native-quick-crypto").KeyType;
50
+ KeyEncoding: typeof import("react-native-quick-crypto").KeyEncoding;
51
+ KeyFormat: typeof import("react-native-quick-crypto").KeyFormat;
52
+ kNamedCurveAliases: {
53
+ readonly "P-256": "prime256v1";
54
+ readonly "P-384": "secp384r1";
55
+ readonly "P-521": "secp521r1";
9
56
  };
10
- randomFill<T extends import("react-native-quick-crypto/lib/typescript/src/Utils").ABV>(buffer: T, callback: (err: Error | null, buf: T) => void): void;
11
- randomFill<T extends import("react-native-quick-crypto/lib/typescript/src/Utils").ABV>(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void;
12
- randomFill<T extends import("react-native-quick-crypto/lib/typescript/src/Utils").ABV>(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void;
13
- randomFillSync<T extends import("react-native-quick-crypto/lib/typescript/src/Utils").ABV>(buffer: T, offset?: number, size?: number): T;
57
+ KeyVariant: typeof import("react-native-quick-crypto").KeyVariant;
58
+ validateFunction(f: unknown): boolean;
59
+ isStringOrBuffer(val: unknown): val is string | ArrayBuffer;
60
+ validateObject<T>(value: unknown, name: string, options?: {
61
+ allowArray: boolean;
62
+ allowFunction: boolean;
63
+ nullable: boolean;
64
+ } | null): value is T;
65
+ hasAnyNotIn(set: string[], checks: string[]): boolean;
66
+ validateMaxBufferLength: (data: import("react-native-quick-crypto").BinaryLike | import("react-native-quick-crypto").BufferLike, name: string) => void;
67
+ getUsagesUnion: (usageSet: import("react-native-quick-crypto").KeyUsage[], ...usages: import("react-native-quick-crypto").KeyUsage[]) => import("react-native-quick-crypto").KeyUsage[];
68
+ validateKeyOps: (keyOps: import("react-native-quick-crypto").KeyUsage[] | undefined, usagesSet: import("react-native-quick-crypto").KeyUsage[]) => void;
69
+ setDefaultEncoding(encoding: import("react-native-quick-crypto").Encoding): void;
70
+ getDefaultEncoding(): import("react-native-quick-crypto").Encoding;
71
+ normalizeEncoding(enc: string): "ascii" | "utf8" | "utf16le" | "base64" | "latin1" | "hex" | undefined;
72
+ validateEncoding(data: string, encoding: string): void;
73
+ getUIntOption(options: Record<string, any>, key: string): any;
74
+ encapsulate(key: import("react-native-quick-crypto").CryptoKey | import("react-native-quick-crypto").BinaryLike | import("react-native-quick-crypto").KeyObject | import("react-native-quick-crypto").KeyInputObject, callback?: (err: Error | null, result?: import("react-native-quick-crypto").EncapsulateResult) => void): import("react-native-quick-crypto").EncapsulateResult | void;
75
+ decapsulate(key: import("react-native-quick-crypto").CryptoKey | import("react-native-quick-crypto").BinaryLike | import("react-native-quick-crypto").KeyObject | import("react-native-quick-crypto").KeyInputObject, ciphertext: import("react-native-quick-crypto").BinaryLike, callback?: (err: Error | null, result?: ArrayBuffer) => void): ArrayBuffer | void;
76
+ mlkem_generateKeyPairWebCrypto(variant: import("react-native-quick-crypto").MlKemVariant, extractable: boolean, keyUsages: import("react-native-quick-crypto").KeyUsage[]): Promise<import("react-native-quick-crypto").CryptoKeyPair>;
77
+ MlKem: typeof import("react-native-quick-crypto").MlKem;
78
+ createDiffieHellman(primeOrSize: number | string | Buffer, primeEncodingOrGenerator?: string | number | Buffer, generator?: number | string | Buffer, _generatorEncoding?: string): import("react-native-quick-crypto").DiffieHellman;
79
+ getDiffieHellman(groupName: string): import("react-native-quick-crypto").DiffieHellman;
80
+ DiffieHellman: typeof import("react-native-quick-crypto").DiffieHellman;
81
+ createDiffieHellmanGroup: typeof import("react-native-quick-crypto").getDiffieHellman;
82
+ createECDH(curveName: string): import("react-native-quick-crypto").ECDH;
83
+ ECDH: typeof import("react-native-quick-crypto").ECDH;
84
+ randomFill<T extends import("react-native-quick-crypto").ABV>(buffer: T, callback: import("react-native-quick-crypto").RandomCallback<T>): void;
85
+ randomFill<T extends import("react-native-quick-crypto").ABV>(buffer: T, offset: number, callback: import("react-native-quick-crypto").RandomCallback<T>): void;
86
+ randomFill<T extends import("react-native-quick-crypto").ABV>(buffer: T, offset: number, size: number, callback: import("react-native-quick-crypto").RandomCallback<T>): void;
87
+ randomFillSync<T extends import("react-native-quick-crypto").ABV>(buffer: T, offset?: number, size?: number): T;
14
88
  randomBytes(size: number): Buffer;
15
89
  randomBytes(size: number, callback: (err: Error | null, buf?: Buffer) => void): void;
16
90
  randomInt(max: number, callback: (err: Error | null, value: number) => void): void;
17
91
  randomInt(max: number): number;
18
92
  randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void;
19
93
  randomInt(min: number, max: number): number;
20
- getRandomValues(data: import("react-native-quick-crypto/lib/typescript/src/random").RandomTypedArrays): import("react-native-quick-crypto/lib/typescript/src/random").RandomTypedArrays;
94
+ getRandomValues(data: import("react-native-quick-crypto").RandomTypedArrays): import("react-native-quick-crypto").RandomTypedArrays;
21
95
  randomUUID(): string;
22
- rng: typeof import("react-native-quick-crypto/lib/typescript/src/random").randomBytes;
23
- pseudoRandomBytes: typeof import("react-native-quick-crypto/lib/typescript/src/random").randomBytes;
24
- prng: typeof import("react-native-quick-crypto/lib/typescript/src/random").randomBytes;
25
- pbkdf2(password: import("react-native-quick-crypto/lib/typescript/src/Utils").BinaryLike, salt: import("react-native-quick-crypto/lib/typescript/src/Utils").BinaryLike, iterations: number, keylen: number, digest: string, callback: (err: Error | null, derivedKey?: Buffer) => void): void;
26
- pbkdf2Sync(password: import("react-native-quick-crypto/lib/typescript/src/Utils").BinaryLike, salt: import("react-native-quick-crypto/lib/typescript/src/Utils").BinaryLike, iterations: number, keylen: number, digest?: string): Buffer;
27
- pbkdf2DeriveBits(algorithm: import("react-native-quick-crypto/lib/typescript/src/keys").SubtleAlgorithm, baseKey: import("react-native-quick-crypto/lib/typescript/src/keys").CryptoKey, length: number): Promise<ArrayBuffer>;
28
- createHmac: typeof import("react-native-quick-crypto/lib/typescript/src/Hmac").createHmac;
29
- Hmac: typeof import("react-native-quick-crypto/lib/typescript/src/Hmac").createHmac;
30
- Hash: typeof import("react-native-quick-crypto/lib/typescript/src/Hash").createHash;
31
- createHash: typeof import("react-native-quick-crypto/lib/typescript/src/Hash").createHash;
32
- createCipher: typeof import("react-native-quick-crypto/lib/typescript/src/Cipher").createCipher;
33
- createCipheriv: typeof import("react-native-quick-crypto/lib/typescript/src/Cipher").createCipheriv;
34
- createDecipher: typeof import("react-native-quick-crypto/lib/typescript/src/Cipher").createDecipher;
35
- createDecipheriv: typeof import("react-native-quick-crypto/lib/typescript/src/Cipher").createDecipheriv;
36
- createPublicKey: typeof import("react-native-quick-crypto/lib/typescript/src/keys").createPublicKey;
37
- createPrivateKey: (key: import("react-native-quick-crypto/lib/typescript/src/Utils").BinaryLike | import("react-native-quick-crypto/lib/typescript/src/keys").EncodingOptions) => import("react-native-quick-crypto/lib/typescript/src/keys").PrivateKeyObject;
38
- createSecretKey: typeof import("react-native-quick-crypto/lib/typescript/src/keys").createSecretKey;
39
- publicEncrypt: (options: import("react-native-quick-crypto/lib/typescript/src/keys").EncodingOptions | import("react-native-quick-crypto/lib/typescript/src/Utils").BinaryLike, buffer: import("react-native-quick-crypto/lib/typescript/src/Utils").BinaryLike) => Buffer;
40
- publicDecrypt: (options: import("react-native-quick-crypto/lib/typescript/src/keys").EncodingOptions | import("react-native-quick-crypto/lib/typescript/src/Utils").BinaryLike, buffer: import("react-native-quick-crypto/lib/typescript/src/Utils").BinaryLike) => Buffer;
41
- privateDecrypt: (options: import("react-native-quick-crypto/lib/typescript/src/keys").EncodingOptions | import("react-native-quick-crypto/lib/typescript/src/Utils").BinaryLike, buffer: import("react-native-quick-crypto/lib/typescript/src/Utils").BinaryLike) => Buffer;
42
- generateKey: (type: import("react-native-quick-crypto/lib/typescript/src/keys").SecretKeyType, options: import("react-native-quick-crypto/lib/typescript/src/keys").AesKeyGenParams, callback: import("react-native-quick-crypto/lib/typescript/src/keygen").KeyGenCallback) => void;
43
- generateKeyPair: (type: import("react-native-quick-crypto/lib/typescript/src/keys").KeyPairType, options: import("react-native-quick-crypto/lib/typescript/src/Cipher").GenerateKeyPairOptions, callback: import("react-native-quick-crypto/lib/typescript/src/Cipher").GenerateKeyPairCallback) => void;
44
- generateKeyPairSync: typeof import("react-native-quick-crypto/lib/typescript/src/Cipher").generateKeyPairSync;
45
- generateKeySync: (type: import("react-native-quick-crypto/lib/typescript/src/keys").SecretKeyType, options: import("react-native-quick-crypto/lib/typescript/src/keys").AesKeyGenParams) => import("react-native-quick-crypto/lib/typescript/src/keys").SecretKeyObject;
46
- createSign: typeof import("react-native-quick-crypto/lib/typescript/src/sig").createSign;
47
- createVerify: typeof import("react-native-quick-crypto/lib/typescript/src/sig").createVerify;
48
- subtle: import("react-native-quick-crypto/lib/typescript/src/subtle").Subtle;
49
- constants: {
50
- OPENSSL_VERSION_NUMBER: number;
51
- SSL_OP_ALL: number;
52
- SSL_OP_ALLOW_NO_DHE_KEX: number;
53
- SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number;
54
- SSL_OP_CIPHER_SERVER_PREFERENCE: number;
55
- SSL_OP_CISCO_ANYCONNECT: number;
56
- SSL_OP_COOKIE_EXCHANGE: number;
57
- SSL_OP_CRYPTOPRO_TLSEXT_BUG: number;
58
- SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number;
59
- SSL_OP_EPHEMERAL_RSA: number;
60
- SSL_OP_LEGACY_SERVER_CONNECT: number;
61
- SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number;
62
- SSL_OP_MICROSOFT_SESS_ID_BUG: number;
63
- SSL_OP_MSIE_SSLV2_RSA_PADDING: number;
64
- SSL_OP_NETSCAPE_CA_DN_BUG: number;
65
- SSL_OP_NETSCAPE_CHALLENGE_BUG: number;
66
- SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number;
67
- SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number;
68
- SSL_OP_NO_COMPRESSION: number;
69
- SSL_OP_NO_ENCRYPT_THEN_MAC: number;
70
- SSL_OP_NO_QUERY_MTU: number;
71
- SSL_OP_NO_RENEGOTIATION: number;
72
- SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number;
73
- SSL_OP_NO_SSLv2: number;
74
- SSL_OP_NO_SSLv3: number;
75
- SSL_OP_NO_TICKET: number;
76
- SSL_OP_NO_TLSv1: number;
77
- SSL_OP_NO_TLSv1_1: number;
78
- SSL_OP_NO_TLSv1_2: number;
79
- SSL_OP_NO_TLSv1_3: number;
80
- SSL_OP_PKCS1_CHECK_1: number;
81
- SSL_OP_PKCS1_CHECK_2: number;
82
- SSL_OP_PRIORITIZE_CHACHA: number;
83
- SSL_OP_SINGLE_DH_USE: number;
84
- SSL_OP_SINGLE_ECDH_USE: number;
85
- SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number;
86
- SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number;
87
- SSL_OP_TLS_BLOCK_PADDING_BUG: number;
88
- SSL_OP_TLS_D5_BUG: number;
89
- SSL_OP_TLS_ROLLBACK_BUG: number;
90
- ENGINE_METHOD_RSA: number;
91
- ENGINE_METHOD_DSA: number;
92
- ENGINE_METHOD_DH: number;
93
- ENGINE_METHOD_RAND: number;
94
- ENGINE_METHOD_EC: number;
95
- ENGINE_METHOD_CIPHERS: number;
96
- ENGINE_METHOD_DIGESTS: number;
97
- ENGINE_METHOD_PKEY_METHS: number;
98
- ENGINE_METHOD_PKEY_ASN1_METHS: number;
99
- ENGINE_METHOD_ALL: number;
100
- ENGINE_METHOD_NONE: number;
101
- DH_CHECK_P_NOT_SAFE_PRIME: number;
102
- DH_CHECK_P_NOT_PRIME: number;
103
- DH_UNABLE_TO_CHECK_GENERATOR: number;
104
- DH_NOT_SUITABLE_GENERATOR: number;
105
- ALPN_ENABLED: number;
106
- RSA_PKCS1_PADDING: number;
107
- RSA_SSLV23_PADDING: number;
108
- RSA_NO_PADDING: number;
109
- RSA_PKCS1_OAEP_PADDING: number;
110
- RSA_X931_PADDING: number;
111
- RSA_PKCS1_PSS_PADDING: number;
112
- RSA_PSS_SALTLEN_DIGEST: number;
113
- RSA_PSS_SALTLEN_MAX_SIGN: number;
114
- RSA_PSS_SALTLEN_AUTO: number;
115
- defaultCoreCipherList: string;
116
- TLS1_VERSION: number;
117
- TLS1_1_VERSION: number;
118
- TLS1_2_VERSION: number;
119
- TLS1_3_VERSION: number;
120
- POINT_CONVERSION_COMPRESSED: number;
121
- POINT_CONVERSION_UNCOMPRESSED: number;
122
- POINT_CONVERSION_HYBRID: number;
96
+ rng: typeof import("react-native-quick-crypto").randomBytes;
97
+ pseudoRandomBytes: typeof import("react-native-quick-crypto").randomBytes;
98
+ prng: typeof import("react-native-quick-crypto").randomBytes;
99
+ scrypt(password: import("react-native-quick-crypto").BinaryLike, salt: import("react-native-quick-crypto").BinaryLike, keylen: number, options?: import("react-native-quick-crypto").ScryptOptions | ((err: Error | null, derivedKey?: Buffer) => void), callback?: (err: Error | null, derivedKey?: Buffer) => void): void;
100
+ scryptSync(password: import("react-native-quick-crypto").BinaryLike, salt: import("react-native-quick-crypto").BinaryLike, keylen: number, options?: import("react-native-quick-crypto").ScryptOptions): Buffer;
101
+ generatePrimeSync(size: number, options?: import("react-native-quick-crypto").GeneratePrimeOptions): Buffer | bigint;
102
+ generatePrime(size: number, options: import("react-native-quick-crypto").GeneratePrimeOptions | ((err: Error | null, prime: Buffer | bigint) => void), callback?: (err: Error | null, prime: Buffer | bigint) => void): void;
103
+ checkPrimeSync(candidate: import("react-native-quick-crypto").BinaryLike | bigint, options?: import("react-native-quick-crypto").CheckPrimeOptions): boolean;
104
+ checkPrime(candidate: import("react-native-quick-crypto").BinaryLike | bigint, options: import("react-native-quick-crypto").CheckPrimeOptions | ((err: Error | null, result: boolean) => void), callback?: (err: Error | null, result: boolean) => void): void;
105
+ pbkdf2(password: import("react-native-quick-crypto").BinaryLike, salt: import("react-native-quick-crypto").BinaryLike, iterations: number, keylen: number, digest: string, callback: (err: Error | null, derivedKey?: Buffer) => void): void;
106
+ pbkdf2Sync(password: import("react-native-quick-crypto").BinaryLike, salt: import("react-native-quick-crypto").BinaryLike, iterations: number, keylen: number, digest: string): Buffer;
107
+ pbkdf2DeriveBits(algorithm: import("react-native-quick-crypto").SubtleAlgorithm, baseKey: import("react-native-quick-crypto").CryptoKey, length: number): Promise<ArrayBuffer>;
108
+ hkdf(digest: string, key: import("react-native-quick-crypto").BinaryLike, salt: import("react-native-quick-crypto").BinaryLike, info: import("react-native-quick-crypto").BinaryLike, keylen: number, callback: import("react-native-quick-crypto").HkdfCallback): void;
109
+ hkdfSync(digest: string, key: import("react-native-quick-crypto").BinaryLike, salt: import("react-native-quick-crypto").BinaryLike, info: import("react-native-quick-crypto").BinaryLike, keylen: number): Buffer;
110
+ hkdfDeriveBits(algorithm: import("react-native-quick-crypto").HkdfAlgorithm, baseKey: import("react-native-quick-crypto").CryptoKey, length: number): ArrayBuffer;
111
+ createHmac: typeof import("react-native-quick-crypto").createHmac;
112
+ createHash: typeof import("react-native-quick-crypto").createHash;
113
+ getHashes: typeof import("react-native-quick-crypto").getHashes;
114
+ hash: typeof import("react-native-quick-crypto").hash;
115
+ asyncDigest: (algorithm: import("react-native-quick-crypto").SubtleAlgorithm, data: import("react-native-quick-crypto").BufferLike) => Promise<ArrayBuffer>;
116
+ diffieHellman(options: import("react-native-quick-crypto").DiffieHellmanOptions, callback?: import("react-native-quick-crypto").DiffieHellmanCallback): Buffer | void;
117
+ ed_generateKeyPair(isAsync: boolean, type: import("react-native-quick-crypto").CFRGKeyPairType, encoding: import("react-native-quick-crypto").KeyPairGenConfig, callback: import("react-native-quick-crypto").GenerateKeyPairCallback | undefined): import("react-native-quick-crypto").GenerateKeyPairReturn | void;
118
+ ed_generateKeyPairWebCrypto(type: "ed25519" | "ed448", extractable: boolean, keyUsages: import("react-native-quick-crypto").KeyUsage[]): Promise<import("react-native-quick-crypto").CryptoKeyPair>;
119
+ x_generateKeyPairWebCrypto(type: "x25519" | "x448", extractable: boolean, keyUsages: import("react-native-quick-crypto").KeyUsage[]): Promise<import("react-native-quick-crypto").CryptoKeyPair>;
120
+ xDeriveBits(algorithm: import("react-native-quick-crypto").SubtleAlgorithm, baseKey: import("react-native-quick-crypto").CryptoKey, length: number | null): ArrayBuffer;
121
+ Ed: typeof import("react-native-quick-crypto").Ed;
122
+ getCiphers(): string[];
123
+ getCipherInfo(name: string, options?: {
124
+ keyLength?: number;
125
+ ivLength?: number;
126
+ }): import("react-native-quick-crypto").CipherInfoResult | undefined;
127
+ createDecipheriv(algorithm: import("crypto").CipherCCMTypes, key: import("react-native-quick-crypto").BinaryLikeNode, iv: import("react-native-quick-crypto").BinaryLike, options: import("crypto").CipherCCMOptions): import("react-native-quick-crypto").Decipher;
128
+ createDecipheriv(algorithm: import("crypto").CipherOCBTypes, key: import("react-native-quick-crypto").BinaryLikeNode, iv: import("react-native-quick-crypto").BinaryLike, options: import("crypto").CipherOCBOptions): import("react-native-quick-crypto").Decipher;
129
+ createDecipheriv(algorithm: import("crypto").CipherGCMTypes, key: import("react-native-quick-crypto").BinaryLikeNode, iv: import("react-native-quick-crypto").BinaryLike, options?: import("crypto").CipherGCMOptions): import("react-native-quick-crypto").Decipher;
130
+ createDecipheriv(algorithm: string, key: import("react-native-quick-crypto").BinaryLikeNode, iv: import("react-native-quick-crypto").BinaryLike, options?: import("readable-stream").TransformOptions): import("react-native-quick-crypto").Decipher;
131
+ createCipheriv(algorithm: import("crypto").CipherCCMTypes, key: import("react-native-quick-crypto").BinaryLikeNode, iv: import("react-native-quick-crypto").BinaryLike, options: import("crypto").CipherCCMOptions): import("react-native-quick-crypto").Cipher;
132
+ createCipheriv(algorithm: import("crypto").CipherOCBTypes, key: import("react-native-quick-crypto").BinaryLikeNode, iv: import("react-native-quick-crypto").BinaryLike, options: import("crypto").CipherOCBOptions): import("react-native-quick-crypto").Cipher;
133
+ createCipheriv(algorithm: import("crypto").CipherGCMTypes, key: import("react-native-quick-crypto").BinaryLikeNode, iv: import("react-native-quick-crypto").BinaryLike, options?: import("crypto").CipherGCMOptions): import("react-native-quick-crypto").Cipher;
134
+ createCipheriv(algorithm: string, key: import("react-native-quick-crypto").BinaryLikeNode, iv: import("react-native-quick-crypto").BinaryLike, options?: import("readable-stream").TransformOptions): import("react-native-quick-crypto").Cipher;
135
+ xsalsa20(key: Uint8Array, nonce: Uint8Array, data: Uint8Array, output?: Uint8Array | undefined, counter?: number): Uint8Array;
136
+ createBlake3(opts?: import("react-native-quick-crypto").Blake3Options): import("react-native-quick-crypto").Blake3;
137
+ blake3: typeof import("react-native-quick-crypto").blake3;
138
+ Blake3: typeof import("react-native-quick-crypto").Blake3;
139
+ blake3Exports: {
140
+ Blake3: typeof import("react-native-quick-crypto").Blake3;
141
+ createBlake3: typeof import("react-native-quick-crypto").createBlake3;
142
+ blake3: typeof import("react-native-quick-crypto").blake3;
123
143
  };
144
+ createSecretKey: typeof import("react-native-quick-crypto").createSecretKey;
145
+ createPublicKey: typeof import("react-native-quick-crypto").createPublicKey;
146
+ createPrivateKey: typeof import("react-native-quick-crypto").createPrivateKey;
147
+ CryptoKey: typeof import("react-native-quick-crypto").CryptoKey;
148
+ generateKey: typeof import("react-native-quick-crypto").generateKey;
149
+ generateKeySync: typeof import("react-native-quick-crypto").generateKeySync;
150
+ generateKeyPair: (type: import("react-native-quick-crypto").KeyPairType, options: import("react-native-quick-crypto").GenerateKeyPairOptions, callback: import("react-native-quick-crypto").GenerateKeyPairCallback) => void;
151
+ generateKeyPairSync: typeof import("react-native-quick-crypto").generateKeyPairSync;
152
+ AsymmetricKeyObject: typeof import("react-native-quick-crypto").AsymmetricKeyObject;
153
+ KeyObject: typeof import("react-native-quick-crypto").KeyObject;
154
+ createSign: typeof import("react-native-quick-crypto").createSign;
155
+ createVerify: typeof import("react-native-quick-crypto").createVerify;
156
+ sign: typeof import("react-native-quick-crypto").sign;
157
+ verify: typeof import("react-native-quick-crypto").verify;
158
+ Sign: typeof import("react-native-quick-crypto").Sign;
159
+ Verify: typeof import("react-native-quick-crypto").Verify;
160
+ publicEncrypt: typeof import("react-native-quick-crypto").publicEncrypt;
161
+ publicDecrypt: typeof import("react-native-quick-crypto").publicDecrypt;
162
+ privateEncrypt: typeof import("react-native-quick-crypto").privateEncrypt;
163
+ privateDecrypt: typeof import("react-native-quick-crypto").privateDecrypt;
164
+ parsePublicKeyEncoding: typeof import("react-native-quick-crypto").parsePublicKeyEncoding;
165
+ parsePrivateKeyEncoding: typeof import("react-native-quick-crypto").parsePrivateKeyEncoding;
166
+ parseKeyEncoding: typeof import("react-native-quick-crypto").parseKeyEncoding;
167
+ SecretKeyObject: typeof import("react-native-quick-crypto").SecretKeyObject;
168
+ PublicKeyObject: typeof import("react-native-quick-crypto").PublicKeyObject;
169
+ PrivateKeyObject: typeof import("react-native-quick-crypto").PrivateKeyObject;
170
+ isCryptoKey: (obj: any) => boolean;
171
+ argon2Sync(algorithm: string, params: import("react-native-quick-crypto").Argon2Params): Buffer;
172
+ argon2(algorithm: string, params: import("react-native-quick-crypto").Argon2Params, callback: (err: Error | null, result: Buffer) => void): void;
124
173
  };
125
174
  peculiarCrypto: PeculiarCrypto;
126
175
  };
127
176
  export function ensureCreateECDH(): any;
128
- import { webcrypto } from 'crypto';
129
177
  import { Buffer } from '@craftzdog/react-native-buffer';
130
178
  import { Crypto as PeculiarCrypto } from '@peculiar/webcrypto';
package/dist/shim.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import quickCrypto from 'react-native-quick-crypto';
2
- import { webcrypto } from 'crypto';
3
2
  import { Crypto as PeculiarCrypto } from '@peculiar/webcrypto';
4
3
  import { ec as EllipticEC } from 'elliptic';
5
4
  import Forge from 'node-forge';
@@ -246,8 +245,26 @@ const ensureParaCrypto = () => {
246
245
  };
247
246
  const setupCryptoPolyfills = () => {
248
247
  const { peculiarCrypto } = ensureParaCrypto();
249
- if (webcrypto && typeof webcrypto === 'object') {
250
- webcrypto.getRandomValues = peculiarCrypto.getRandomValues.bind(peculiarCrypto);
248
+ // Ensure `import { webcrypto } from 'crypto'` works regardless of quick-crypto version.
249
+ // quick-crypto 1.x (Nitro) removed the webcrypto export that 0.7.x had.
250
+ try {
251
+ const cryptoModule = require('crypto');
252
+ if (!cryptoModule.webcrypto || typeof cryptoModule.webcrypto !== 'object') {
253
+ Object.defineProperty(cryptoModule, 'webcrypto', {
254
+ get() {
255
+ return globalThis.crypto;
256
+ },
257
+ configurable: true,
258
+ enumerable: true,
259
+ });
260
+ }
261
+ if (cryptoModule.webcrypto && typeof cryptoModule.webcrypto === 'object') {
262
+ cryptoModule.webcrypto.getRandomValues = peculiarCrypto.getRandomValues.bind(peculiarCrypto);
263
+ }
264
+ // eslint-disable-next-line no-unused-vars
265
+ }
266
+ catch (_err) {
267
+ // crypto module not available
251
268
  }
252
269
  if (typeof Forge === 'undefined') {
253
270
  throw new Error('node-forge not loaded');
package/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@getpara/react-native-wallet",
3
3
  "description": "Para Wallet for React Native",
4
- "version": "2.18.0",
4
+ "version": "2.19.0",
5
5
  "author": "Para Team <hello@getpara.com> (https://getpara.com)",
6
6
  "dependencies": {
7
- "@getpara/core-sdk": "2.18.0",
8
- "@getpara/user-management-client": "2.18.0",
9
- "@getpara/viem-v2-integration": "2.18.0",
10
- "@getpara/web-sdk": "2.18.0",
7
+ "@getpara/core-sdk": "2.19.0",
8
+ "@getpara/react-core": "2.19.0",
9
+ "@getpara/user-management-client": "2.19.0",
10
+ "@getpara/viem-v2-integration": "2.19.0",
11
+ "@getpara/web-sdk": "2.19.0",
11
12
  "@peculiar/webcrypto": "^1.5.0",
12
13
  "@ungap/structured-clone": "1.3.0",
13
14
  "react-native-url-polyfill": "2.0.0",
15
+ "readable-stream": "^4.5.2",
14
16
  "text-encoding": "0.7.0"
15
17
  },
16
18
  "devDependencies": {
@@ -22,9 +24,10 @@
22
24
  "@types/text-encoding": "0.0.39",
23
25
  "react-native-keychain": "^10.0.0",
24
26
  "react-native-modpow": "^1.1.0",
27
+ "react-native-nitro-modules": "^0.29.1",
25
28
  "react-native-passkey": "^3.1.0",
26
29
  "react-native-quick-base64": "^2.2.0",
27
- "react-native-quick-crypto": "^0.7.14",
30
+ "react-native-quick-crypto": "^1.0.0",
28
31
  "typescript": "^5.8.3"
29
32
  },
30
33
  "exports": {
@@ -45,8 +48,7 @@
45
48
  "android",
46
49
  "cpp",
47
50
  "*.podspec",
48
- "signer.xcframework",
49
- "signer.aar"
51
+ "signer.xcframework"
50
52
  ],
51
53
  "homepage": "https://getpara.com",
52
54
  "main": "./dist/index.js",
@@ -54,14 +56,15 @@
54
56
  "peerDependencies": {
55
57
  "@craftzdog/react-native-buffer": ">=6.0.0",
56
58
  "@react-native-async-storage/async-storage": ">=2.0.0",
59
+ "@tanstack/react-query": ">=5",
57
60
  "react": ">=18",
58
61
  "react-native": ">=0.70.0",
59
62
  "react-native-keychain": ">=8.0.0",
60
63
  "react-native-modpow": ">=1.0.0",
64
+ "react-native-nitro-modules": ">=0.29.1",
61
65
  "react-native-passkey": ">=3.0.0",
62
66
  "react-native-quick-base64": ">=2.0.0",
63
- "react-native-quick-crypto": ">=0.7.0",
64
- "readable-stream": ">=4.0.0"
67
+ "react-native-quick-crypto": ">=1.0.0"
65
68
  },
66
69
  "publishConfig": {
67
70
  "access": "public"
@@ -93,5 +96,5 @@
93
96
  ]
94
97
  }
95
98
  },
96
- "gitHead": "4481f6f4e108e682d14c74d4433696141c47fc58"
99
+ "gitHead": "7dc9400777adb653c0cc28e0d9236424eb384467"
97
100
  }
package/src/index.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  export * from '@getpara/web-sdk';
2
2
  export { ParaMobile } from './react-native/ParaMobile.js';
3
3
 
4
- // Smart Account types, errors, utilities re-exported from viem-v2-integration/aa
5
- export * from '@getpara/viem-v2-integration/aa';
4
+ // Smart Account types type-only re-export so Metro doesn't bundle viem for non-AA users
5
+ export type * from '@getpara/viem-v2-integration/aa';
6
+
7
+ // React Native provider (wraps ParaProviderCore with AsyncStorage persistence)
8
+ export * from './provider/index.js';
9
+
10
+ // Core provider hooks and config types — platform-agnostic, work with any ParaCore subclass
11
+ export * from '@getpara/react-core';
@@ -0,0 +1,51 @@
1
+ import { useMemo } from 'react';
2
+ import {
3
+ ParaProviderCore,
4
+ type ParaProviderCoreProps,
5
+ type ParaClientConfig,
6
+ type ParaClientConfigWithFactory,
7
+ } from '@getpara/react-core/internal';
8
+ import { asyncStorageAdapter } from './asyncStorageAdapter.js';
9
+ import { ParaMobile } from '../react-native/ParaMobile.js';
10
+
11
+ /**
12
+ * RN provider props. Same as ParaProviderCoreProps but:
13
+ * - Defaults to ParaMobile
14
+ * - paraClientConfig accepts a simple { apiKey, env?, opts? } config (no createClient needed)
15
+ * - storageAdapter defaults to AsyncStorage
16
+ * - Omits configureClient, waitForReady, store (internal concerns)
17
+ */
18
+ export type ParaProviderProps = Omit<
19
+ ParaProviderCoreProps<ParaMobile>,
20
+ 'paraClientConfig' | 'configureClient' | 'waitForReady' | 'store'
21
+ > & {
22
+ /** A pre-instantiated ParaMobile, or a config with apiKey + optional env/opts. */
23
+ paraClientConfig: ParaMobile | ParaClientConfig;
24
+ };
25
+
26
+ /**
27
+ * React Native Para provider. Wraps ParaProviderCore with AsyncStorage-backed
28
+ * persistence by default. Accepts either a ParaMobile instance or a simple
29
+ * `{ apiKey, env?, opts? }` config — the provider creates the client internally.
30
+ */
31
+ export function ParaProvider({
32
+ children,
33
+ paraClientConfig: paraClientInput,
34
+ config,
35
+ callbacks,
36
+ storageAdapter = asyncStorageAdapter,
37
+ }: ParaProviderProps) {
38
+ const coreInput = useMemo<ParaMobile | ParaClientConfigWithFactory<ParaMobile>>(() => {
39
+ if (paraClientInput instanceof ParaMobile) return paraClientInput;
40
+ return {
41
+ ...paraClientInput,
42
+ createClient: (apiKey, env, opts) => new ParaMobile(apiKey, env, opts),
43
+ };
44
+ }, [paraClientInput]);
45
+
46
+ return (
47
+ <ParaProviderCore paraClientConfig={coreInput} config={config} callbacks={callbacks} storageAdapter={storageAdapter}>
48
+ {children}
49
+ </ParaProviderCore>
50
+ );
51
+ }
@@ -0,0 +1,31 @@
1
+ import type { ParaStorageAdapter } from '@getpara/react-core';
2
+ import RNAsyncStorage from '@react-native-async-storage/async-storage';
3
+
4
+ /**
5
+ * ParaStorageAdapter backed by React Native AsyncStorage.
6
+ * Used by the core Zustand store for state persistence.
7
+ */
8
+ export const asyncStorageAdapter: ParaStorageAdapter = {
9
+ getItem: async (key: string) => {
10
+ try {
11
+ return await RNAsyncStorage.getItem(key);
12
+ } catch (error) {
13
+ console.warn('[Para] Error reading from AsyncStorage:', error);
14
+ return null;
15
+ }
16
+ },
17
+ setItem: async (key: string, value: string) => {
18
+ try {
19
+ await RNAsyncStorage.setItem(key, value);
20
+ } catch (error) {
21
+ console.warn(`[Para] Error writing to AsyncStorage (key: ${key}):`, error);
22
+ }
23
+ },
24
+ removeItem: async (key: string) => {
25
+ try {
26
+ await RNAsyncStorage.removeItem(key);
27
+ } catch (error) {
28
+ console.warn(`[Para] Error removing from AsyncStorage (key: ${key}):`, error);
29
+ }
30
+ },
31
+ };
@@ -0,0 +1,2 @@
1
+ export { ParaProvider, type ParaProviderProps } from './ParaProvider.js';
2
+ export { asyncStorageAdapter } from './asyncStorageAdapter.js';
@@ -26,7 +26,6 @@ import {
26
26
  import { CurrentWalletIds, AuthMethodStatus, TWalletScheme } from '@getpara/user-management-client';
27
27
  import { setEnv } from '../config.js';
28
28
  import base64url from 'base64url';
29
- import { webcrypto } from 'crypto';
30
29
 
31
30
  const ES256_ALGORITHM = -7;
32
31
  const RS256_ALGORITHM = -257;
@@ -159,11 +158,11 @@ export class ParaMobile extends ParaCore {
159
158
  const userId = this.assertUserId();
160
159
  const authInfo = this.assertIsAuthSet();
161
160
 
162
- if (!webcrypto || !webcrypto.getRandomValues) {
161
+ if (!globalThis.crypto || !globalThis.crypto.getRandomValues) {
163
162
  throw new Error('Web crypto is not available. Ensure you have imported the shim from @getpara/react-native-wallet.');
164
163
  }
165
164
  const userHandle = new Uint8Array(32);
166
- webcrypto.getRandomValues(userHandle);
165
+ globalThis.crypto.getRandomValues(userHandle);
167
166
  const userHandleEncoded = base64url.encode(userHandle as any);
168
167
 
169
168
  const requestJson: PasskeyCreateRequest = {
@@ -1,6 +1,4 @@
1
- import { PlatformUtils, TPregenIdentifierType, EventHandler, EventData } from '@getpara/web-sdk';
2
- import { Ctx } from '@getpara/web-sdk';
3
- import { SignatureRes } from '@getpara/web-sdk';
1
+ import type { PlatformUtils, TPregenIdentifierType, EventHandler, EventData, Ctx, SignatureRes } from '@getpara/web-sdk';
4
2
  import { BackupKitEmailProps, KeyShareType, TWalletType, SDKType } from '@getpara/user-management-client';
5
3
  import { NativeModules } from 'react-native';
6
4
 
package/src/shim.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import quickCrypto from 'react-native-quick-crypto';
2
- import { webcrypto } from 'crypto';
3
2
  import { Crypto as PeculiarCrypto } from '@peculiar/webcrypto';
4
3
  import { ec as EllipticEC } from 'elliptic';
5
4
  import Forge from 'node-forge';
@@ -281,8 +280,25 @@ const ensureParaCrypto = () => {
281
280
  const setupCryptoPolyfills = () => {
282
281
  const { peculiarCrypto } = ensureParaCrypto();
283
282
 
284
- if (webcrypto && typeof webcrypto === 'object') {
285
- webcrypto.getRandomValues = peculiarCrypto.getRandomValues.bind(peculiarCrypto);
283
+ // Ensure `import { webcrypto } from 'crypto'` works regardless of quick-crypto version.
284
+ // quick-crypto 1.x (Nitro) removed the webcrypto export that 0.7.x had.
285
+ try {
286
+ const cryptoModule = require('crypto');
287
+ if (!cryptoModule.webcrypto || typeof cryptoModule.webcrypto !== 'object') {
288
+ Object.defineProperty(cryptoModule, 'webcrypto', {
289
+ get() {
290
+ return globalThis.crypto;
291
+ },
292
+ configurable: true,
293
+ enumerable: true,
294
+ });
295
+ }
296
+ if (cryptoModule.webcrypto && typeof cryptoModule.webcrypto === 'object') {
297
+ cryptoModule.webcrypto.getRandomValues = peculiarCrypto.getRandomValues.bind(peculiarCrypto);
298
+ }
299
+ // eslint-disable-next-line no-unused-vars
300
+ } catch (_err) {
301
+ // crypto module not available
286
302
  }
287
303
 
288
304
  if (typeof Forge === 'undefined') {