@getpara/user-management-client 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.
@@ -0,0 +1,4 @@
1
+ export const SESSION_COOKIE_HEADER_NAME = 'x-capsule-sid';
2
+ export const VERSION_HEADER_NAME = 'x-capsule-version';
3
+ export const PARTNER_ID_HEADER_NAME = 'x-partner-id';
4
+ export const API_KEY_HEADER_NAME = 'X-External-API-Key';
@@ -0,0 +1,16 @@
1
+ export function ParaApiError(message, code, status, responseURL) {
2
+ Error.call(this);
3
+ if (Error.captureStackTrace) {
4
+ Error.captureStackTrace(this, this.constructor);
5
+ }
6
+ else {
7
+ this.stack = new Error().stack;
8
+ }
9
+ this.message = message;
10
+ this.name = 'ParaApiError';
11
+ code && (this.code = code);
12
+ status && (this.status = status);
13
+ responseURL && (this.responseURL = responseURL);
14
+ }
15
+ const prototype = ParaApiError.prototype;
16
+ Object.defineProperty(prototype, 'isParaApiError', { value: true });
@@ -0,0 +1,5 @@
1
+ export * from './client.js';
2
+ export * from './types/index.js';
3
+ export * from './utils.js';
4
+ import Client from './client.js';
5
+ export default Client;
@@ -0,0 +1 @@
1
+ {"type":"module","sideEffects":false}
@@ -0,0 +1,42 @@
1
+ export var EncryptorType;
2
+ (function (EncryptorType) {
3
+ EncryptorType["USER"] = "USER";
4
+ EncryptorType["RECOVERY"] = "RECOVERY";
5
+ EncryptorType["BIOMETRICS"] = "BIOMETRICS";
6
+ EncryptorType["PASSWORD"] = "PASSWORD";
7
+ })(EncryptorType || (EncryptorType = {}));
8
+ export var KeyShareType;
9
+ (function (KeyShareType) {
10
+ KeyShareType["USER"] = "USER";
11
+ KeyShareType["RECOVERY"] = "RECOVERY";
12
+ })(KeyShareType || (KeyShareType = {}));
13
+ export var PasswordStatus;
14
+ (function (PasswordStatus) {
15
+ PasswordStatus["PENDING"] = "PENDING";
16
+ PasswordStatus["COMPLETE"] = "COMPLETE";
17
+ })(PasswordStatus || (PasswordStatus = {}));
18
+ export var PublicKeyStatus;
19
+ (function (PublicKeyStatus) {
20
+ PublicKeyStatus["PENDING"] = "PENDING";
21
+ PublicKeyStatus["COMPLETE"] = "COMPLETE";
22
+ })(PublicKeyStatus || (PublicKeyStatus = {}));
23
+ export var PublicKeyType;
24
+ (function (PublicKeyType) {
25
+ PublicKeyType["MOBILE"] = "MOBILE";
26
+ PublicKeyType["WEB"] = "WEB";
27
+ })(PublicKeyType || (PublicKeyType = {}));
28
+ export var OAuthMethod;
29
+ (function (OAuthMethod) {
30
+ OAuthMethod["GOOGLE"] = "GOOGLE";
31
+ OAuthMethod["TWITTER"] = "TWITTER";
32
+ OAuthMethod["APPLE"] = "APPLE";
33
+ OAuthMethod["DISCORD"] = "DISCORD";
34
+ OAuthMethod["FACEBOOK"] = "FACEBOOK";
35
+ OAuthMethod["FARCASTER"] = "FARCASTER";
36
+ OAuthMethod["TELEGRAM"] = "TELEGRAM";
37
+ })(OAuthMethod || (OAuthMethod = {}));
38
+ export var AuthMethod;
39
+ (function (AuthMethod) {
40
+ AuthMethod["PASSWORD"] = "PASSWORD";
41
+ AuthMethod["PASSKEY"] = "PASSKEY";
42
+ })(AuthMethod || (AuthMethod = {}));
@@ -0,0 +1,5 @@
1
+ export var EmailTheme;
2
+ (function (EmailTheme) {
3
+ EmailTheme["LIGHT"] = "light";
4
+ EmailTheme["DARK"] = "dark";
5
+ })(EmailTheme || (EmailTheme = {}));
@@ -0,0 +1,5 @@
1
+ export * from './auth.js';
2
+ export * from './email.js';
3
+ export * from './onRamp.js';
4
+ export * from './partner.js';
5
+ export * from './wallet.js';
@@ -0,0 +1,30 @@
1
+ export var OnRampProvider;
2
+ (function (OnRampProvider) {
3
+ OnRampProvider["RAMP"] = "RAMP";
4
+ OnRampProvider["STRIPE"] = "STRIPE";
5
+ OnRampProvider["MOONPAY"] = "MOONPAY";
6
+ })(OnRampProvider || (OnRampProvider = {}));
7
+ export var OnRampAsset;
8
+ (function (OnRampAsset) {
9
+ OnRampAsset["ETHEREUM"] = "ETHEREUM";
10
+ OnRampAsset["USDC"] = "USDC";
11
+ OnRampAsset["TETHER"] = "TETHER";
12
+ OnRampAsset["POLYGON"] = "POLYGON";
13
+ OnRampAsset["SOLANA"] = "SOLANA";
14
+ OnRampAsset["ATOM"] = "ATOM";
15
+ OnRampAsset["CELO"] = "CELO";
16
+ OnRampAsset["CUSD"] = "CUSD";
17
+ OnRampAsset["CEUR"] = "CEUR";
18
+ OnRampAsset["CREAL"] = "CREAL";
19
+ })(OnRampAsset || (OnRampAsset = {}));
20
+ export var OnRampPurchaseStatus;
21
+ (function (OnRampPurchaseStatus) {
22
+ OnRampPurchaseStatus["INITIATED"] = "INITIATED";
23
+ OnRampPurchaseStatus["FINISHED"] = "FINISHED";
24
+ OnRampPurchaseStatus["CANCELLED"] = "CANCELLED";
25
+ })(OnRampPurchaseStatus || (OnRampPurchaseStatus = {}));
26
+ export var OnRampPurchaseType;
27
+ (function (OnRampPurchaseType) {
28
+ OnRampPurchaseType["BUY"] = "BUY";
29
+ OnRampPurchaseType["SELL"] = "SELL";
30
+ })(OnRampPurchaseType || (OnRampPurchaseType = {}));
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ import { OAuthMethod } from './auth.js';
2
+ export var WalletScheme;
3
+ (function (WalletScheme) {
4
+ WalletScheme["DKLS"] = "DKLS";
5
+ WalletScheme["CGGMP"] = "CGGMP";
6
+ WalletScheme["ED25519"] = "ED25519";
7
+ })(WalletScheme || (WalletScheme = {}));
8
+ export var WalletType;
9
+ (function (WalletType) {
10
+ WalletType["EVM"] = "EVM";
11
+ WalletType["SOLANA"] = "SOLANA";
12
+ WalletType["COSMOS"] = "COSMOS";
13
+ })(WalletType || (WalletType = {}));
14
+ export var Chain;
15
+ (function (Chain) {
16
+ Chain["ETH"] = "ETH";
17
+ Chain["CELO"] = "CELO";
18
+ Chain["MATIC"] = "MATIC";
19
+ })(Chain || (Chain = {}));
20
+ export var Network;
21
+ (function (Network) {
22
+ Network["ETHEREUM"] = "ETHEREUM";
23
+ Network["SEPOLIA"] = "SEPOLIA";
24
+ Network["ARBITRUM"] = "ARBITRUM";
25
+ Network["BASE"] = "BASE";
26
+ Network["OPTIMISM"] = "OPTIMISM";
27
+ Network["POLYGON"] = "POLYGON";
28
+ Network["SOLANA"] = "SOLANA";
29
+ Network["COSMOS"] = "COSMOS";
30
+ Network["CELO"] = "CELO";
31
+ Network["NOBLE"] = "NOBLE";
32
+ })(Network || (Network = {}));
33
+ export const PREGEN_IDENTIFIER_TYPES = [
34
+ 'EMAIL',
35
+ 'PHONE',
36
+ 'CUSTOM_ID',
37
+ OAuthMethod.DISCORD,
38
+ OAuthMethod.TWITTER,
39
+ OAuthMethod.TELEGRAM,
40
+ ];
41
+ export const NON_ED25519 = [WalletScheme.DKLS, WalletScheme.CGGMP];
@@ -0,0 +1,96 @@
1
+ export function isWalletId(params) {
2
+ return !!params.walletId && !params.externalWalletAddress;
3
+ }
4
+ export function isExternalWalletAddress(params) {
5
+ return !!params.externalWalletAddress && !params.walletId;
6
+ }
7
+ export function extractWalletRef(params) {
8
+ if (isWalletId(params)) {
9
+ return ['walletId', params.walletId];
10
+ }
11
+ else if (isExternalWalletAddress(params)) {
12
+ return ['externalWalletAddress', params.externalWalletAddress];
13
+ }
14
+ throw new Error('invalid wallet params');
15
+ }
16
+ function isValid(s) {
17
+ return !!s && s !== 'null' && s !== 'undefined' && s !== '';
18
+ }
19
+ export function isEmail(params) {
20
+ return (isValid(params.email) &&
21
+ !isValid(params.phone) &&
22
+ !isValid(params.countryCode) &&
23
+ !isValid(params.farcasterUsername) &&
24
+ !isValid(params.telegramUserId));
25
+ }
26
+ export function isPhone(params) {
27
+ return (isValid(params.phone) &&
28
+ isValid(params.countryCode) &&
29
+ !isValid(params.email) &&
30
+ !isValid(params.farcasterUsername) &&
31
+ !isValid(params.telegramUserId));
32
+ }
33
+ export function isFarcaster(params) {
34
+ return (isValid(params.farcasterUsername) &&
35
+ !isValid(params.email) &&
36
+ !isValid(params.phone) &&
37
+ !isValid(params.countryCode) &&
38
+ !isValid(params.telegramUserId));
39
+ }
40
+ export function isTelegram(params) {
41
+ return (isValid(params.telegramUserId) &&
42
+ !isValid(params.email) &&
43
+ !isValid(params.phone) &&
44
+ !isValid(params.countryCode) &&
45
+ !isValid(params.farcasterUsername));
46
+ }
47
+ export function isUserId(params) {
48
+ return (isValid(params.userId) &&
49
+ !isValid(params.email) &&
50
+ !isValid(params.phone) &&
51
+ !isValid(params.countryCode) &&
52
+ !isValid(params.farcasterUsername) &&
53
+ !isValid(params.telegramUserId));
54
+ }
55
+ export function extractAuthInfo(obj, { allowUserId } = {}) {
56
+ switch (true) {
57
+ case isEmail(obj):
58
+ return { auth: { email: obj.email }, authType: 'email', identifier: obj.email, publicKeyIdentifier: obj.email };
59
+ case isPhone(obj):
60
+ return {
61
+ auth: { phone: obj.phone, countryCode: obj.countryCode },
62
+ authType: 'phone',
63
+ identifier: `${obj.countryCode}${obj.phone}`,
64
+ publicKeyIdentifier: `${obj.countryCode}${obj.phone}`,
65
+ };
66
+ case isFarcaster(obj):
67
+ return {
68
+ auth: { farcasterUsername: obj.farcasterUsername },
69
+ authType: 'farcaster',
70
+ identifier: obj.farcasterUsername,
71
+ publicKeyIdentifier: `${obj.farcasterUsername}-farcaster`,
72
+ };
73
+ case isTelegram(obj):
74
+ return {
75
+ auth: { telegramUserId: obj.telegramUserId },
76
+ authType: 'telegram',
77
+ identifier: obj.telegramUserId,
78
+ publicKeyIdentifier: `${obj.telegramUserId}-telegram`,
79
+ };
80
+ case isUserId(obj) && allowUserId:
81
+ return { auth: { userId: obj.userId }, authType: 'userId', identifier: obj.userId, publicKeyIdentifier: obj.userId };
82
+ default:
83
+ throw new Error('invalid auth object');
84
+ }
85
+ }
86
+ export function extractAuth(obj, opts = {}) {
87
+ try {
88
+ return extractAuthInfo(obj, { allowUserId: opts.allowUserId || false }).auth;
89
+ }
90
+ catch (e) {
91
+ if (opts.optional) {
92
+ return undefined;
93
+ }
94
+ throw e;
95
+ }
96
+ }
@@ -0,0 +1,326 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { Auth, AuthMethod, AuthParams, BackupKitEmailProps, BiometricLocationHint, Chain, CurrentWalletIds, EncryptedKeyShare, EncryptorType, KeyShareType, Network, OnRampAsset, OnRampConfig, OnRampProvider, OnRampPurchase, OnRampPurchaseCreateParams, OnRampPurchaseUpdateParams, PasswordStatus, PregenIds, PublicKeyStatus, PublicKeyType, TelegramAuthResponse, TPregenIdentifierType, VerificationEmailProps, WalletEntity, WalletParams, WalletScheme, WalletType } from './types/index.js';
3
+ interface ConfigOpts {
4
+ useFetchAdapter?: boolean;
5
+ }
6
+ type ClientConfig = {
7
+ userManagementHost: string;
8
+ version?: string;
9
+ partnerId?: string;
10
+ apiKey?: string;
11
+ opts?: ConfigOpts;
12
+ retrieveSessionCookie?: () => string | undefined;
13
+ persistSessionCookie?: (cookie: string) => void;
14
+ };
15
+ interface createUserBody {
16
+ email: string;
17
+ }
18
+ interface createUserBodyForPhone {
19
+ phone: string;
20
+ countryCode: string;
21
+ }
22
+ interface ExternalWalletLoginBody {
23
+ externalAddress: string;
24
+ type: 'EVM' | 'SOLANA' | 'COSMOS';
25
+ externalWalletProvider?: string;
26
+ }
27
+ interface ExternalWalletLoginRes {
28
+ userId: string;
29
+ }
30
+ interface createUserIdRes {
31
+ protocolId: string;
32
+ userId: string;
33
+ }
34
+ interface verifyBody {
35
+ verificationCode: string;
36
+ }
37
+ interface getWebChallengeRes {
38
+ challenge: string;
39
+ allowedPublicKeys?: string[];
40
+ }
41
+ interface sessionPublicKeyBody {
42
+ publicKey?: string;
43
+ sigDerivedPublicKey?: string;
44
+ status?: PublicKeyStatus;
45
+ type?: PublicKeyType;
46
+ cosePublicKey?: string;
47
+ clientDataJSON?: string;
48
+ aaguid?: string;
49
+ }
50
+ interface WebSignature {
51
+ clientDataJSON: string;
52
+ authenticatorData: string;
53
+ signature: string;
54
+ }
55
+ interface MobileSignature {
56
+ r: string;
57
+ s: string;
58
+ recoveryParam: number;
59
+ }
60
+ type verifyWebChallengeBody = {
61
+ sessionLookupId?: string;
62
+ signature: WebSignature;
63
+ publicKey: string;
64
+ newDeviceSessionLookupId?: string;
65
+ };
66
+ type verifyPasswordChallengeBody = {
67
+ sessionLookupId?: string;
68
+ signature: string;
69
+ publicKey: string;
70
+ newDeviceSessionLookupId?: string;
71
+ };
72
+ interface verifySessionChallengeBody {
73
+ signature: MobileSignature | WebSignature;
74
+ publicKey?: string;
75
+ }
76
+ interface GetWalletsRes {
77
+ wallets: WalletEntity[];
78
+ }
79
+ interface PasswordEntity {
80
+ id: string;
81
+ userId: string;
82
+ status: PasswordStatus;
83
+ sigDerivedPublicKey: string;
84
+ salt: string;
85
+ }
86
+ interface createWalletBody {
87
+ useTwoSigners?: boolean;
88
+ scheme: WalletScheme;
89
+ type: WalletType;
90
+ cosmosPrefix?: string;
91
+ }
92
+ interface updatePregenWalletBody {
93
+ pregenIdentifier: string;
94
+ pregenIdentifierType: TPregenIdentifierType;
95
+ }
96
+ interface createWalletRes {
97
+ protocolId: string;
98
+ walletId: string;
99
+ }
100
+ interface createWalletPreGenBody {
101
+ pregenIdentifier: string;
102
+ pregenIdentifierType: TPregenIdentifierType;
103
+ scheme?: WalletScheme;
104
+ type: WalletType;
105
+ cosmosPrefix?: string;
106
+ }
107
+ interface claimPreGenWalletsBody {
108
+ userId: string;
109
+ walletIds: string[];
110
+ }
111
+ interface signTransactionBody {
112
+ transaction: string;
113
+ chainId: string;
114
+ }
115
+ interface sendTransactionBody {
116
+ transaction: string;
117
+ chain?: Chain;
118
+ chainId?: string;
119
+ }
120
+ interface AcceptScopesBody {
121
+ scopeIds: string[];
122
+ partnerId: string;
123
+ }
124
+ interface sessionPasswordBody {
125
+ status?: PasswordStatus;
126
+ sigDerivedPublicKey?: string;
127
+ salt?: string;
128
+ }
129
+ type BiometricLocationHintParams = AuthParams;
130
+ export type VerifyTelegramRes = {
131
+ isValid: true;
132
+ userId: string;
133
+ telegramUserId: string;
134
+ isNewUser: boolean;
135
+ biometricHints?: BiometricLocationHint[];
136
+ supportedAuthMethods: AuthMethod[];
137
+ } | {
138
+ isValid: false;
139
+ };
140
+ export declare const handleResponseSuccess: (response: AxiosResponse<any, any>) => AxiosResponse<any, any>;
141
+ export declare const handleResponseError: (error: any) => never;
142
+ declare class Client {
143
+ private baseRequest;
144
+ constructor({ userManagementHost, apiKey, partnerId, version, opts, retrieveSessionCookie, persistSessionCookie, }: ClientConfig);
145
+ createUser: (body: (createUserBody | createUserBodyForPhone) & VerificationEmailProps) => Promise<createUserIdRes>;
146
+ checkUserExists: (auth: Auth<"email" | "phone">) => Promise<any>;
147
+ verifyTelegram: (authObject: TelegramAuthResponse) => Promise<VerifyTelegramRes>;
148
+ externalWalletLogin: (body: ExternalWalletLoginBody) => Promise<ExternalWalletLoginRes>;
149
+ verifyEmail: (userId: string, body: verifyBody) => Promise<any>;
150
+ verifyPhone: (userId: string, body: verifyBody) => Promise<any>;
151
+ addSessionPublicKey: (userId: string, body: sessionPublicKeyBody) => Promise<any>;
152
+ getSessionPublicKeys: (userId: string) => Promise<any>;
153
+ getBiometricLocationHints: (params: BiometricLocationHintParams) => Promise<BiometricLocationHint[]>;
154
+ getSessionPublicKey: (userId: string, biometricId: string) => Promise<any>;
155
+ patchSessionPublicKey: (partnerId: string, userId: string, biometricId: string, body: sessionPublicKeyBody) => Promise<any>;
156
+ getWebChallenge: (auth?: Auth) => Promise<getWebChallengeRes>;
157
+ touchSession: (regenerate?: boolean) => Promise<any>;
158
+ sessionOrigin: (sessionLookupId: string) => Promise<{
159
+ origin?: string;
160
+ }>;
161
+ verifyWebChallenge: (partnerId: string, body: verifyWebChallengeBody) => Promise<any>;
162
+ getSessionChallenge: (userId: string) => Promise<any>;
163
+ verifySessionChallenge: (userId: string, body: verifySessionChallengeBody) => Promise<any>;
164
+ createWallet: (userId: string, body?: createWalletBody) => Promise<createWalletRes>;
165
+ createWalletPreGen: (body?: createWalletPreGenBody) => Promise<createWalletRes>;
166
+ getPregenWallets: <ReturnType = {
167
+ wallets: WalletEntity[];
168
+ }>(pregenIds: PregenIds, isPortal?: boolean, userId?: string) => Promise<ReturnType>;
169
+ claimPregenWallets: <ReturnType = {
170
+ walletIds?: string[];
171
+ }>(body?: claimPreGenWalletsBody) => Promise<ReturnType>;
172
+ sendTransaction: (userId: string, walletId: string, body: sendTransactionBody) => Promise<any>;
173
+ signTransaction: (userId: string, walletId: string, body: signTransactionBody) => Promise<any>;
174
+ refreshKeys: (userId: string, walletId: string, oldPartnerId?: string, newPartnerId?: string, keyShareProtocolId?: string) => Promise<any>;
175
+ updatePregenWallet: (walletId: string, body: updatePregenWalletBody) => Promise<any>;
176
+ getWallets: (userId: string, includePartnerData?: boolean) => Promise<AxiosResponse<GetWalletsRes, any>>;
177
+ getAllWallets: (userId: string) => Promise<AxiosResponse<GetWalletsRes, any>>;
178
+ setCurrentWalletIds: (userId: string, walletIds: CurrentWalletIds, needsWallet?: boolean, sessionLookupId?: string, newDeviceSessionLookupId?: string) => Promise<any>;
179
+ login: (props: {
180
+ email: string;
181
+ } & VerificationEmailProps) => Promise<any>;
182
+ verifyLogin: (verificationCode: string) => Promise<any>;
183
+ logout: () => Promise<any>;
184
+ recoveryVerification: (email: string, verificationCode: string) => Promise<any>;
185
+ recoveryInit: (email: string) => Promise<any>;
186
+ preSignMessage: (userId: string, walletId: string, message: string, scheme?: WalletScheme, cosmosSignDoc?: string) => Promise<any>;
187
+ deleteSelf: (userId: string) => Promise<any>;
188
+ uploadKeyshares(userId: string, walletId: string, encryptedKeyshares: EncryptedKeyShare[]): Promise<any>;
189
+ uploadUserKeyShares(userId: string, encryptedKeyshares: (EncryptedKeyShare & {
190
+ walletId: string;
191
+ })[]): Promise<any>;
192
+ getKeyshare(userId: string, walletId: string, type: KeyShareType, encryptor?: EncryptorType): Promise<any>;
193
+ getBiometricKeyshares(userId: string, biometricPublicKey: string, getAll?: boolean): Promise<any>;
194
+ getPasswordKeyshares(userId: string, passwordId: string, getAll?: boolean): Promise<any>;
195
+ uploadTransmissionKeyshares(userId: string, shares: {
196
+ walletId: string;
197
+ encryptedShare: string;
198
+ encryptedKey?: string;
199
+ sessionLookupId: string;
200
+ }[]): Promise<any>;
201
+ getTransmissionKeyshares(userId: string, sessionLookupId: string): Promise<any>;
202
+ getParaShare: (userId: string, walletId: string) => Promise<string>;
203
+ getBackupKit: (userId: string) => Promise<any>;
204
+ resendVerificationCode({ userId, ...rest }: {
205
+ userId: string;
206
+ } & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
207
+ resendVerificationCodeByPhone({ userId, ...rest }: {
208
+ userId: string;
209
+ } & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
210
+ cancelRecoveryAttempt(email: string): Promise<AxiosResponse<any, any>>;
211
+ check2FAStatus(userId: string): Promise<AxiosResponse<any, any>>;
212
+ enable2FA(userId: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
213
+ setup2FA(userId: string): Promise<AxiosResponse<any, any>>;
214
+ initializeRecovery(email: string): Promise<AxiosResponse<any, any>>;
215
+ initializeFarcasterLogin(): Promise<AxiosResponse<any, any>>;
216
+ getFarcasterAuthStatus(): Promise<AxiosResponse<any, any>>;
217
+ initializeRecoveryForPhone(phone: string, countryCode: string): Promise<AxiosResponse<any, any>>;
218
+ finalizeRecovery(userId: string, walletId: string): Promise<AxiosResponse<any, any>>;
219
+ recoverUserShares(userId: string, walletId: string): Promise<AxiosResponse<{
220
+ keyShare: {
221
+ encryptedShare: string;
222
+ encryptedKey?: string;
223
+ type: string;
224
+ walletId: string;
225
+ };
226
+ keyShares: {
227
+ encryptedShare: string;
228
+ encryptedKey?: string;
229
+ type: string;
230
+ walletId: string;
231
+ }[];
232
+ }, any>>;
233
+ verifyEmailForRecovery(email: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
234
+ verifyPhoneForRecovery(phone: string, countryCode: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
235
+ verify2FA(email: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
236
+ verify2FAForPhone(phone: string, countryCode: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
237
+ tempTrasmissionInit(message: string, userId?: string): Promise<AxiosResponse<any, any>>;
238
+ tempTrasmission(id: string): Promise<AxiosResponse<any, any>>;
239
+ getPartner(partnerId: string): Promise<AxiosResponse<any, any>>;
240
+ acceptScopes(userId: string, walletId: string, body: AcceptScopesBody): Promise<AxiosResponse<any, any>>;
241
+ getPendingTransaction(userId: string, pendingTransactionId: string): Promise<AxiosResponse<any, any>>;
242
+ acceptPendingTransaction(userId: string, pendingTransactionId: string): Promise<AxiosResponse<any, any>>;
243
+ getOnRampConfig(): Promise<OnRampConfig>;
244
+ createOnRampPurchase({ userId, params: { type, walletType, address, provider, networks, assets, defaultNetwork, defaultAsset, fiat, fiatQuantity, testMode, }, ...params }: {
245
+ userId: string;
246
+ params: OnRampPurchaseCreateParams;
247
+ } & WalletParams): Promise<OnRampPurchase>;
248
+ updateOnRampPurchase({ userId, purchaseId, updates, ...params }: {
249
+ userId: string;
250
+ purchaseId: string;
251
+ updates: OnRampPurchaseUpdateParams;
252
+ } & WalletParams): Promise<OnRampPurchase>;
253
+ getOnRampPurchase({ userId, purchaseId, ...params }: {
254
+ userId: string;
255
+ purchaseId: string;
256
+ } & WalletParams): Promise<AxiosResponse<OnRampPurchase, any>>;
257
+ signMoonPayUrl(userId: string, { url, type, cosmosPrefix, testMode, walletId, externalWalletAddress, }: {
258
+ url: string;
259
+ type: WalletType;
260
+ cosmosPrefix: string;
261
+ testMode?: boolean;
262
+ walletId?: string;
263
+ externalWalletAddress?: string;
264
+ }): Promise<AxiosResponse<{
265
+ signature: string;
266
+ }, any>>;
267
+ generateOffRampTx<ReturnType = {
268
+ tx: string;
269
+ asset: OnRampAsset;
270
+ network: Network;
271
+ }>(userId: string, { provider, chainId, contractAddress, testMode, walletId, walletType, destinationAddress, sourceAddress, assetQuantity, }: {
272
+ provider: OnRampProvider;
273
+ chainId: string;
274
+ contractAddress?: string;
275
+ testMode?: boolean;
276
+ walletId: string;
277
+ walletType: WalletType;
278
+ destinationAddress: string;
279
+ sourceAddress?: string;
280
+ assetQuantity: string | number;
281
+ }): Promise<ReturnType>;
282
+ sendOffRampTx<ReturnType = {
283
+ txHash: string;
284
+ }>(userId: string, { tx, signature, network, walletId, walletType, }: {
285
+ tx: string;
286
+ signature: string;
287
+ network: Network;
288
+ walletId: string;
289
+ walletType: WalletType;
290
+ }): Promise<ReturnType>;
291
+ distributeParaShare({ userId, walletId, ...rest }: {
292
+ userId: string;
293
+ walletId: string;
294
+ useDKLS: boolean;
295
+ } & BackupKitEmailProps): Promise<AxiosResponse<any, any>>;
296
+ keepSessionAlive(userId: string): Promise<any>;
297
+ persistRecoveryPublicKeys(userId: string, publicKeys: string[]): Promise<{
298
+ recoveryPublicKeys: {
299
+ id: string;
300
+ publicKey: string;
301
+ }[];
302
+ }>;
303
+ getRecoveryPublicKeys(userId: string): Promise<{
304
+ recoveryPublicKeys: {
305
+ id: string;
306
+ publicKey: string;
307
+ }[];
308
+ }>;
309
+ uploadEncryptedWalletPrivateKey(userId: string, encryptedWalletPrivateKey: string, encryptionKeyHash: string, biometricPublicKey?: string, passwordId?: string): Promise<any>;
310
+ getEncryptedWalletPrivateKeys(userId: string, encryptionKeyHash: string): Promise<any>;
311
+ getConversionRate(chainId: string, symbol: string, currency: string): Promise<any>;
312
+ getGasEstimate(chainId: string, totalGasPrice: string): Promise<any>;
313
+ getGasOracle(chainId: string): Promise<any>;
314
+ isRefreshDone(userId: string, walletId: string, partnerId?: string, protocolId?: string): Promise<{
315
+ isDone: true;
316
+ }>;
317
+ deletePendingTransaction(userId: string, pendingTransactionId: string): Promise<any>;
318
+ addSessionPasswordPublicKey(userId: string, body: sessionPasswordBody): Promise<any>;
319
+ patchSessionPassword: (partnerId: string, userId: string, passwordId: string, body: sessionPasswordBody) => Promise<any>;
320
+ getSupportedAuthMethods(auth: Auth): Promise<any>;
321
+ getPasswords(auth: Auth): Promise<PasswordEntity[]>;
322
+ verifyPasswordChallenge(partnerId: string, body: verifyPasswordChallengeBody): Promise<any>;
323
+ getEncryptedWalletPrivateKey(passwordId: string): Promise<any>;
324
+ getUser(userId: string): Promise<any>;
325
+ }
326
+ export default Client;
@@ -0,0 +1,4 @@
1
+ export declare const SESSION_COOKIE_HEADER_NAME = "x-capsule-sid";
2
+ export declare const VERSION_HEADER_NAME = "x-capsule-version";
3
+ export declare const PARTNER_ID_HEADER_NAME = "x-partner-id";
4
+ export declare const API_KEY_HEADER_NAME = "X-External-API-Key";
@@ -0,0 +1 @@
1
+ export declare function ParaApiError(message: string, code?: string, status?: number, responseURL?: string): void;
@@ -0,0 +1,5 @@
1
+ export * from './client.js';
2
+ export * from './types/index.js';
3
+ export * from './utils.js';
4
+ import Client from './client.js';
5
+ export default Client;