@getpara/react-native-wallet 1.0.2-dev.8 → 1.0.2-dev.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/dist/shim.js +88 -0
- package/package.json +5 -18
- package/src/shim.js +86 -52
- package/dist/cjs/AsyncStorage.js +0 -47
- package/dist/cjs/KeychainStorage.js +0 -78
- package/dist/cjs/config.js +0 -65
- package/dist/cjs/index.js +0 -20
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/react-native/ParaMobile.js +0 -258
- package/dist/cjs/react-native/ReactNativeUtils.js +0 -174
- package/dist/cjs/shim.js +0 -79
- package/dist/esm/AsyncStorage.d.ts +0 -10
- package/dist/esm/KeychainStorage.d.ts +0 -10
- package/dist/esm/config.d.ts +0 -7
- package/dist/esm/index.d.ts +0 -2
- package/dist/esm/package.json +0 -1
- package/dist/esm/react-native/ParaMobile.d.ts +0 -52
- package/dist/esm/react-native/ReactNativeUtils.d.ts +0 -50
- package/dist/esm/shim.d.ts +0 -1
- package/dist/esm/shim.js +0 -51
- package/dist/types/AsyncStorage.d.ts +0 -10
- package/dist/types/KeychainStorage.d.ts +0 -10
- package/dist/types/config.d.ts +0 -7
- package/dist/types/index.d.ts +0 -2
- package/dist/types/react-native/ParaMobile.d.ts +0 -52
- package/dist/types/react-native/ReactNativeUtils.d.ts +0 -50
- package/dist/types/shim.d.ts +0 -1
- /package/dist/{cjs/AsyncStorage.d.ts → AsyncStorage.d.ts} +0 -0
- /package/dist/{esm/AsyncStorage.js → AsyncStorage.js} +0 -0
- /package/dist/{cjs/KeychainStorage.d.ts → KeychainStorage.d.ts} +0 -0
- /package/dist/{esm/KeychainStorage.js → KeychainStorage.js} +0 -0
- /package/dist/{cjs/config.d.ts → config.d.ts} +0 -0
- /package/dist/{esm/config.js → config.js} +0 -0
- /package/dist/{cjs/index.d.ts → index.d.ts} +0 -0
- /package/dist/{esm/index.js → index.js} +0 -0
- /package/dist/{cjs/react-native → react-native}/ParaMobile.d.ts +0 -0
- /package/dist/{esm/react-native → react-native}/ParaMobile.js +0 -0
- /package/dist/{cjs/react-native → react-native}/ReactNativeUtils.d.ts +0 -0
- /package/dist/{esm/react-native → react-native}/ReactNativeUtils.js +0 -0
- /package/dist/{cjs/shim.d.ts → shim.d.ts} +0 -0
package/dist/esm/shim.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// 1) Node-like crypto + Web Crypto API (subtle + getRandomValues)
|
|
2
|
-
import crypto from 'react-native-quick-crypto';
|
|
3
|
-
import { webcrypto } from 'crypto';
|
|
4
|
-
import { Crypto } from '@peculiar/webcrypto';
|
|
5
|
-
if (typeof global.crypto === 'undefined') {
|
|
6
|
-
// Attach Node-style crypto for randomFillSync, createHash, etc.
|
|
7
|
-
global.crypto = crypto;
|
|
8
|
-
}
|
|
9
|
-
// If `crypto.subtle` is missing, patch it with `@peculiar/webcrypto`
|
|
10
|
-
if (!global.crypto.subtle) {
|
|
11
|
-
const peculiarCrypto = new Crypto();
|
|
12
|
-
global.crypto.subtle = peculiarCrypto.subtle;
|
|
13
|
-
global.crypto.getRandomValues = peculiarCrypto.getRandomValues.bind(peculiarCrypto);
|
|
14
|
-
}
|
|
15
|
-
// Add getRandomValues to webcrypto from peculiar
|
|
16
|
-
const peculiarCrypto = new Crypto();
|
|
17
|
-
webcrypto.getRandomValues = peculiarCrypto.getRandomValues.bind(peculiarCrypto);
|
|
18
|
-
// 2) Provide TextEncoder / TextDecoder
|
|
19
|
-
import * as FSTED from 'fastestsmallesttextencoderdecoder';
|
|
20
|
-
if (typeof global.TextEncoder === 'undefined') {
|
|
21
|
-
global.TextEncoder = FSTED.TextEncoder;
|
|
22
|
-
}
|
|
23
|
-
if (typeof global.TextDecoder === 'undefined') {
|
|
24
|
-
global.TextDecoder = FSTED.TextDecoder;
|
|
25
|
-
}
|
|
26
|
-
// 3) Provide atob / btoa via react-native-quick-base64
|
|
27
|
-
import { atob, btoa } from 'react-native-quick-base64';
|
|
28
|
-
if (typeof global.atob === 'undefined') {
|
|
29
|
-
global.atob = atob;
|
|
30
|
-
}
|
|
31
|
-
if (typeof global.btoa === 'undefined') {
|
|
32
|
-
global.btoa = btoa;
|
|
33
|
-
}
|
|
34
|
-
// 4) Patch node-forge with react-native-modpow for faster RSA ops
|
|
35
|
-
import Forge from 'node-forge';
|
|
36
|
-
import modPow from 'react-native-modpow';
|
|
37
|
-
Forge.jsbn.BigInteger.prototype.modPow = function nativeModPow(e, m) {
|
|
38
|
-
const result = modPow({
|
|
39
|
-
target: this.toString(16),
|
|
40
|
-
value: e.toString(16),
|
|
41
|
-
modifier: m.toString(16),
|
|
42
|
-
});
|
|
43
|
-
return new Forge.jsbn.BigInteger(result, 16);
|
|
44
|
-
};
|
|
45
|
-
// 5) Provide global Buffer
|
|
46
|
-
import { Buffer } from '@craftzdog/react-native-buffer';
|
|
47
|
-
if (typeof global.Buffer === 'undefined') {
|
|
48
|
-
global.Buffer = Buffer;
|
|
49
|
-
}
|
|
50
|
-
// 6) React Native URL polyfill
|
|
51
|
-
import 'react-native-url-polyfill/auto';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { StorageUtils } from '@getpara/web-sdk';
|
|
2
|
-
/**
|
|
3
|
-
* Implements `StorageUtils` using React Native Async Storage.
|
|
4
|
-
*/
|
|
5
|
-
export declare class AsyncStorage implements StorageUtils {
|
|
6
|
-
clear(prefix: string): Promise<void>;
|
|
7
|
-
get(key: string): Promise<string | null>;
|
|
8
|
-
removeItem(key: string): Promise<void>;
|
|
9
|
-
set(key: string, value: string): Promise<void>;
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { StorageUtils } from '@getpara/web-sdk';
|
|
2
|
-
/**
|
|
3
|
-
* Implements `StorageUtils` using React Native `Keychain`.
|
|
4
|
-
*/
|
|
5
|
-
export declare class KeychainStorage implements StorageUtils {
|
|
6
|
-
get(key: string): Promise<string | null>;
|
|
7
|
-
set(key: string, value: string): Promise<void>;
|
|
8
|
-
removeItem(key: string): Promise<void>;
|
|
9
|
-
clear(prefix: string): Promise<void>;
|
|
10
|
-
}
|
package/dist/types/config.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Environment } from '@getpara/web-sdk';
|
|
2
|
-
export declare function getBaseMPCNetworkWSUrl(env: Environment): string;
|
|
3
|
-
export declare let userManagementServer: string;
|
|
4
|
-
export declare let portalBase: string;
|
|
5
|
-
export declare let mpcNetworkWSServer: string;
|
|
6
|
-
export declare function setEnv(env: Environment): void;
|
|
7
|
-
export declare const DEBUG_MODE_ENABLED = false;
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { ConstructorOpts, ParaCore, Environment, PlatformUtils } from '@getpara/web-sdk';
|
|
2
|
-
import { Auth } from '@getpara/user-management-client';
|
|
3
|
-
/**
|
|
4
|
-
* Represents a mobile implementation of the Para SDK.
|
|
5
|
-
* @extends ParaCore
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* const para = new ParaMobile(Environment.BETA, "api_key");
|
|
9
|
-
*/
|
|
10
|
-
export declare class ParaMobile extends ParaCore {
|
|
11
|
-
private relyingPartyId;
|
|
12
|
-
/**
|
|
13
|
-
* Creates an instance of ParaMobile.
|
|
14
|
-
* @param {Environment} env - The environment to use (DEV, SANDBOX, BETA, or PROD).
|
|
15
|
-
* @param {string} [apiKey] - The API key for authentication.
|
|
16
|
-
* @param {string} [relyingPartyId] - The relying party ID for WebAuthn.
|
|
17
|
-
* @param {ConstructorOpts} [opts] - Additional constructor options.
|
|
18
|
-
*/
|
|
19
|
-
constructor(env: Environment, apiKey?: string, relyingPartyId?: string, opts?: ConstructorOpts);
|
|
20
|
-
protected getPlatformUtils(): PlatformUtils;
|
|
21
|
-
/**
|
|
22
|
-
* Verifies an email and returns the biometrics ID.
|
|
23
|
-
* @param {string} verificationCode - The verification code sent to the email.
|
|
24
|
-
* @returns {Promise<string>} The biometrics ID.
|
|
25
|
-
*/
|
|
26
|
-
verifyEmailBiometricsId({ verificationCode }: {
|
|
27
|
-
verificationCode: string;
|
|
28
|
-
}): Promise<string>;
|
|
29
|
-
/**
|
|
30
|
-
* Verifies a phone number and returns the biometrics ID.
|
|
31
|
-
* @param {string} verificationCode - The verification code sent to the phone.
|
|
32
|
-
* @returns {Promise<string>} The biometrics ID.
|
|
33
|
-
*/
|
|
34
|
-
verifyPhoneBiometricsId({ verificationCode }: {
|
|
35
|
-
verificationCode: string;
|
|
36
|
-
}): Promise<string>;
|
|
37
|
-
/**
|
|
38
|
-
* Registers a passkey for the user.
|
|
39
|
-
* @param {Auth<'email'> | Auth<'phone'>} auth - The user's authentication details
|
|
40
|
-
* @param {string} biometricsId - The biometrics ID obtained from verification.
|
|
41
|
-
* @returns {Promise<void>}
|
|
42
|
-
*/
|
|
43
|
-
registerPasskey({ biometricsId, ...auth }: {
|
|
44
|
-
biometricsId: string;
|
|
45
|
-
} & (Auth<'email'> | Auth<'phone'>)): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* Logs in the user using their authentication credentials.
|
|
48
|
-
* @param {AuthParams} params - The authentication parameters.
|
|
49
|
-
* @returns {Promise<void>}
|
|
50
|
-
*/
|
|
51
|
-
login({ ...auth }: Auth<'email'> | Auth<'phone'>): Promise<void>;
|
|
52
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { PlatformUtils, TPregenIdentifierType } from '@getpara/web-sdk';
|
|
2
|
-
import { Ctx } from '@getpara/web-sdk';
|
|
3
|
-
import { SignatureRes } from '@getpara/web-sdk';
|
|
4
|
-
import { BackupKitEmailProps, WalletType } from '@getpara/user-management-client';
|
|
5
|
-
import { AsyncStorage } from '../AsyncStorage.js';
|
|
6
|
-
import { KeychainStorage } from '../KeychainStorage.js';
|
|
7
|
-
export declare class ReactNativeUtils implements PlatformUtils {
|
|
8
|
-
disableProviderModal?: boolean | undefined;
|
|
9
|
-
localStorage: AsyncStorage;
|
|
10
|
-
sessionStorage: AsyncStorage;
|
|
11
|
-
secureStorage: KeychainStorage;
|
|
12
|
-
isSyncStorage: boolean;
|
|
13
|
-
generateBlumPrimes(_ctx: Ctx): Promise<{
|
|
14
|
-
p: string;
|
|
15
|
-
q: string;
|
|
16
|
-
}>;
|
|
17
|
-
keygen(ctx: Ctx, userId: string, type: Exclude<WalletType, WalletType.SOLANA>, _secretKey: string | null, _sessionCookie: string, _emailProps?: BackupKitEmailProps | undefined): Promise<{
|
|
18
|
-
signer: string;
|
|
19
|
-
walletId: string;
|
|
20
|
-
}>;
|
|
21
|
-
refresh(_ctx: Ctx, _sessionCookie: string, _userId: string, _walletId: string, _share: string, _oldPartnerId?: string, _newPartnerId?: string): Promise<{
|
|
22
|
-
signer: string;
|
|
23
|
-
}>;
|
|
24
|
-
preKeygen(_ctx: Ctx, _partnerId: string, _email: string, _secretKey: string | null, _sessionCookie: string): Promise<{
|
|
25
|
-
signer: string;
|
|
26
|
-
walletId: string;
|
|
27
|
-
}>;
|
|
28
|
-
getPrivateKey(_ctx: Ctx, _userId: string, _walletId: string, _share: string, _sessionCookie: string): Promise<string>;
|
|
29
|
-
openPopup(_popupUrl: string): any;
|
|
30
|
-
private baseSignTransaction;
|
|
31
|
-
sendTransaction(ctx: Ctx, userId: string, walletId: string, share: string, rlpEncodedTxBase64: string, chainId: string, _sessionCookie: string, isDKLS?: boolean): Promise<SignatureRes>;
|
|
32
|
-
signHash(_address: string, _hash: string): Promise<{
|
|
33
|
-
v: number;
|
|
34
|
-
r: Buffer;
|
|
35
|
-
s: Buffer;
|
|
36
|
-
}>;
|
|
37
|
-
signMessage(ctx: Ctx, userId: string, walletId: string, share: string, messageBase64: string, // base64 message
|
|
38
|
-
_sessionCookie: string, isDKLS?: boolean): Promise<SignatureRes>;
|
|
39
|
-
signTransaction(ctx: Ctx, userId: string, walletId: string, share: string, rlpEncodedTxBase64: string, // base64 encoding of rlp encoded tx
|
|
40
|
-
chainId: string, _sessionCookie: string, isDKLS?: boolean): Promise<SignatureRes>;
|
|
41
|
-
ed25519Keygen(ctx: Ctx, userId: string, _sessionCookie: string, _emailProps?: BackupKitEmailProps): Promise<{
|
|
42
|
-
signer: string;
|
|
43
|
-
walletId: string;
|
|
44
|
-
}>;
|
|
45
|
-
ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, _sessionCookie: string): Promise<{
|
|
46
|
-
signer: string;
|
|
47
|
-
walletId: string;
|
|
48
|
-
}>;
|
|
49
|
-
ed25519Sign(ctx: Ctx, userId: string, walletId: string, share: string, base64Bytes: string, _sessionCookie: string): Promise<SignatureRes>;
|
|
50
|
-
}
|
package/dist/types/shim.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|