@getpara/core-sdk 0.1.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.
- package/dist/cjs/ParaCore.js +2600 -0
- package/dist/cjs/PlatformUtils.js +2 -0
- package/dist/cjs/StorageUtils.js +2 -0
- package/dist/cjs/cryptography/utils.js +251 -0
- package/dist/cjs/definitions.js +155 -0
- package/dist/cjs/errors.js +27 -0
- package/dist/cjs/external/mpcComputationClient.js +33 -0
- package/dist/cjs/external/userManagementClient.js +51 -0
- package/dist/cjs/index.js +81 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/shares/KeyContainer.js +84 -0
- package/dist/cjs/shares/recovery.js +62 -0
- package/dist/cjs/shares/shareDistribution.js +67 -0
- package/dist/cjs/transmission/transmissionUtils.js +73 -0
- package/dist/cjs/types/index.js +20 -0
- package/dist/cjs/types/params.js +2 -0
- package/dist/cjs/types/popupTypes.js +12 -0
- package/dist/cjs/types/theme.js +2 -0
- package/dist/cjs/types/walletTypes.js +2 -0
- package/dist/cjs/utils/formattingUtils.js +71 -0
- package/dist/cjs/utils/pollingUtils.js +25 -0
- package/dist/esm/ParaCore.js +2563 -0
- package/dist/esm/PlatformUtils.js +1 -0
- package/dist/esm/StorageUtils.js +1 -0
- package/dist/esm/cryptography/utils.js +226 -0
- package/dist/esm/definitions.js +142 -0
- package/dist/esm/errors.js +21 -0
- package/dist/esm/external/mpcComputationClient.js +26 -0
- package/dist/esm/external/userManagementClient.js +42 -0
- package/dist/esm/index.js +19 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/shares/KeyContainer.js +57 -0
- package/dist/esm/shares/recovery.js +58 -0
- package/dist/esm/shares/shareDistribution.js +63 -0
- package/dist/esm/transmission/transmissionUtils.js +45 -0
- package/dist/esm/types/index.js +4 -0
- package/dist/esm/types/params.js +1 -0
- package/dist/esm/types/popupTypes.js +9 -0
- package/dist/esm/types/theme.js +1 -0
- package/dist/esm/types/walletTypes.js +1 -0
- package/dist/esm/utils/formattingUtils.js +58 -0
- package/dist/esm/utils/pollingUtils.js +21 -0
- package/dist/types/ParaCore.d.ts +1021 -0
- package/dist/types/PlatformUtils.d.ts +48 -0
- package/dist/types/StorageUtils.d.ts +20 -0
- package/dist/types/cryptography/utils.d.ts +51 -0
- package/dist/types/definitions.d.ts +88 -0
- package/dist/types/errors.d.ts +12 -0
- package/dist/types/external/mpcComputationClient.d.ts +2 -0
- package/dist/types/external/userManagementClient.d.ts +13 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/shares/KeyContainer.d.ts +14 -0
- package/dist/types/shares/recovery.d.ts +12 -0
- package/dist/types/shares/shareDistribution.d.ts +12 -0
- package/dist/types/transmission/transmissionUtils.d.ts +3 -0
- package/dist/types/types/index.d.ts +4 -0
- package/dist/types/types/params.d.ts +24 -0
- package/dist/types/types/popupTypes.d.ts +8 -0
- package/dist/types/types/theme.d.ts +12 -0
- package/dist/types/types/walletTypes.d.ts +11 -0
- package/dist/types/utils/formattingUtils.d.ts +16 -0
- package/dist/types/utils/pollingUtils.d.ts +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { BackupKitEmailProps, TPregenIdentifierType, WalletType } from '@getpara/user-management-client';
|
|
3
|
+
import { Ctx } from './definitions.js';
|
|
4
|
+
import { SignatureRes } from './types/walletTypes.js';
|
|
5
|
+
import { StorageUtils } from './StorageUtils.js';
|
|
6
|
+
import { PopupType } from './types/popupTypes.js';
|
|
7
|
+
export interface PlatformUtils {
|
|
8
|
+
getPrivateKey(ctx: Ctx, userId: string, walletId: string, share: string, sessionCookie: string): Promise<string>;
|
|
9
|
+
keygen(ctx: Ctx, userId: string, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
|
|
10
|
+
sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
|
|
11
|
+
signer: string;
|
|
12
|
+
walletId: string;
|
|
13
|
+
}>;
|
|
14
|
+
refresh(ctx: Ctx, sessionCookie: string, userId: string, walletId: string, signer: string, oldPartnerId?: string, newPartnerId?: string, keyShareProtocolId?: string): Promise<{
|
|
15
|
+
signer: string;
|
|
16
|
+
protocolId?: string;
|
|
17
|
+
}>;
|
|
18
|
+
preKeygen(ctx: Ctx, partnerId: string, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, type: Exclude<WalletType, WalletType.SOLANA>, secretKey: string | null, // should be acceptable as null in RN as we don't pre-gen them
|
|
19
|
+
sessionCookie: string): Promise<{
|
|
20
|
+
signer: string;
|
|
21
|
+
walletId: string;
|
|
22
|
+
}>;
|
|
23
|
+
signMessage(ctx: Ctx, userId: string, walletId: string, share: string, message: string, sessionCookie: string, isDKLS?: boolean, cosmosSignDoc?: string): Promise<SignatureRes>;
|
|
24
|
+
signTransaction(ctx: Ctx, userId: string, walletId: string, share: string, tx: string, chainId: string, sessionCookie: string, isDKLS?: boolean): Promise<SignatureRes>;
|
|
25
|
+
sendTransaction(ctx: Ctx, userId: string, walletId: string, share: string, tx: string, chainId: string, sessionCookie: string, isDKLS?: boolean): Promise<SignatureRes>;
|
|
26
|
+
signHash(address: string, hash: string): Promise<{
|
|
27
|
+
v: number;
|
|
28
|
+
r: Buffer;
|
|
29
|
+
s: Buffer;
|
|
30
|
+
}>;
|
|
31
|
+
ed25519Keygen(ctx: Ctx, userId: string, sessionCookie: string, emailProps?: BackupKitEmailProps): Promise<{
|
|
32
|
+
signer: string;
|
|
33
|
+
walletId: string;
|
|
34
|
+
}>;
|
|
35
|
+
ed25519Sign(ctx: Ctx, userId: string, walletId: string, share: string, base64Bytes: string, sessionCookie: string): Promise<SignatureRes>;
|
|
36
|
+
ed25519PreKeygen(ctx: Ctx, pregenIdentifier: string, pregenIdentifierType: TPregenIdentifierType, sessionCookie: string): Promise<{
|
|
37
|
+
signer: string;
|
|
38
|
+
walletId: string;
|
|
39
|
+
}>;
|
|
40
|
+
localStorage: StorageUtils;
|
|
41
|
+
sessionStorage: StorageUtils;
|
|
42
|
+
secureStorage?: StorageUtils;
|
|
43
|
+
isSyncStorage?: boolean;
|
|
44
|
+
disableProviderModal?: boolean;
|
|
45
|
+
openPopup(popupUrl: string, opts?: {
|
|
46
|
+
type: PopupType;
|
|
47
|
+
}): Window;
|
|
48
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface StorageUtils {
|
|
2
|
+
/**
|
|
3
|
+
* Retrieves a stored value.
|
|
4
|
+
*
|
|
5
|
+
* Returns undefined if the key does not exist.
|
|
6
|
+
*/
|
|
7
|
+
get(key: string): Promise<string | null> | string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Stores a value.
|
|
10
|
+
*/
|
|
11
|
+
set(key: string, value?: string): Promise<void> | void;
|
|
12
|
+
/**
|
|
13
|
+
* Removes a single value from storage.
|
|
14
|
+
*/
|
|
15
|
+
removeItem(key: string): Promise<void> | void;
|
|
16
|
+
/**
|
|
17
|
+
* Remove all items from storage that start with `prefix`.
|
|
18
|
+
*/
|
|
19
|
+
clear(prefix: string): Promise<void> | void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import forge from 'node-forge';
|
|
2
|
+
import { Ctx } from '../definitions.js';
|
|
3
|
+
interface EncryptedShare {
|
|
4
|
+
walletId: string;
|
|
5
|
+
walletScheme: string;
|
|
6
|
+
encryptedShare: string;
|
|
7
|
+
encryptedKey: string;
|
|
8
|
+
partnerId?: string;
|
|
9
|
+
protocolId?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function getSHA256HashHex(str: string): string;
|
|
12
|
+
export declare function getPublicKeyHex(keyPair: forge.pki.rsa.KeyPair): string;
|
|
13
|
+
export declare function publicKeyFromHex(publicKeyHex: string): forge.pki.rsa.PublicKey;
|
|
14
|
+
export declare function publicKeyHexToPem(publicKeyHex: string): string;
|
|
15
|
+
export declare function encodePrivateKeyToPemHex(keyPair: forge.pki.rsa.KeyPair): string;
|
|
16
|
+
export declare function decodePrivateKeyPemHex(privateKeyPemHex: string): forge.pki.rsa.PrivateKey;
|
|
17
|
+
export declare function encryptPrivateKey(keyPair: forge.pki.rsa.KeyPair, key: string): Promise<string>;
|
|
18
|
+
export declare function decryptPrivateKey(encryptedPrivateKeyPemHex: string, key: string): Promise<forge.pki.rsa.PrivateKey>;
|
|
19
|
+
export declare function getAsymmetricKeyPair(ctx: Ctx, seedValue?: string): Promise<forge.pki.rsa.KeyPair>;
|
|
20
|
+
export declare function getPublicKeyFromSignature(ctx: Ctx, userHandle: Uint8Array): Promise<string>;
|
|
21
|
+
export declare function symmetricKeyEncryptMessage(message: string): {
|
|
22
|
+
key: string;
|
|
23
|
+
encryptedMessageHex: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function decryptWithKeyPair(keyPair: forge.pki.rsa.KeyPair, encryptedMessageHex: string, encryptedKeyHex: string): string;
|
|
26
|
+
export declare function decryptWithPrivateKey(privateKey: forge.pki.rsa.PrivateKey, encryptedMessageHex: string, encryptedKeyHex: string): string;
|
|
27
|
+
export declare function getDerivedPrivateKeyAndDecrypt(ctx: Ctx, seedValue: string, encryptedShares: EncryptedShare[]): Promise<{
|
|
28
|
+
walletId: string;
|
|
29
|
+
walletScheme: string;
|
|
30
|
+
signer: string;
|
|
31
|
+
partnerId?: string;
|
|
32
|
+
protocolId?: string;
|
|
33
|
+
}[]>;
|
|
34
|
+
export declare function decryptPrivateKeyAndDecryptShare(encryptionKey: string, encryptedShares: EncryptedShare[], encryptedPrivateKey: string): Promise<{
|
|
35
|
+
walletId: string;
|
|
36
|
+
walletScheme: string;
|
|
37
|
+
signer: string;
|
|
38
|
+
partnerId: string;
|
|
39
|
+
protocolId?: string;
|
|
40
|
+
}[]>;
|
|
41
|
+
export declare function encryptWithDerivedPublicKey(publicKeyHex: string, message: string): {
|
|
42
|
+
encryptedMessageHex: string;
|
|
43
|
+
encryptedKeyHex: string;
|
|
44
|
+
};
|
|
45
|
+
export declare function hashPasswordWithSalt(password: string): {
|
|
46
|
+
salt: string;
|
|
47
|
+
hash: string;
|
|
48
|
+
};
|
|
49
|
+
export declare function encryptPrivateKeyWithPassword(keyPair: forge.pki.rsa.KeyPair, hashedPassword: string): Promise<string>;
|
|
50
|
+
export declare function decryptPrivateKeyWithPassword(encryptedPrivateKeyPemHex: string, hashedPassword: string): Promise<forge.pki.rsa.PrivateKey>;
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import Client, { Network, OnRampAsset, OnRampProvider, OnRampPurchase, OnRampPurchaseStatus, OnRampPurchaseType, WalletScheme, WalletType } from '@getpara/user-management-client';
|
|
2
|
+
import { AxiosInstance } from 'axios';
|
|
3
|
+
export { Network, OnRampAsset, OnRampProvider, OnRampPurchaseStatus, type OnRampPurchase };
|
|
4
|
+
export declare const is2FAEnabled = false;
|
|
5
|
+
export declare enum Environment {
|
|
6
|
+
DEV = "DEV",
|
|
7
|
+
SANDBOX = "SANDBOX",
|
|
8
|
+
BETA = "BETA",
|
|
9
|
+
PROD = "PROD",
|
|
10
|
+
DEVELOPMENT = "BETA",
|
|
11
|
+
PRODUCTION = "PROD"
|
|
12
|
+
}
|
|
13
|
+
export interface Ctx {
|
|
14
|
+
env: Environment;
|
|
15
|
+
apiKey?: string;
|
|
16
|
+
client: Client;
|
|
17
|
+
disableWorkers?: boolean;
|
|
18
|
+
offloadMPCComputationURL?: string;
|
|
19
|
+
mpcComputationClient?: AxiosInstance;
|
|
20
|
+
useLocalFiles?: boolean;
|
|
21
|
+
useDKLS?: boolean;
|
|
22
|
+
disableWebSockets: boolean;
|
|
23
|
+
wasmOverride?: ArrayBuffer;
|
|
24
|
+
cosmosPrefix?: string;
|
|
25
|
+
isE2E?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export type deprecated__NetworkProp = keyof typeof Network | Network;
|
|
28
|
+
export type WalletTypeProp = keyof typeof WalletType | WalletType;
|
|
29
|
+
export type WalletSchemeProp = keyof typeof WalletScheme | WalletScheme;
|
|
30
|
+
export type WalletFilters = {
|
|
31
|
+
type?: WalletTypeProp[];
|
|
32
|
+
scheme?: WalletSchemeProp[];
|
|
33
|
+
forbidPregen?: boolean;
|
|
34
|
+
};
|
|
35
|
+
export type deprecated__OnRampProviderProp = keyof typeof OnRampProvider | OnRampProvider;
|
|
36
|
+
export type deprecated__RampConfig = {
|
|
37
|
+
id: deprecated__OnRampProviderProp;
|
|
38
|
+
hostApiKey: string;
|
|
39
|
+
};
|
|
40
|
+
export type deprecated__StripeConfig = {
|
|
41
|
+
id: deprecated__OnRampProviderProp;
|
|
42
|
+
};
|
|
43
|
+
export type deprecated__OnRampAssetProp = keyof typeof OnRampAsset | OnRampAsset;
|
|
44
|
+
export type deprecated__OnRampConfigProvider = deprecated__RampConfig | deprecated__StripeConfig;
|
|
45
|
+
export declare enum EnabledFlow {
|
|
46
|
+
BUY = "BUY",
|
|
47
|
+
RECEIVE = "RECEIVE",
|
|
48
|
+
WITHDRAW = "WITHDRAW"
|
|
49
|
+
}
|
|
50
|
+
export type deprecated__EnabledFlowProp = keyof typeof EnabledFlow | EnabledFlow;
|
|
51
|
+
export type deprecated__OnRampConfig = {
|
|
52
|
+
testMode?: boolean;
|
|
53
|
+
asset: deprecated__OnRampAssetProp;
|
|
54
|
+
network: deprecated__NetworkProp;
|
|
55
|
+
enabledFlows?: deprecated__EnabledFlowProp[];
|
|
56
|
+
providers: deprecated__OnRampConfigProvider[];
|
|
57
|
+
};
|
|
58
|
+
export declare enum OnRampMethod {
|
|
59
|
+
ACH = "ACH",
|
|
60
|
+
DEBIT = "Debit",
|
|
61
|
+
CREDIT = "Credit",
|
|
62
|
+
APPLE_PAY = "Apple Pay"
|
|
63
|
+
}
|
|
64
|
+
export declare const WalletSchemeTypeMap: Record<WalletScheme, Partial<Record<WalletType, true>>>;
|
|
65
|
+
export declare function getPortalDomain(env: Environment, isE2E?: boolean): "localhost" | "app.sandbox.usecapsule.com" | "app.beta.usecapsule.com" | "app.usecapsule.com";
|
|
66
|
+
export declare function getPortalBaseURL({ env, isE2E }: {
|
|
67
|
+
env: Environment;
|
|
68
|
+
isE2E?: boolean;
|
|
69
|
+
}, useLocalIp?: boolean, isForWasm?: boolean): string;
|
|
70
|
+
export declare function getParaConnectDomain(env: Environment): "localhost" | "connect.sandbox.getpara.com" | "connect.beta.getpara.com" | "connect.getpara.com";
|
|
71
|
+
export declare function getParaConnectBaseUrl({ env }: {
|
|
72
|
+
env: Environment;
|
|
73
|
+
}, useLocalIp?: boolean): string;
|
|
74
|
+
export declare const EXTERNAL_WALLET_CHANGE_EVENT = "paraExternalWalletChange";
|
|
75
|
+
export declare const CURRENT_WALLET_IDS_CHANGE_EVENT = "paraCurrentWalletIdsChange";
|
|
76
|
+
export type ProviderAssetInfo = [string, Partial<Record<OnRampPurchaseType, boolean>>];
|
|
77
|
+
export type OnRampAssetInfo = Record<WalletType, Partial<Record<Network, Partial<Record<OnRampAsset, Partial<Record<OnRampProvider, ProviderAssetInfo>>>>>>>;
|
|
78
|
+
export type OnRampAssetInfoRow = [WalletType, Network, OnRampAsset, Partial<Record<OnRampProvider, ProviderAssetInfo>>];
|
|
79
|
+
export declare function toAssetInfoArray(data: OnRampAssetInfo): OnRampAssetInfoRow[];
|
|
80
|
+
export declare function getOnRampNetworks(data: OnRampAssetInfo, { walletType, allowed }?: {
|
|
81
|
+
walletType?: WalletType;
|
|
82
|
+
allowed?: Network[];
|
|
83
|
+
}): Network[];
|
|
84
|
+
export declare function getOnRampAssets(data: OnRampAssetInfo, { walletType, network, allowed, }?: {
|
|
85
|
+
walletType?: WalletType;
|
|
86
|
+
network?: Network;
|
|
87
|
+
allowed?: OnRampAsset[];
|
|
88
|
+
}): OnRampAsset[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class TransactionReviewError extends Error {
|
|
2
|
+
transactionReviewUrl: string;
|
|
3
|
+
constructor(transactionReviewUrl: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class TransactionReviewDenied extends Error {
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
export declare class TransactionReviewTimeout extends Error {
|
|
9
|
+
pendingTransactionId: string;
|
|
10
|
+
transactionReviewUrl: string;
|
|
11
|
+
constructor(transactionReviewUrl: string, pendingTransactionId: string);
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Client from '@getpara/user-management-client';
|
|
2
|
+
import { Environment } from '../definitions.js';
|
|
3
|
+
export declare function getBaseUrl(env: Environment): string;
|
|
4
|
+
export declare function getBaseMPCNetworkUrl(env: Environment, useWebsocket?: boolean): string;
|
|
5
|
+
export declare function initClient({ env, version, apiKey, partnerId, useFetchAdapter, retrieveSessionCookie, persistSessionCookie, }: {
|
|
6
|
+
env: Environment;
|
|
7
|
+
version?: string;
|
|
8
|
+
apiKey?: string;
|
|
9
|
+
partnerId?: string;
|
|
10
|
+
useFetchAdapter?: boolean;
|
|
11
|
+
retrieveSessionCookie?: () => string;
|
|
12
|
+
persistSessionCookie?: (cookie: string) => void;
|
|
13
|
+
}): Client;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ParaCore, PREFIX as STORAGE_PREFIX, PregenIdentifierType, isWalletSupported } from './ParaCore.js';
|
|
2
|
+
export { AuthMethod, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, WalletType, WalletScheme, OnRampPurchaseType, type OnRampConfig, type OnRampAllowedAssets, OAuthMethod, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
|
|
3
|
+
export * from './definitions.js';
|
|
4
|
+
export type { Ctx } from './definitions.js';
|
|
5
|
+
export * from './types/index.js';
|
|
6
|
+
export { distributeNewShare } from './shares/shareDistribution.js';
|
|
7
|
+
export { KeyContainer } from './shares/KeyContainer.js';
|
|
8
|
+
export { RecoveryStatus, stringToPhoneNumber, entityToWallet } from './ParaCore.js';
|
|
9
|
+
export type { Wallet, ConstructorOpts, SupportedWalletTypes } from './ParaCore.js';
|
|
10
|
+
export type { PlatformUtils } from './PlatformUtils.js';
|
|
11
|
+
export type { StorageUtils } from './StorageUtils.js';
|
|
12
|
+
export { getBaseUrl, initClient } from './external/userManagementClient.js';
|
|
13
|
+
export * as mpcComputationClient from './external/mpcComputationClient.js';
|
|
14
|
+
export { decryptWithKeyPair, decryptWithPrivateKey, getAsymmetricKeyPair, getPublicKeyHex, encryptWithDerivedPublicKey, encodePrivateKeyToPemHex, getDerivedPrivateKeyAndDecrypt, getPublicKeyFromSignature, getSHA256HashHex, encryptPrivateKey, decryptPrivateKey, decryptPrivateKeyAndDecryptShare, hashPasswordWithSalt, encryptPrivateKeyWithPassword, decryptPrivateKeyWithPassword, publicKeyFromHex, } from './cryptography/utils.js';
|
|
15
|
+
export * from './external/userManagementClient.js';
|
|
16
|
+
export * from './utils/pollingUtils.js';
|
|
17
|
+
export * from './errors.js';
|
|
18
|
+
export * from './utils/formattingUtils.js';
|
|
19
|
+
export { retrieve as transmissionUtilsRetrieve } from './transmission/transmissionUtils.js';
|
|
20
|
+
export { STORAGE_PREFIX, PregenIdentifierType, isWalletSupported };
|
|
21
|
+
export declare const paraVersion: string;
|
|
22
|
+
export default ParaCore;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare class KeyContainer {
|
|
3
|
+
walletId: string;
|
|
4
|
+
keyshare: string;
|
|
5
|
+
address: string;
|
|
6
|
+
backupDecryptionKey: string;
|
|
7
|
+
constructor(walletId: string, keyshare: string, address: string);
|
|
8
|
+
static buildFrom(serializedContainer: string): KeyContainer;
|
|
9
|
+
getPublicEncryptionKey(): Buffer;
|
|
10
|
+
getPublicEncryptionKeyHex(): string;
|
|
11
|
+
encryptForSelf(backup: string): string;
|
|
12
|
+
static encryptWithPublicKey(publicKey: Buffer, backup: string): string;
|
|
13
|
+
decrypt(encryptedBackup: string): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BackupKitEmailProps, EncryptedKeyShare } from '@getpara/user-management-client';
|
|
2
|
+
import { Ctx } from '../definitions.js';
|
|
3
|
+
export declare function sendRecoveryForShare({ ctx, userId, walletId, otherEncryptedShares, userSigner, ignoreRedistributingBackupEncryptedShare, emailProps, forceRefresh, }: {
|
|
4
|
+
ctx: Ctx;
|
|
5
|
+
userId: string;
|
|
6
|
+
walletId: string;
|
|
7
|
+
otherEncryptedShares?: EncryptedKeyShare[];
|
|
8
|
+
userSigner: string;
|
|
9
|
+
ignoreRedistributingBackupEncryptedShare?: boolean;
|
|
10
|
+
emailProps?: BackupKitEmailProps;
|
|
11
|
+
forceRefresh?: boolean;
|
|
12
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BackupKitEmailProps } from '@getpara/user-management-client';
|
|
2
|
+
import { Ctx } from '../definitions.js';
|
|
3
|
+
export declare function distributeNewShare({ ctx, userId, walletId, userShare, ignoreRedistributingBackupEncryptedShare, emailProps, partnerId, protocolId, }: {
|
|
4
|
+
ctx: Ctx;
|
|
5
|
+
userId: string;
|
|
6
|
+
walletId: string;
|
|
7
|
+
userShare: string;
|
|
8
|
+
ignoreRedistributingBackupEncryptedShare?: boolean;
|
|
9
|
+
emailProps?: BackupKitEmailProps;
|
|
10
|
+
partnerId?: string;
|
|
11
|
+
protocolId?: string;
|
|
12
|
+
}): Promise<string>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AuthType, WalletType } from '@getpara/user-management-client';
|
|
2
|
+
import { Theme } from './theme.js';
|
|
3
|
+
export type EmbeddedWalletType = Exclude<WalletType, never>;
|
|
4
|
+
export type ExternalWalletType = Exclude<WalletType, never>;
|
|
5
|
+
export type ExternalWalletInfo = {
|
|
6
|
+
address: string;
|
|
7
|
+
type: ExternalWalletType;
|
|
8
|
+
provider?: string;
|
|
9
|
+
addressBech32?: string;
|
|
10
|
+
};
|
|
11
|
+
export type PortalUrlOptions = {
|
|
12
|
+
params?: Record<string, string | undefined | null>;
|
|
13
|
+
authType?: AuthType;
|
|
14
|
+
isForNewDevice?: boolean;
|
|
15
|
+
loginEncryptionPublicKey?: string;
|
|
16
|
+
newDeviceSessionId?: string;
|
|
17
|
+
newDeviceEncryptionKey?: string;
|
|
18
|
+
partnerId?: string;
|
|
19
|
+
sessionId?: string;
|
|
20
|
+
theme?: Theme;
|
|
21
|
+
pathId?: string;
|
|
22
|
+
displayName?: string;
|
|
23
|
+
pfpUrl?: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare enum PopupType {
|
|
2
|
+
SIGN_TRANSACTION_REVIEW = "SIGN_TRANSACTION_REVIEW",
|
|
3
|
+
SIGN_MESSAGE_REVIEW = "SIGN_MESSAGE_REVIEW",
|
|
4
|
+
LOGIN_PASSKEY = "LOGIN_PASSKEY",
|
|
5
|
+
CREATE_PASSKEY = "CREATE_PASSKEY",
|
|
6
|
+
OAUTH = "OAUTH",
|
|
7
|
+
ON_RAMP_TRANSACTION = "ON_RAMP_TRANSACTION"
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Theme = {
|
|
2
|
+
foregroundColor?: string;
|
|
3
|
+
backgroundColor?: string;
|
|
4
|
+
accentColor?: string;
|
|
5
|
+
darkForegroundColor?: string;
|
|
6
|
+
darkBackgroundColor?: string;
|
|
7
|
+
darkAccentColor?: string;
|
|
8
|
+
mode?: 'light' | 'dark';
|
|
9
|
+
borderRadius?: BorderRadius;
|
|
10
|
+
font?: string;
|
|
11
|
+
};
|
|
12
|
+
export type BorderRadius = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SuccessfulSignatureRes {
|
|
2
|
+
signature: string;
|
|
3
|
+
}
|
|
4
|
+
export interface DeniedSignatureRes {
|
|
5
|
+
pendingTransactionId: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DeniedSignatureResWithUrl extends DeniedSignatureRes {
|
|
8
|
+
transactionReviewUrl: string;
|
|
9
|
+
}
|
|
10
|
+
export type SignatureRes = SuccessfulSignatureRes | DeniedSignatureRes;
|
|
11
|
+
export type FullSignatureRes = SuccessfulSignatureRes | DeniedSignatureResWithUrl;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { WalletTypeProp } from '../definitions.js';
|
|
2
|
+
export type Hex = `0x${string}`;
|
|
3
|
+
export interface Signature {
|
|
4
|
+
r: Hex;
|
|
5
|
+
s: Hex;
|
|
6
|
+
v: bigint;
|
|
7
|
+
}
|
|
8
|
+
export declare function hexStringToBase64(hexString: string): string;
|
|
9
|
+
export declare function hexToSignature(hexSig: string): Signature;
|
|
10
|
+
export declare function hexToUint8Array(hex: string): Uint8Array;
|
|
11
|
+
export declare function hexToDecimal(hex: string): string;
|
|
12
|
+
export declare function decimalToHex(decimal: string): Hex;
|
|
13
|
+
export declare function getCosmosAddress(publicKey: string, prefix: string): string;
|
|
14
|
+
export declare function truncateAddress(str: string, addressType: WalletTypeProp, { prefix }?: {
|
|
15
|
+
prefix?: string;
|
|
16
|
+
}): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function waitUntilTrue(condition: () => Promise<boolean>, timeoutMs: number, intervalMs: number): Promise<boolean>;
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@getpara/core-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "dist/cjs/index.js",
|
|
5
|
+
"module": "dist/esm/index.js",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
|
+
"typings": "dist/types/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@celo/utils": "^8.0.0",
|
|
11
|
+
"@cosmjs/encoding": "^0.32.4",
|
|
12
|
+
"@getpara/user-management-client": "0.1.0",
|
|
13
|
+
"@noble/hashes": "^1.5.0",
|
|
14
|
+
"base64url": "^3.0.1",
|
|
15
|
+
"buffer": "6.0.3",
|
|
16
|
+
"ethereumjs-util": "7.1.5",
|
|
17
|
+
"libphonenumber-js": "1.11.2",
|
|
18
|
+
"node-forge": "^1.3.1",
|
|
19
|
+
"qs": "^6.12.0"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "yarn build:cjs && yarn build:esm && yarn build:types; yarn post-build",
|
|
23
|
+
"post-build": "./scripts/set-version.sh",
|
|
24
|
+
"build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
25
|
+
"build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && printf '{\"type\":\"module\",\"sideEffects\":false}' > dist/esm/package.json",
|
|
26
|
+
"build:types": "rm -rf dist/types && tsc --module es6 --declarationDir dist/types --emitDeclarationOnly --declaration",
|
|
27
|
+
"test": "vitest run --coverage"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"typescript": "5.1.6"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"package.json"
|
|
35
|
+
],
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"import": "./dist/esm/index.js",
|
|
39
|
+
"require": "./dist/cjs/index.js",
|
|
40
|
+
"types": "./dist/types/index.d.ts"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"gitHead": "625aaa94001a5461dcde8d6775c3b73f3862c76c"
|
|
44
|
+
}
|