@getpara/react-native-wallet 1.0.2-dev.8 → 1.0.2
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 +68 -0
- package/package.json +12 -24
- package/src/shim.js +64 -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/shim.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import crypto from 'react-native-quick-crypto';
|
|
2
|
+
import { webcrypto } from 'crypto';
|
|
3
|
+
import { Crypto } from '@peculiar/webcrypto';
|
|
4
|
+
import Forge from 'node-forge';
|
|
5
|
+
import modPow from 'react-native-modpow';
|
|
6
|
+
import { atob, btoa } from 'react-native-quick-base64';
|
|
7
|
+
import { Buffer } from '@craftzdog/react-native-buffer';
|
|
8
|
+
import process from 'process';
|
|
9
|
+
import 'react-native-url-polyfill/auto';
|
|
10
|
+
import { TextEncoder, TextDecoder } from 'text-encoding';
|
|
11
|
+
const setupProcessPolyfill = () => {
|
|
12
|
+
if (typeof globalThis.process === 'undefined') {
|
|
13
|
+
globalThis.process = process;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const setupBufferPolyfill = () => {
|
|
17
|
+
if (typeof globalThis.Buffer === 'undefined') {
|
|
18
|
+
globalThis.Buffer = Buffer;
|
|
19
|
+
}
|
|
20
|
+
if (typeof globalThis.Buffer !== 'function') {
|
|
21
|
+
throw new Error('Buffer polyfill failed to initialize');
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const setupBase64Polyfills = () => {
|
|
25
|
+
if (typeof globalThis.atob === 'undefined') {
|
|
26
|
+
globalThis.atob = atob;
|
|
27
|
+
}
|
|
28
|
+
if (typeof globalThis.btoa === 'undefined') {
|
|
29
|
+
globalThis.btoa = btoa;
|
|
30
|
+
}
|
|
31
|
+
if (typeof globalThis.atob !== 'function' || typeof globalThis.btoa !== 'function') {
|
|
32
|
+
throw new Error('Base64 polyfills failed to initialize');
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const setupCryptoPolyfills = () => {
|
|
36
|
+
const peculiarCrypto = new Crypto();
|
|
37
|
+
if (typeof globalThis.crypto === 'undefined') {
|
|
38
|
+
globalThis.crypto = crypto;
|
|
39
|
+
}
|
|
40
|
+
if (!globalThis.crypto.subtle) {
|
|
41
|
+
globalThis.crypto.subtle = peculiarCrypto.subtle;
|
|
42
|
+
globalThis.crypto.getRandomValues = peculiarCrypto.getRandomValues.bind(peculiarCrypto);
|
|
43
|
+
}
|
|
44
|
+
webcrypto.getRandomValues = peculiarCrypto.getRandomValues.bind(peculiarCrypto);
|
|
45
|
+
if (typeof Forge === 'undefined') {
|
|
46
|
+
throw new Error('node-forge not loaded');
|
|
47
|
+
}
|
|
48
|
+
if (!Forge.jsbn || !Forge.jsbn.BigInteger) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
Forge.jsbn.BigInteger.prototype.modPow = function (e, m) {
|
|
52
|
+
const result = modPow({
|
|
53
|
+
target: this.toString(16),
|
|
54
|
+
value: e.toString(16),
|
|
55
|
+
modifier: m.toString(16),
|
|
56
|
+
});
|
|
57
|
+
return new Forge.jsbn.BigInteger(result, 16);
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
const setupTextEncodingPolyfills = () => {
|
|
61
|
+
globalThis.TextEncoder = TextEncoder;
|
|
62
|
+
globalThis.TextDecoder = TextDecoder;
|
|
63
|
+
};
|
|
64
|
+
setupProcessPolyfill();
|
|
65
|
+
setupBufferPolyfill();
|
|
66
|
+
setupBase64Polyfills();
|
|
67
|
+
setupCryptoPolyfills();
|
|
68
|
+
setupTextEncodingPolyfills();
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-native-wallet",
|
|
3
|
-
"version": "1.0.2
|
|
3
|
+
"version": "1.0.2",
|
|
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)",
|
|
7
|
-
"main": "dist/
|
|
8
|
-
"module": "dist/
|
|
9
|
-
"types": "dist/
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
12
|
"src",
|
|
@@ -17,31 +17,18 @@
|
|
|
17
17
|
"signer.xcframework",
|
|
18
18
|
"signer.aar"
|
|
19
19
|
],
|
|
20
|
-
"exports": {
|
|
21
|
-
".": {
|
|
22
|
-
"react-native": "./dist/cjs/index.js",
|
|
23
|
-
"default": "./dist/esm/index.js"
|
|
24
|
-
},
|
|
25
|
-
"./shim": {
|
|
26
|
-
"react-native": "./dist/cjs/shim.js",
|
|
27
|
-
"default": "./dist/esm/shim.js"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
20
|
"scripts": {
|
|
31
|
-
"build": "
|
|
32
|
-
"build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
33
|
-
"build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && echo '{\"type\":\"module\"}' > dist/esm/package.json",
|
|
34
|
-
"build:types": "rm -rf dist/types && tsc --module es6 --declarationDir dist/types --emitDeclarationOnly --declaration",
|
|
21
|
+
"build": "rm -rf dist && tsc",
|
|
35
22
|
"compile-signer": "bash ./scripts/compileSigner.sh"
|
|
36
23
|
},
|
|
37
24
|
"dependencies": {
|
|
38
|
-
"@getpara/core-sdk": "1.0.
|
|
39
|
-
"@getpara/user-management-client": "1.0.
|
|
40
|
-
"@getpara/web-sdk": "1.0.
|
|
25
|
+
"@getpara/core-sdk": "1.0.2",
|
|
26
|
+
"@getpara/user-management-client": "1.0.2",
|
|
27
|
+
"@getpara/web-sdk": "1.0.2",
|
|
41
28
|
"@peculiar/webcrypto": "^1.5.0",
|
|
42
|
-
"fastestsmallesttextencoderdecoder": "1.0.22",
|
|
43
29
|
"node-forge": "1.3.1",
|
|
44
|
-
"react-native-url-polyfill": "2.0.0"
|
|
30
|
+
"react-native-url-polyfill": "2.0.0",
|
|
31
|
+
"text-encoding": "0.7.0"
|
|
45
32
|
},
|
|
46
33
|
"devDependencies": {
|
|
47
34
|
"@craftzdog/react-native-buffer": "6.0.5",
|
|
@@ -71,5 +58,6 @@
|
|
|
71
58
|
},
|
|
72
59
|
"publishConfig": {
|
|
73
60
|
"access": "public"
|
|
74
|
-
}
|
|
61
|
+
},
|
|
62
|
+
"gitHead": "b52cb28fc10a5fda8c49747e98b512d680b5ded0"
|
|
75
63
|
}
|
package/src/shim.js
CHANGED
|
@@ -1,62 +1,74 @@
|
|
|
1
|
-
// 1) Node-like crypto + Web Crypto API (subtle + getRandomValues)
|
|
2
1
|
import crypto from 'react-native-quick-crypto';
|
|
3
2
|
import { webcrypto } from 'crypto';
|
|
4
3
|
import { Crypto } from '@peculiar/webcrypto';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// Attach Node-style crypto for randomFillSync, createHash, etc.
|
|
8
|
-
global.crypto = crypto;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// If `crypto.subtle` is missing, patch it with `@peculiar/webcrypto`
|
|
12
|
-
if (!global.crypto.subtle) {
|
|
13
|
-
const peculiarCrypto = new Crypto();
|
|
14
|
-
global.crypto.subtle = peculiarCrypto.subtle;
|
|
15
|
-
global.crypto.getRandomValues = peculiarCrypto.getRandomValues.bind(peculiarCrypto);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Add getRandomValues to webcrypto from peculiar
|
|
19
|
-
const peculiarCrypto = new Crypto();
|
|
20
|
-
webcrypto.getRandomValues = peculiarCrypto.getRandomValues.bind(peculiarCrypto);
|
|
21
|
-
|
|
22
|
-
// 2) Provide TextEncoder / TextDecoder
|
|
23
|
-
import * as FSTED from 'fastestsmallesttextencoderdecoder';
|
|
24
|
-
|
|
25
|
-
if (typeof global.TextEncoder === 'undefined') {
|
|
26
|
-
global.TextEncoder = FSTED.TextEncoder;
|
|
27
|
-
}
|
|
28
|
-
if (typeof global.TextDecoder === 'undefined') {
|
|
29
|
-
global.TextDecoder = FSTED.TextDecoder;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// 3) Provide atob / btoa via react-native-quick-base64
|
|
4
|
+
import Forge from 'node-forge';
|
|
5
|
+
import modPow from 'react-native-modpow';
|
|
33
6
|
import { atob, btoa } from 'react-native-quick-base64';
|
|
7
|
+
import { Buffer } from '@craftzdog/react-native-buffer';
|
|
8
|
+
import process from 'process';
|
|
9
|
+
import 'react-native-url-polyfill/auto';
|
|
10
|
+
import { TextEncoder, TextDecoder } from 'text-encoding';
|
|
34
11
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
12
|
+
const setupProcessPolyfill = () => {
|
|
13
|
+
if (typeof globalThis.process === 'undefined') {
|
|
14
|
+
globalThis.process = process;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
41
17
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
18
|
+
const setupBufferPolyfill = () => {
|
|
19
|
+
if (typeof globalThis.Buffer === 'undefined') {
|
|
20
|
+
globalThis.Buffer = Buffer;
|
|
21
|
+
}
|
|
22
|
+
if (typeof globalThis.Buffer !== 'function') {
|
|
23
|
+
throw new Error('Buffer polyfill failed to initialize');
|
|
24
|
+
}
|
|
25
|
+
};
|
|
45
26
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
27
|
+
const setupBase64Polyfills = () => {
|
|
28
|
+
if (typeof globalThis.atob === 'undefined') {
|
|
29
|
+
globalThis.atob = atob;
|
|
30
|
+
}
|
|
31
|
+
if (typeof globalThis.btoa === 'undefined') {
|
|
32
|
+
globalThis.btoa = btoa;
|
|
33
|
+
}
|
|
34
|
+
if (typeof globalThis.atob !== 'function' || typeof globalThis.btoa !== 'function') {
|
|
35
|
+
throw new Error('Base64 polyfills failed to initialize');
|
|
36
|
+
}
|
|
53
37
|
};
|
|
54
38
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (typeof
|
|
58
|
-
|
|
59
|
-
}
|
|
39
|
+
const setupCryptoPolyfills = () => {
|
|
40
|
+
const peculiarCrypto = new Crypto();
|
|
41
|
+
if (typeof globalThis.crypto === 'undefined') {
|
|
42
|
+
globalThis.crypto = crypto;
|
|
43
|
+
}
|
|
44
|
+
if (!globalThis.crypto.subtle) {
|
|
45
|
+
globalThis.crypto.subtle = peculiarCrypto.subtle;
|
|
46
|
+
globalThis.crypto.getRandomValues = peculiarCrypto.getRandomValues.bind(peculiarCrypto);
|
|
47
|
+
}
|
|
48
|
+
webcrypto.getRandomValues = peculiarCrypto.getRandomValues.bind(peculiarCrypto);
|
|
49
|
+
if (typeof Forge === 'undefined') {
|
|
50
|
+
throw new Error('node-forge not loaded');
|
|
51
|
+
}
|
|
52
|
+
if (!Forge.jsbn || !Forge.jsbn.BigInteger) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
Forge.jsbn.BigInteger.prototype.modPow = function (e, m) {
|
|
56
|
+
const result = modPow({
|
|
57
|
+
target: this.toString(16),
|
|
58
|
+
value: e.toString(16),
|
|
59
|
+
modifier: m.toString(16),
|
|
60
|
+
});
|
|
61
|
+
return new Forge.jsbn.BigInteger(result, 16);
|
|
62
|
+
};
|
|
63
|
+
};
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
const setupTextEncodingPolyfills = () => {
|
|
66
|
+
globalThis.TextEncoder = TextEncoder;
|
|
67
|
+
globalThis.TextDecoder = TextDecoder;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
setupProcessPolyfill();
|
|
71
|
+
setupBufferPolyfill();
|
|
72
|
+
setupBase64Polyfills();
|
|
73
|
+
setupCryptoPolyfills();
|
|
74
|
+
setupTextEncodingPolyfills();
|
package/dist/cjs/AsyncStorage.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.AsyncStorage = void 0;
|
|
16
|
-
const async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
|
|
17
|
-
/**
|
|
18
|
-
* Implements `StorageUtils` using React Native Async Storage.
|
|
19
|
-
*/
|
|
20
|
-
class AsyncStorage {
|
|
21
|
-
clear(prefix) {
|
|
22
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const keys = yield async_storage_1.default.getAllKeys();
|
|
24
|
-
for (const key of keys) {
|
|
25
|
-
if (key.startsWith(prefix)) {
|
|
26
|
-
yield async_storage_1.default.removeItem(key);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
get(key) {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
return async_storage_1.default.getItem(key);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
removeItem(key) {
|
|
37
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
yield async_storage_1.default.removeItem(key);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
set(key, value) {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
yield async_storage_1.default.setItem(key, value);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.AsyncStorage = AsyncStorage;
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.KeychainStorage = void 0;
|
|
16
|
-
const react_native_keychain_1 = __importDefault(require("react-native-keychain"));
|
|
17
|
-
const USERNAME = '@CAPSULE';
|
|
18
|
-
const KEYCHAIN_USER_CANCELLED_ERRORS = [
|
|
19
|
-
'user canceled the operation',
|
|
20
|
-
'error: code: 13, msg: cancel',
|
|
21
|
-
'error: code: 10, msg: fingerprint operation canceled by the user',
|
|
22
|
-
];
|
|
23
|
-
function isUserCancelledError(error) {
|
|
24
|
-
return KEYCHAIN_USER_CANCELLED_ERRORS.some(userCancelledError => error.toString().toLowerCase().includes(userCancelledError));
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Implements `StorageUtils` using React Native `Keychain`.
|
|
28
|
-
*/
|
|
29
|
-
class KeychainStorage {
|
|
30
|
-
get(key) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
try {
|
|
33
|
-
const item = yield react_native_keychain_1.default.getGenericPassword({
|
|
34
|
-
service: key,
|
|
35
|
-
});
|
|
36
|
-
if (!item) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
return item.password;
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
if (error instanceof Error && !isUserCancelledError(error)) {
|
|
43
|
-
// triggered when biometry verification fails and user cancels the action
|
|
44
|
-
throw new Error('Error retrieving stored item ' + error.message);
|
|
45
|
-
}
|
|
46
|
-
throw error;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
set(key, value) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const result = yield react_native_keychain_1.default.setGenericPassword(USERNAME, value, {
|
|
53
|
-
service: key,
|
|
54
|
-
accessible: react_native_keychain_1.default.ACCESSIBLE.AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY,
|
|
55
|
-
securityLevel: react_native_keychain_1.default.SECURITY_LEVEL.ANY,
|
|
56
|
-
});
|
|
57
|
-
if (!result) {
|
|
58
|
-
throw new Error('Failed to store key ' + key);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
removeItem(key) {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
yield react_native_keychain_1.default.resetGenericPassword({ service: key });
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
clear(prefix) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const services = yield react_native_keychain_1.default.getAllGenericPasswordServices();
|
|
70
|
-
for (const key of services) {
|
|
71
|
-
if (key && key.startsWith(prefix)) {
|
|
72
|
-
yield react_native_keychain_1.default.resetGenericPassword({ service: key });
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.KeychainStorage = KeychainStorage;
|
package/dist/cjs/config.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEBUG_MODE_ENABLED = exports.mpcNetworkWSServer = exports.portalBase = exports.userManagementServer = void 0;
|
|
4
|
-
exports.getBaseMPCNetworkWSUrl = getBaseMPCNetworkWSUrl;
|
|
5
|
-
exports.setEnv = setEnv;
|
|
6
|
-
const react_native_1 = require("react-native");
|
|
7
|
-
const web_sdk_1 = require("@getpara/web-sdk");
|
|
8
|
-
function getPortalBaseURL(env) {
|
|
9
|
-
switch (env) {
|
|
10
|
-
case web_sdk_1.Environment.DEV:
|
|
11
|
-
return 'http://localhost:3003';
|
|
12
|
-
case web_sdk_1.Environment.SANDBOX:
|
|
13
|
-
return 'https://app.sandbox.usecapsule.com';
|
|
14
|
-
case web_sdk_1.Environment.BETA:
|
|
15
|
-
return 'https://app.beta.usecapsule.com';
|
|
16
|
-
case web_sdk_1.Environment.PROD:
|
|
17
|
-
return 'https://app.usecapsule.com';
|
|
18
|
-
default:
|
|
19
|
-
throw new Error(`env: ${env} not supported`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function getBaseUrl(env) {
|
|
23
|
-
switch (env) {
|
|
24
|
-
case web_sdk_1.Environment.DEV:
|
|
25
|
-
return 'http://localhost:8080/';
|
|
26
|
-
case web_sdk_1.Environment.SANDBOX:
|
|
27
|
-
return 'https://api.sandbox.getpara.com/';
|
|
28
|
-
case web_sdk_1.Environment.BETA:
|
|
29
|
-
return 'https://api.beta.getpara.com/';
|
|
30
|
-
case web_sdk_1.Environment.PROD:
|
|
31
|
-
return 'https://api.getpara.com/';
|
|
32
|
-
default:
|
|
33
|
-
throw new Error(`unsupported env: ${env}`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function getBaseMPCNetworkWSUrl(env) {
|
|
37
|
-
switch (env) {
|
|
38
|
-
case web_sdk_1.Environment.DEV:
|
|
39
|
-
return `ws://localhost:3000`;
|
|
40
|
-
case web_sdk_1.Environment.SANDBOX:
|
|
41
|
-
return `wss://mpc-network.sandbox.getpara.com`;
|
|
42
|
-
case web_sdk_1.Environment.BETA:
|
|
43
|
-
return `wss://mpc-network.beta.getpara.com`;
|
|
44
|
-
case web_sdk_1.Environment.PROD:
|
|
45
|
-
return `wss://mpc-network.getpara.com`;
|
|
46
|
-
default:
|
|
47
|
-
throw new Error(`unsupported env: ${env}`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.userManagementServer = getBaseUrl(web_sdk_1.Environment.BETA);
|
|
51
|
-
exports.portalBase = getPortalBaseURL(web_sdk_1.Environment.BETA);
|
|
52
|
-
exports.mpcNetworkWSServer = getBaseMPCNetworkWSUrl(web_sdk_1.Environment.BETA);
|
|
53
|
-
function setEnv(env) {
|
|
54
|
-
exports.userManagementServer = getBaseUrl(env);
|
|
55
|
-
exports.portalBase = getPortalBaseURL(env);
|
|
56
|
-
exports.mpcNetworkWSServer = getBaseMPCNetworkWSUrl(env);
|
|
57
|
-
init();
|
|
58
|
-
}
|
|
59
|
-
const { ParaSignerModule } = react_native_1.NativeModules;
|
|
60
|
-
exports.DEBUG_MODE_ENABLED = false;
|
|
61
|
-
function init() {
|
|
62
|
-
ParaSignerModule.setServerUrl(exports.userManagementServer);
|
|
63
|
-
ParaSignerModule.setWsServerUrl(exports.mpcNetworkWSServer);
|
|
64
|
-
}
|
|
65
|
-
init();
|
package/dist/cjs/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ParaMobile = void 0;
|
|
18
|
-
__exportStar(require("@getpara/web-sdk"), exports);
|
|
19
|
-
var ParaMobile_js_1 = require("./react-native/ParaMobile.js");
|
|
20
|
-
Object.defineProperty(exports, "ParaMobile", { enumerable: true, get: function () { return ParaMobile_js_1.ParaMobile; } });
|
package/dist/cjs/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"commonjs"}
|