@getpara/core-sdk 1.8.0 → 2.0.0-alpha.3
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/index.js +4000 -76
- package/dist/cjs/index.js.br +0 -0
- package/dist/cjs/index.js.gz +0 -0
- package/dist/esm/index.js +3964 -53
- package/dist/esm/index.js.br +0 -0
- package/dist/esm/index.js.gz +0 -0
- package/dist/types/ParaCore.d.ts +178 -489
- package/dist/types/constants.d.ts +2 -1
- package/dist/types/external/userManagementClient.d.ts +1 -1
- package/dist/types/index.d.ts +5 -3
- package/dist/types/types/config.d.ts +1 -19
- package/dist/types/types/coreApi.d.ts +437 -0
- package/dist/types/types/index.d.ts +2 -1
- package/dist/types/types/methods.d.ts +143 -0
- package/dist/types/types/wallet.d.ts +2 -4
- package/dist/types/utils/autobind.d.ts +1 -0
- package/dist/types/utils/formatting.d.ts +0 -2
- package/dist/types/utils/index.d.ts +5 -0
- package/dist/types/utils/json.d.ts +1 -0
- package/dist/types/utils/phone.d.ts +7 -0
- package/dist/types/utils/types.d.ts +2 -0
- package/dist/types/utils/url.d.ts +2 -1
- package/dist/types/utils/wallet.d.ts +4 -2
- package/package.json +6 -5
- package/dist/cjs/ParaCore.js +0 -2964
- package/dist/cjs/PlatformUtils.js +0 -15
- package/dist/cjs/StorageUtils.js +0 -15
- package/dist/cjs/constants.js +0 -75
- package/dist/cjs/cryptography/utils.js +0 -350
- package/dist/cjs/errors.js +0 -51
- package/dist/cjs/external/mpcComputationClient.js +0 -62
- package/dist/cjs/external/userManagementClient.js +0 -106
- package/dist/cjs/package.json +0 -3
- package/dist/cjs/shares/KeyContainer.js +0 -89
- package/dist/cjs/shares/recovery.js +0 -127
- package/dist/cjs/shares/shareDistribution.js +0 -104
- package/dist/cjs/transmission/transmissionUtils.js +0 -93
- package/dist/cjs/types/config.js +0 -43
- package/dist/cjs/types/events.js +0 -40
- package/dist/cjs/types/index.js +0 -50
- package/dist/cjs/types/onRamps.js +0 -33
- package/dist/cjs/types/params.js +0 -15
- package/dist/cjs/types/popup.js +0 -35
- package/dist/cjs/types/recovery.js +0 -34
- package/dist/cjs/types/theme.js +0 -15
- package/dist/cjs/types/wallet.js +0 -31
- package/dist/cjs/utils/events.js +0 -45
- package/dist/cjs/utils/formatting.js +0 -120
- package/dist/cjs/utils/index.js +0 -31
- package/dist/cjs/utils/listeners.js +0 -80
- package/dist/cjs/utils/onRamps.js +0 -64
- package/dist/cjs/utils/polling.js +0 -58
- package/dist/cjs/utils/url.js +0 -103
- package/dist/cjs/utils/wallet.js +0 -130
- package/dist/esm/ParaCore.js +0 -2913
- package/dist/esm/PlatformUtils.js +0 -0
- package/dist/esm/StorageUtils.js +0 -0
- package/dist/esm/chunk-UICEQADR.js +0 -68
- package/dist/esm/constants.js +0 -37
- package/dist/esm/cryptography/utils.js +0 -282
- package/dist/esm/errors.js +0 -27
- package/dist/esm/external/mpcComputationClient.js +0 -30
- package/dist/esm/external/userManagementClient.js +0 -71
- package/dist/esm/package.json +0 -4
- package/dist/esm/shares/KeyContainer.js +0 -57
- package/dist/esm/shares/recovery.js +0 -74
- package/dist/esm/shares/shareDistribution.js +0 -64
- package/dist/esm/transmission/transmissionUtils.js +0 -42
- package/dist/esm/types/config.js +0 -20
- package/dist/esm/types/events.js +0 -18
- package/dist/esm/types/index.js +0 -21
- package/dist/esm/types/onRamps.js +0 -11
- package/dist/esm/types/params.js +0 -0
- package/dist/esm/types/popup.js +0 -13
- package/dist/esm/types/recovery.js +0 -12
- package/dist/esm/types/theme.js +0 -0
- package/dist/esm/types/wallet.js +0 -9
- package/dist/esm/utils/events.js +0 -11
- package/dist/esm/utils/formatting.js +0 -80
- package/dist/esm/utils/index.js +0 -6
- package/dist/esm/utils/listeners.js +0 -47
- package/dist/esm/utils/onRamps.js +0 -40
- package/dist/esm/utils/polling.js +0 -18
- package/dist/esm/utils/url.js +0 -77
- package/dist/esm/utils/wallet.js +0 -87
- package/dist/types/types/params.d.ts +0 -70
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, WalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType } from '@getpara/user-management-client';
|
|
2
2
|
import type { pki as pkiType } from 'node-forge';
|
|
3
|
-
import { Ctx, Environment, Theme,
|
|
3
|
+
import { Ctx, Environment, Theme, WalletFilters, WalletTypeProp, Wallet, PortalUrlOptions, ConstructorOpts, CoreAuthInfo, PortalUrlType, CoreMethodParams, CoreMethodResponse, OAuthUrlParams, NewCredentialUrlParams, LoginUrlParams, CoreInterface, ExternalWalletConnectionType } from './types/index.js';
|
|
4
4
|
import { PlatformUtils } from './PlatformUtils.js';
|
|
5
|
-
|
|
6
|
-
export declare abstract class ParaCore {
|
|
5
|
+
export declare abstract class ParaCore implements CoreInterface {
|
|
7
6
|
#private;
|
|
8
7
|
static version?: string;
|
|
9
8
|
ctx: Ctx;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
protected isNativePasskey: boolean;
|
|
10
|
+
get authInfo(): CoreAuthInfo | undefined;
|
|
11
|
+
get email(): AuthIdentifier<'email'> | undefined;
|
|
12
|
+
get phone(): AuthIdentifier<'phone'> | undefined;
|
|
13
|
+
get farcasterUsername(): AuthIdentifier<'farcaster'> | undefined;
|
|
14
|
+
get telegramUserId(): AuthIdentifier<'telegram'> | undefined;
|
|
15
|
+
get externalWalletWithParaAuth(): Wallet | undefined;
|
|
16
|
+
get externalWalletConnectionType(): ExternalWalletConnectionType;
|
|
15
17
|
userId?: string;
|
|
16
18
|
private sessionCookie?;
|
|
17
19
|
private isAwaitingAccountCreation;
|
|
@@ -22,8 +24,8 @@ export declare abstract class ParaCore {
|
|
|
22
24
|
get isPhone(): boolean;
|
|
23
25
|
get isFarcaster(): boolean;
|
|
24
26
|
get isTelegram(): boolean;
|
|
25
|
-
get externalWalletWithParaAuth(): Wallet | undefined;
|
|
26
27
|
get isExternalWalletAuth(): boolean;
|
|
28
|
+
get partnerId(): string | undefined;
|
|
27
29
|
/**
|
|
28
30
|
* The IDs of the currently active wallets, for each supported wallet type. Any signer integrations will default to the first viable wallet ID in this dictionary.
|
|
29
31
|
*/
|
|
@@ -114,10 +116,12 @@ export declare abstract class ParaCore {
|
|
|
114
116
|
portalTheme?: Theme;
|
|
115
117
|
private disableProviderModal?;
|
|
116
118
|
get supportedWalletTypes(): SupportedWalletTypes;
|
|
119
|
+
get cosmosPrefix(): string | undefined;
|
|
117
120
|
get isWalletTypeEnabled(): Partial<Record<WalletType, boolean>>;
|
|
118
121
|
private platformUtils;
|
|
119
122
|
private localStorageGetItem;
|
|
120
123
|
private localStorageSetItem;
|
|
124
|
+
private localStorageRemoveItem;
|
|
121
125
|
private sessionStorageGetItem;
|
|
122
126
|
private sessionStorageSetItem;
|
|
123
127
|
private sessionStorageRemoveItem;
|
|
@@ -127,7 +131,7 @@ export declare abstract class ParaCore {
|
|
|
127
131
|
* Remove all local storage and prefixed session storage.
|
|
128
132
|
* @param {'local' | 'session' | 'secure' | 'all'} type - Type of storage to clear. Defaults to 'all'.
|
|
129
133
|
*/
|
|
130
|
-
clearStorage: (type?: '
|
|
134
|
+
clearStorage: (type?: CoreMethodParams<'clearStorage'>) => CoreMethodResponse<'clearStorage'>;
|
|
131
135
|
private convertBigInt;
|
|
132
136
|
private convertEncryptionKeyPair;
|
|
133
137
|
private isPortal;
|
|
@@ -160,7 +164,7 @@ export declare abstract class ParaCore {
|
|
|
160
164
|
getWallets(): Record<string, Wallet>;
|
|
161
165
|
getAddress(walletId?: string): string | undefined;
|
|
162
166
|
protected abstract getPlatformUtils(): PlatformUtils;
|
|
163
|
-
|
|
167
|
+
protected constructPortalUrl(type: PortalUrlType, opts?: PortalUrlOptions): Promise<string>;
|
|
164
168
|
/**
|
|
165
169
|
* Constructs a new `ParaCore` instance.
|
|
166
170
|
* @param env - `Environment` to use.
|
|
@@ -168,20 +172,16 @@ export declare abstract class ParaCore {
|
|
|
168
172
|
* @param opts - Additional constructor options; see `ConstructorOpts`.
|
|
169
173
|
* @returns - A new ParaCore instance.
|
|
170
174
|
*/
|
|
171
|
-
constructor(env: Environment, apiKey
|
|
175
|
+
constructor(env: Environment, apiKey: string, opts?: ConstructorOpts);
|
|
172
176
|
private initializeFromStorage;
|
|
173
|
-
private
|
|
177
|
+
private updateAuthInfoFromStorage;
|
|
174
178
|
private updateUserIdFromStorage;
|
|
175
|
-
private updatePhoneFromStorage;
|
|
176
|
-
private updateCountryCodeFromStorage;
|
|
177
|
-
private updateEmailFromStorage;
|
|
178
179
|
private updateWalletsFromStorage;
|
|
179
180
|
private updateWalletIdsFromStorage;
|
|
180
181
|
private updateSessionCookieFromStorage;
|
|
181
182
|
private updateLoginEncryptionKeyPairFromStorage;
|
|
182
183
|
private updateExternalWalletsFromStorage;
|
|
183
|
-
touchSession(regenerate?: boolean): Promise<
|
|
184
|
-
private setSupportedWalletTypes;
|
|
184
|
+
touchSession(regenerate?: boolean): Promise<SessionInfo>;
|
|
185
185
|
private getVerificationEmailProps;
|
|
186
186
|
private getBackupKitEmailProps;
|
|
187
187
|
/**
|
|
@@ -190,6 +190,13 @@ export declare abstract class ParaCore {
|
|
|
190
190
|
* Init only needs to be called for storage that is async.
|
|
191
191
|
*/
|
|
192
192
|
init(): Promise<void>;
|
|
193
|
+
protected setAuth(auth: PrimaryAuth, { extras, userId }?: {
|
|
194
|
+
extras?: AuthExtras;
|
|
195
|
+
userId?: string;
|
|
196
|
+
}): Promise<typeof this.authInfo>;
|
|
197
|
+
protected assertUserId(): string;
|
|
198
|
+
protected assertIsAuthSet(allowed?: AuthType[]): PrimaryAuthInfo;
|
|
199
|
+
assertIsUser: any;
|
|
193
200
|
/**
|
|
194
201
|
* Sets the email associated with the `ParaCore` instance.
|
|
195
202
|
* @param email - Email to set.
|
|
@@ -205,7 +212,7 @@ export declare abstract class ParaCore {
|
|
|
205
212
|
* @param phone - Phone number to set.
|
|
206
213
|
* @param countryCode - Country Code to set.
|
|
207
214
|
*/
|
|
208
|
-
|
|
215
|
+
setPhone(phone: `+${number}` | string, countryCode?: string): Promise<void>;
|
|
209
216
|
/**
|
|
210
217
|
* Sets the farcaster username associated with the `ParaCore` instance.
|
|
211
218
|
* @param farcasterUsername - Farcaster Username to set.
|
|
@@ -248,19 +255,11 @@ export declare abstract class ParaCore {
|
|
|
248
255
|
* @returns - email associated with the `ParaCore` instance.
|
|
249
256
|
*/
|
|
250
257
|
getEmail(): string | undefined;
|
|
251
|
-
/**
|
|
252
|
-
* Gets the phone object associated with the `ParaCore` instance.
|
|
253
|
-
* @returns - phone object with phone number and country code associated with the `ParaCore` instance.
|
|
254
|
-
*/
|
|
255
|
-
getPhone(): {
|
|
256
|
-
phone?: string;
|
|
257
|
-
countryCode?: string;
|
|
258
|
-
};
|
|
259
258
|
/**
|
|
260
259
|
* Gets the formatted phone number associated with the `ParaCore` instance.
|
|
261
260
|
* @returns - formatted phone number associated with the `ParaCore` instance.
|
|
262
261
|
*/
|
|
263
|
-
getPhoneNumber():
|
|
262
|
+
getPhoneNumber(): `+${number}` | undefined;
|
|
264
263
|
/**
|
|
265
264
|
* Gets the farcaster username associated with the `ParaCore` instance.
|
|
266
265
|
* @returns - farcaster username associated with the `ParaCore` instance.
|
|
@@ -271,16 +270,6 @@ export declare abstract class ParaCore {
|
|
|
271
270
|
sessionLookupId?: string;
|
|
272
271
|
newDeviceSessionLookupId?: string;
|
|
273
272
|
}): Promise<void>;
|
|
274
|
-
/**
|
|
275
|
-
* Fetches the most recent OAuth account metadata for the signed-in user.
|
|
276
|
-
* If applicable, this will include the user's most recent metadata from their Google, Apple, Facebook, X, Discord, Farcaster, or Telegram account, the last time they signed in to your app.
|
|
277
|
-
* @returns {Promise<AccountMetadata>} the user's account metadata.
|
|
278
|
-
*/
|
|
279
|
-
getAccountMetadata(): Promise<AccountMetadata>;
|
|
280
|
-
/**
|
|
281
|
-
* The prefix for the instance's managed Cosmos wallets. Defaults to `'cosmos'`.
|
|
282
|
-
*/
|
|
283
|
-
cosmosPrefix?: string;
|
|
284
273
|
/**
|
|
285
274
|
* Validates that a wallet ID is present on the instance, usable, and matches the desired filters.
|
|
286
275
|
* If no ID is passed, this will instead return the first valid, usable wallet ID that matches the filters.
|
|
@@ -315,29 +304,7 @@ export declare abstract class ParaCore {
|
|
|
315
304
|
* @param partnerId: string - id of the partner to get the portal URL for
|
|
316
305
|
* @returns - portal URL
|
|
317
306
|
*/
|
|
318
|
-
protected getPortalURL(
|
|
319
|
-
private getWebAuthURLForCreate;
|
|
320
|
-
private getPasswordURLForCreate;
|
|
321
|
-
private getShortUrl;
|
|
322
|
-
shortenLoginLink(link: string): Promise<string>;
|
|
323
|
-
/**
|
|
324
|
-
* Generates a URL for registering a new WebAuth passkey.
|
|
325
|
-
* @param {GetWebAuthUrlForLoginParams} opts the options object
|
|
326
|
-
* @returns - the URL for creating a new passkey
|
|
327
|
-
*/
|
|
328
|
-
getWebAuthURLForLogin(opts: GetWebAuthUrlForLoginParams): Promise<string>;
|
|
329
|
-
/**
|
|
330
|
-
* Generates a URL for registering a new user password.
|
|
331
|
-
* @param {GetWebAuthUrlForLoginParams} opts the options object
|
|
332
|
-
* @returns - the URL for creating a new password
|
|
333
|
-
*/
|
|
334
|
-
getPasswordURLForLogin(opts: GetWebAuthUrlForLoginParams): Promise<string>;
|
|
335
|
-
/**
|
|
336
|
-
* Generates a URL for registering a new WebAuth passkey for a phone number.
|
|
337
|
-
* @param {Omit<GetWebAuthUrlForLoginParams, 'authType'>} opts the options object
|
|
338
|
-
* @returns - web auth url
|
|
339
|
-
*/
|
|
340
|
-
getWebAuthURLForLoginForPhone(opts: Omit<GetWebAuthUrlForLoginParams, 'authType'>): Promise<string>;
|
|
307
|
+
protected getPortalURL(): Promise<string>;
|
|
341
308
|
/**
|
|
342
309
|
* Gets the private key for the given wallet.
|
|
343
310
|
* @param {string } [walletId] id of the wallet to get the private key for. Will default to the first wallet if not provided.
|
|
@@ -348,281 +315,30 @@ export declare abstract class ParaCore {
|
|
|
348
315
|
* Fetches the wallets associated with the user.
|
|
349
316
|
* @returns {WalletEntity[]} wallets that were fetched.
|
|
350
317
|
*/
|
|
351
|
-
fetchWallets():
|
|
318
|
+
fetchWallets(): CoreMethodResponse<'fetchWallets'>;
|
|
352
319
|
private populateWalletAddresses;
|
|
353
320
|
private populatePregenWalletAddresses;
|
|
354
|
-
/**
|
|
355
|
-
* Checks if a user exists for an email address.
|
|
356
|
-
* @param {Object} opts the options object
|
|
357
|
-
* @param {string} opts.email the email to check.
|
|
358
|
-
* @returns true if user exists, false otherwise.
|
|
359
|
-
*/
|
|
360
|
-
checkIfUserExists({ email }: {
|
|
361
|
-
email: string;
|
|
362
|
-
}): Promise<boolean>;
|
|
363
|
-
/**
|
|
364
|
-
* Checks if a user exists for a phone number.
|
|
365
|
-
* @param {Object} opts the options object
|
|
366
|
-
* @param {string} opts.phone - phone number to check.
|
|
367
|
-
* @param {string} opts.countryCode - the country code.
|
|
368
|
-
* @returns true if user exists, false otherwise.
|
|
369
|
-
*/
|
|
370
|
-
checkIfUserExistsByPhone({ phone, countryCode }: {
|
|
371
|
-
phone: string;
|
|
372
|
-
countryCode: string;
|
|
373
|
-
}): Promise<boolean>;
|
|
374
|
-
/**
|
|
375
|
-
* Creates a new user.
|
|
376
|
-
* @param {Object} opts the options object
|
|
377
|
-
* @param {string} opts.email the email to use.
|
|
378
|
-
*/
|
|
379
|
-
createUser({ email }: Auth<'email'>): Promise<void>;
|
|
380
|
-
/**
|
|
381
|
-
* Creates a new user with a phone number.
|
|
382
|
-
* @param {Object} opts the options object
|
|
383
|
-
* @param {string} opts.phone - the phone number to use for creating the user.
|
|
384
|
-
* @param {string} opts.countryCode - the country code to use for creating the user.
|
|
385
|
-
*/
|
|
386
|
-
createUserByPhone({ phone, countryCode }: Auth<'phone'>): Promise<void>;
|
|
387
|
-
/**
|
|
388
|
-
* Logs in or creates a new user using an external wallet address.
|
|
389
|
-
* @param {Object} opts the options object
|
|
390
|
-
* @param {string} opts.address the external wallet address to use for identification.
|
|
391
|
-
* @param {WalletType} opts.type type of external wallet to use for identification.
|
|
392
|
-
* @param {string} opts.provider the name of the provider for the external wallet.
|
|
393
|
-
*/
|
|
394
|
-
externalWalletLogin(wallet: ExternalWalletInfo): Promise<ExternalWalletLoginRes>;
|
|
395
|
-
/**
|
|
396
|
-
* Returns whether or not the user is connected with only an external wallet, not an external wallet with Para auth.
|
|
397
|
-
*/
|
|
398
|
-
protected isUsingExternalWallet(): boolean;
|
|
399
|
-
/**
|
|
400
|
-
* Passes the email code obtained from the user for verification.
|
|
401
|
-
* @param {Object} opts the options object
|
|
402
|
-
* @param {string} verificationCode the six-digit code to check
|
|
403
|
-
* @returns {string} the web auth url for creating a new credential
|
|
404
|
-
*/
|
|
405
|
-
verifyEmail({ verificationCode }: {
|
|
406
|
-
verificationCode: string;
|
|
407
|
-
}): Promise<string>;
|
|
408
|
-
verifyExternalWallet({ address, signedMessage, cosmosPublicKeyHex, cosmosSigner, }: {
|
|
409
|
-
address: string;
|
|
410
|
-
signedMessage: string;
|
|
411
|
-
cosmosPublicKeyHex?: string;
|
|
412
|
-
cosmosSigner?: string;
|
|
413
|
-
}): Promise<string>;
|
|
414
|
-
/**
|
|
415
|
-
* Passes the phone code obtained from the user for verification.
|
|
416
|
-
* @param {Object} opts the options object
|
|
417
|
-
* @param {string} verificationCode the six-digit code to check
|
|
418
|
-
* @returns {string} the web auth url for creating a new credential
|
|
419
|
-
*/
|
|
420
|
-
verifyPhone({ verificationCode }: {
|
|
421
|
-
verificationCode: string;
|
|
422
|
-
}): Promise<string>;
|
|
423
|
-
/**
|
|
424
|
-
* Validates the response received from an attempted Telegram login for authenticity, then
|
|
425
|
-
* creates or retrieves the corresponding Para user and prepares the Para instance to sign in with that user.
|
|
426
|
-
* @param authResponse - the response JSON object received from the Telegram widget.
|
|
427
|
-
* @returns `{ isValid: boolean; telegramUserId?: string; userId?: string; isNewUser?: boolean; supportedAuthMethods?: AuthMethod[]; biometricHints?: BiometricLocationHint[] }`
|
|
428
|
-
*/
|
|
429
|
-
verifyTelegram(authObject: TelegramAuthResponse): Promise<VerifyTelegramRes>;
|
|
430
|
-
/**
|
|
431
|
-
* Performs 2FA verification.
|
|
432
|
-
* @param {Object} opts the options object
|
|
433
|
-
* @param {string} opts.email the email to use for performing a 2FA verification.
|
|
434
|
-
* @param {string} opts.verificationCode the verification code to received via 2FA.
|
|
435
|
-
* @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
|
|
436
|
-
*/
|
|
437
|
-
verify2FA({ email, verificationCode }: {
|
|
438
|
-
email: string;
|
|
439
|
-
verificationCode: string;
|
|
440
|
-
}): Promise<{
|
|
441
|
-
initiatedAt?: Date;
|
|
442
|
-
status?: RecoveryStatus;
|
|
443
|
-
userId: string;
|
|
444
|
-
wallets: Pick<Wallet, 'address' | 'id'>[];
|
|
445
|
-
}>;
|
|
446
|
-
/**
|
|
447
|
-
* Performs 2FA verification.
|
|
448
|
-
* @param {Object} opts the options object
|
|
449
|
-
* @param {string} opts.phone the phone number
|
|
450
|
-
* @param {string} opts.countryCode - the country code
|
|
451
|
-
* @param {string} opts.verificationCode - verification code to received via 2FA.
|
|
452
|
-
* @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
|
|
453
|
-
*/
|
|
454
|
-
verify2FAForPhone({ phone, countryCode, verificationCode, }: {
|
|
455
|
-
phone: string;
|
|
456
|
-
countryCode: string;
|
|
457
|
-
verificationCode: string;
|
|
458
|
-
}): Promise<{
|
|
459
|
-
initiatedAt?: Date;
|
|
460
|
-
status?: RecoveryStatus;
|
|
461
|
-
userId: string;
|
|
462
|
-
wallets: Pick<Wallet, 'address' | 'id'>[];
|
|
463
|
-
}>;
|
|
464
|
-
/**
|
|
465
|
-
* Sets up two-factor authentication for the current user.
|
|
466
|
-
* @returns {string} uri - uri to use for setting up 2FA
|
|
467
|
-
* */
|
|
468
|
-
setup2FA(): Promise<{
|
|
469
|
-
uri?: string;
|
|
470
|
-
}>;
|
|
471
|
-
/**
|
|
472
|
-
* Enables 2FA.
|
|
473
|
-
* @param {Object} opts the options object
|
|
474
|
-
* @param {string} opts.verificationCode - the verification code received via 2FA.
|
|
475
|
-
*/
|
|
476
|
-
enable2FA({ verificationCode }: {
|
|
477
|
-
verificationCode: string;
|
|
478
|
-
}): Promise<void>;
|
|
479
|
-
/**
|
|
480
|
-
* Determines if 2FA has been set up.
|
|
481
|
-
* @returns {Object} `{ isSetup: boolean }` - true if 2FA is setup, false otherwise
|
|
482
|
-
*/
|
|
483
|
-
check2FAStatus(): Promise<{
|
|
484
|
-
isSetup: boolean;
|
|
485
|
-
}>;
|
|
486
321
|
/**
|
|
487
322
|
* Resend a verification email for the current user.
|
|
488
323
|
*/
|
|
489
|
-
resendVerificationCode():
|
|
490
|
-
/**
|
|
491
|
-
* Resend a verification SMS for the current user.
|
|
492
|
-
*/
|
|
493
|
-
resendVerificationCodeByPhone(): Promise<void>;
|
|
494
|
-
/**
|
|
495
|
-
* Returns a URL for setting up a new WebAuth passkey.
|
|
496
|
-
* @param {Object} opts the options object
|
|
497
|
-
* @param {string} opts.authType - the auth type to use
|
|
498
|
-
* @param {boolean} opts.isForNewDevice whether the passkey is for a new device of an existing user
|
|
499
|
-
* @returns {string} the URL
|
|
500
|
-
*/
|
|
501
|
-
getSetUpBiometricsURL({ authType, isForNewDevice, }?: Pick<PortalUrlOptions, 'authType' | 'isForNewDevice'>): Promise<string>;
|
|
502
|
-
/**
|
|
503
|
-
* Returns a URL for setting up a new WebAuth passkey for a phone number.
|
|
504
|
-
* @param {Object} opts the options object
|
|
505
|
-
* @param {boolean} opts.isForNewDevice whether the passkey is for a new device of an existing user
|
|
506
|
-
* @returns {string} the URL
|
|
507
|
-
*/
|
|
508
|
-
getSetUpBiometricsURLForPhone({ isForNewDevice, }?: Pick<PortalUrlOptions, 'isForNewDevice'>): Promise<string>;
|
|
509
|
-
/**
|
|
510
|
-
* Returns a URL for setting up a new password.
|
|
511
|
-
* @param {Object} opts the options object
|
|
512
|
-
* @param {string} opts.authType - the auth type to use
|
|
513
|
-
* @param {boolean} opts.isForNewDevice whether the passkey is for a new device of an existing user
|
|
514
|
-
* @param {Theme} [opts.theme] the portal theme to use in place of the partner's default
|
|
515
|
-
* @returns {string} the URL
|
|
516
|
-
*/
|
|
517
|
-
getSetupPasswordURL({ authType, isForNewDevice, theme, }?: Pick<PortalUrlOptions, 'authType' | 'isForNewDevice' | 'theme'>): Promise<string>;
|
|
324
|
+
resendVerificationCode(): CoreMethodResponse<'resendVerificationCode'>;
|
|
518
325
|
/**
|
|
519
326
|
* Checks if the current session is active.
|
|
520
327
|
* @returns `true` if active, `false` otherwise
|
|
521
328
|
*/
|
|
522
|
-
isSessionActive():
|
|
329
|
+
isSessionActive(): CoreMethodResponse<'isSessionActive'>;
|
|
523
330
|
/**
|
|
524
331
|
* Checks if a session is active and a wallet exists.
|
|
525
332
|
* @returns `true` if active, `false` otherwise
|
|
526
333
|
**/
|
|
527
|
-
isFullyLoggedIn():
|
|
528
|
-
protected supportedAuthMethods(auth: Auth): Promise<Set<AuthMethod>>;
|
|
334
|
+
isFullyLoggedIn(): CoreMethodResponse<'isFullyLoggedIn'>;
|
|
335
|
+
protected supportedAuthMethods(auth: Auth<PrimaryAuthType | 'userId'>): Promise<Set<AuthMethod>>;
|
|
529
336
|
/**
|
|
530
337
|
* Get hints associated with the users stored biometrics.
|
|
338
|
+
* @deprecated
|
|
531
339
|
* @returns Array containing useragents and AAGuids for stored biometrics
|
|
532
340
|
*/
|
|
533
341
|
protected getUserBiometricLocationHints(): Promise<BiometricLocationHint[]>;
|
|
534
|
-
private setAuth;
|
|
535
|
-
/**
|
|
536
|
-
* Initiates a login.
|
|
537
|
-
* @param {Object} opts the options object
|
|
538
|
-
* @param {String} opts.email - the email to login with
|
|
539
|
-
* @param {boolean} opts.useShortURL - whether to shorten the link
|
|
540
|
-
* @returns - the WebAuth URL for logging in
|
|
541
|
-
**/
|
|
542
|
-
initiateUserLogin({ useShortUrl, ...auth }: Auth & {
|
|
543
|
-
useShortUrl?: boolean;
|
|
544
|
-
}): Promise<string>;
|
|
545
|
-
/**
|
|
546
|
-
* Initiates a login.
|
|
547
|
-
* @param email - the email to login with
|
|
548
|
-
* @returns - a set of supported auth methods for the user
|
|
549
|
-
**/
|
|
550
|
-
initiateUserLoginV2(auth: Auth): Promise<Set<AuthMethod>>;
|
|
551
|
-
/**
|
|
552
|
-
* Initiates a login.
|
|
553
|
-
* @param opts the options object
|
|
554
|
-
* @param opts.phone the phone number
|
|
555
|
-
* @param opts.countryCode the country code
|
|
556
|
-
* @param opts.useShortURL - whether to shorten the link
|
|
557
|
-
* @returns - the WebAuth URL for logging in
|
|
558
|
-
**/
|
|
559
|
-
initiateUserLoginForPhone({ useShortUrl, ...auth }: Auth<'phone'> & {
|
|
560
|
-
useShortUrl?: boolean;
|
|
561
|
-
}): Promise<string>;
|
|
562
|
-
/**
|
|
563
|
-
* Waits for the session to be active.
|
|
564
|
-
**/
|
|
565
|
-
waitForAccountCreation({ popupWindow }?: {
|
|
566
|
-
popupWindow?: Window;
|
|
567
|
-
}): Promise<boolean>;
|
|
568
|
-
waitForPasskeyAndCreateWallet({ popupWindow, }?: {
|
|
569
|
-
popupWindow?: Window;
|
|
570
|
-
}): Promise<AccountSetupResponse>;
|
|
571
|
-
/**
|
|
572
|
-
* Initiates a Farcaster login attempt and return the URI for the user to connect.
|
|
573
|
-
* You can create a QR code with this URI that works with Farcaster's mobile app.
|
|
574
|
-
* @return {string} the Farcaster connect URI
|
|
575
|
-
*/
|
|
576
|
-
getFarcasterConnectURL(): Promise<string>;
|
|
577
|
-
/**
|
|
578
|
-
* Awaits the response from a user's attempt to log in with Farcaster.
|
|
579
|
-
* If successful, this returns the user's Farcaster username and profile picture and indicates whether the user already exists.
|
|
580
|
-
* @return {Object} `{userExists: boolean; username: string; pfpUrl?: string | null }` - the user's information and whether the user already exists.
|
|
581
|
-
*/
|
|
582
|
-
waitForFarcasterStatus(): Promise<{
|
|
583
|
-
userExists: boolean;
|
|
584
|
-
username: string;
|
|
585
|
-
pfpUrl?: string | null;
|
|
586
|
-
}>;
|
|
587
|
-
/**
|
|
588
|
-
* Generates a URL for the user to log in with OAuth using a desire method.
|
|
589
|
-
*
|
|
590
|
-
* @param {Object} opts the options object
|
|
591
|
-
* @param {OAuthMethod} opts.method the third-party service to use for OAuth.
|
|
592
|
-
* @param {string} [opts.deeplinkUrl] the deeplink to redirect to after the OAuth flow. This is for mobile only.
|
|
593
|
-
* @returns {string} the URL for the user to log in with OAuth.
|
|
594
|
-
*/
|
|
595
|
-
getOAuthURL({ method, deeplinkUrl }: {
|
|
596
|
-
method: OAuthMethod;
|
|
597
|
-
deeplinkUrl?: string;
|
|
598
|
-
}): Promise<string>;
|
|
599
|
-
/**
|
|
600
|
-
* Awaits the response from a user's attempt to log in with OAuth.
|
|
601
|
-
* If successful, this returns the user's email address and indicates whether the user already exists.
|
|
602
|
-
*
|
|
603
|
-
* @param {Object} opts the options object.
|
|
604
|
-
* @param {Window} [opts.popupWindow] the popup window being used for login.
|
|
605
|
-
* @return {Object} `{ email?: string; isError?: boolean; userExists: boolean; }` the result data
|
|
606
|
-
*/
|
|
607
|
-
waitForOAuth({ popupWindow }?: {
|
|
608
|
-
popupWindow?: Window;
|
|
609
|
-
}): Promise<{
|
|
610
|
-
email?: string;
|
|
611
|
-
isError?: boolean;
|
|
612
|
-
userExists: boolean;
|
|
613
|
-
}>;
|
|
614
|
-
/**
|
|
615
|
-
* Waits for the session to be active and sets up the user.
|
|
616
|
-
*
|
|
617
|
-
* @param {Object} opts the options object
|
|
618
|
-
* @param {Window} [opts.popupWindow] the popup window being used for login.
|
|
619
|
-
* @param {boolean} [opts.skipSessionRefresh] whether to skip refreshing the session.
|
|
620
|
-
* @returns {Object} `{ isComplete: boolean; isError: boolean; needsWallet: boolean; partnerId: string; }` the result data
|
|
621
|
-
**/
|
|
622
|
-
waitForLoginAndSetup({ popupWindow, skipSessionRefresh, }?: {
|
|
623
|
-
popupWindow?: Window;
|
|
624
|
-
skipSessionRefresh?: boolean;
|
|
625
|
-
}): Promise<LoginResponse>;
|
|
626
342
|
/**
|
|
627
343
|
* Updates the session with the user management server, possibly
|
|
628
344
|
* opening a popup to refresh the session.
|
|
@@ -631,20 +347,12 @@ export declare abstract class ParaCore {
|
|
|
631
347
|
* @param {boolean} [shouldOpenPopup] - if `true`, the running device will open a popup to reauthenticate the user.
|
|
632
348
|
* @returns a URL for the user to reauthenticate.
|
|
633
349
|
**/
|
|
634
|
-
refreshSession({ shouldOpenPopup }?:
|
|
635
|
-
shouldOpenPopup?: boolean;
|
|
636
|
-
}): Promise<string>;
|
|
350
|
+
refreshSession({ shouldOpenPopup, }?: CoreMethodParams<'refreshSession'>): CoreMethodResponse<'refreshSession'>;
|
|
637
351
|
/**
|
|
638
352
|
* Call this method after login to ensure that the user ID is set
|
|
639
353
|
* internally.
|
|
640
354
|
**/
|
|
641
|
-
protected userSetupAfterLogin(): Promise<
|
|
642
|
-
data: {
|
|
643
|
-
partnerId?: string;
|
|
644
|
-
needsWallet?: boolean;
|
|
645
|
-
sessionLookupId: string;
|
|
646
|
-
};
|
|
647
|
-
}>;
|
|
355
|
+
protected userSetupAfterLogin(): Promise<SessionInfo>;
|
|
648
356
|
/**
|
|
649
357
|
* Get transmission shares associated with session.
|
|
650
358
|
* @param {Object} opts the options object.
|
|
@@ -660,7 +368,7 @@ export declare abstract class ParaCore {
|
|
|
660
368
|
* @param {any[]} opts.temporaryShares optional temporary shares to use for decryption.
|
|
661
369
|
* @param {boolean} [opts.skipSessionRefresh] - whether or not to skip refreshing the session.
|
|
662
370
|
**/
|
|
663
|
-
setupAfterLogin({ temporaryShares, skipSessionRefresh, }?: {
|
|
371
|
+
protected setupAfterLogin({ temporaryShares, skipSessionRefresh, }?: {
|
|
664
372
|
temporaryShares?: any[];
|
|
665
373
|
skipSessionRefresh?: boolean;
|
|
666
374
|
}): Promise<void>;
|
|
@@ -673,12 +381,7 @@ export declare abstract class ParaCore {
|
|
|
673
381
|
* @param {boolean} opts.forceRefreshRecovery whether or not to force recovery secret regeneration. Used when regenerating recovery shares.
|
|
674
382
|
* @returns {string} the recovery share.
|
|
675
383
|
**/
|
|
676
|
-
distributeNewWalletShare({ walletId, userShare, skipBiometricShareCreation, forceRefresh, }:
|
|
677
|
-
walletId: string;
|
|
678
|
-
userShare?: string;
|
|
679
|
-
skipBiometricShareCreation?: boolean;
|
|
680
|
-
forceRefresh?: boolean;
|
|
681
|
-
}): Promise<string>;
|
|
384
|
+
distributeNewWalletShare({ walletId, userShare, skipBiometricShareCreation, forceRefresh, }: CoreMethodParams<'distributeNewWalletShare'>): CoreMethodResponse<'distributeNewWalletShare'>;
|
|
682
385
|
private waitForWalletAddress;
|
|
683
386
|
/**
|
|
684
387
|
* Waits for a pregen wallet address to be created.
|
|
@@ -697,14 +400,7 @@ export declare abstract class ParaCore {
|
|
|
697
400
|
*
|
|
698
401
|
* @deprecated alias for `createWalletPerType`
|
|
699
402
|
**/
|
|
700
|
-
createWalletPerMissingType: ({ skipDistribute, types, }?:
|
|
701
|
-
skipDistribute?: boolean;
|
|
702
|
-
types?: WalletType[];
|
|
703
|
-
}) => Promise<{
|
|
704
|
-
wallets: Wallet[];
|
|
705
|
-
walletIds: CurrentWalletIds;
|
|
706
|
-
recoverySecret?: string;
|
|
707
|
-
}>;
|
|
403
|
+
createWalletPerMissingType: ({ skipDistribute, types, }?: CoreMethodParams<'createWalletPerType'>) => CoreMethodResponse<'createWalletPerType'>;
|
|
708
404
|
/**
|
|
709
405
|
* Creates several new wallets with the desired types. If no types are provided, this method
|
|
710
406
|
* will create one for each of the non-optional types specified in the instance's `supportedWalletTypes`
|
|
@@ -716,14 +412,7 @@ export declare abstract class ParaCore {
|
|
|
716
412
|
* @param {WalletType[]} [opts.types] the types of wallets to create.
|
|
717
413
|
* @returns {Object} the wallets created, their ids, and the recovery secret.
|
|
718
414
|
**/
|
|
719
|
-
createWalletPerType({ skipDistribute, types, }?:
|
|
720
|
-
skipDistribute?: boolean;
|
|
721
|
-
types?: WalletType[];
|
|
722
|
-
}): Promise<{
|
|
723
|
-
wallets: Wallet[];
|
|
724
|
-
walletIds: CurrentWalletIds;
|
|
725
|
-
recoverySecret?: string;
|
|
726
|
-
}>;
|
|
415
|
+
createWalletPerType({ skipDistribute, types, }?: CoreMethodParams<'createWalletPerType'>): CoreMethodResponse<'createWalletPerType'>;
|
|
727
416
|
/**
|
|
728
417
|
* Refresh the current user share for a wallet.
|
|
729
418
|
*
|
|
@@ -736,19 +425,7 @@ export declare abstract class ParaCore {
|
|
|
736
425
|
* @param {boolean} [opts.redistributeBackupEncryptedShares] whether or not to redistribute backup encrypted shares.
|
|
737
426
|
* @returns {Object} the new user share and recovery secret.
|
|
738
427
|
**/
|
|
739
|
-
refreshShare({ walletId, share, oldPartnerId, newPartnerId, keyShareProtocolId, redistributeBackupEncryptedShares, }:
|
|
740
|
-
walletId: string;
|
|
741
|
-
share: string;
|
|
742
|
-
oldPartnerId?: string;
|
|
743
|
-
newPartnerId?: string;
|
|
744
|
-
keyShareProtocolId?: string;
|
|
745
|
-
redistributeBackupEncryptedShares?: boolean;
|
|
746
|
-
emailProps?: BackupKitEmailProps;
|
|
747
|
-
}): Promise<{
|
|
748
|
-
signer: string;
|
|
749
|
-
recoverySecret?: string;
|
|
750
|
-
protocolId: string;
|
|
751
|
-
}>;
|
|
428
|
+
refreshShare({ walletId, share, oldPartnerId, newPartnerId, keyShareProtocolId, redistributeBackupEncryptedShares, }: CoreMethodParams<'refreshShare'>): CoreMethodResponse<'refreshShare'>;
|
|
752
429
|
/**
|
|
753
430
|
* Creates a new wallet.
|
|
754
431
|
* @param {Object} opts the options object.
|
|
@@ -756,99 +433,20 @@ export declare abstract class ParaCore {
|
|
|
756
433
|
* @param {boolean} opts.skipDistribute - if true, recovery share will not be distributed.
|
|
757
434
|
* @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
|
|
758
435
|
**/
|
|
759
|
-
createWallet({ type: _type, skipDistribute, }?:
|
|
760
|
-
type?: WalletType;
|
|
761
|
-
skipDistribute?: boolean;
|
|
762
|
-
}): Promise<[Wallet, string | null]>;
|
|
763
|
-
/**
|
|
764
|
-
* Creates a new pregenerated wallet.
|
|
765
|
-
*
|
|
766
|
-
* @param {Object} opts the options object.
|
|
767
|
-
* @param {string} opts.pregenIdentifier the identifier associated with the new wallet.
|
|
768
|
-
* @param {TPregenIdentifierType} [opts.pregenIdentifierType] the identifier type. Defaults to `EMAIL`.
|
|
769
|
-
* @param {WalletType} [opts.type] the type of wallet to create. Defaults to the first non-optional type in the instance's `supportedWalletTypes` array.
|
|
770
|
-
* @returns {Wallet} the created wallet.
|
|
771
|
-
**/
|
|
772
|
-
createPregenWallet(opts: {
|
|
773
|
-
type: WalletType;
|
|
774
|
-
pregenIdentifier: string;
|
|
775
|
-
pregenIdentifierType: TPregenIdentifierType;
|
|
776
|
-
}): Promise<Wallet>;
|
|
777
|
-
/**
|
|
778
|
-
* Creates new pregenerated wallets for each desired type.
|
|
779
|
-
* If no types are provided, this method will create one for each of the non-optional types
|
|
780
|
-
* specified in the instance's `supportedWalletTypes` array that are not already present.
|
|
781
|
-
* @param {Object} opts the options object.
|
|
782
|
-
* @param {string} opts.pregenIdentifier the identifier to associate each wallet with.
|
|
783
|
-
* @param {TPregenIdentifierType} opts.pregenIdentifierType - either `'EMAIL'` or `'PHONE'`.
|
|
784
|
-
* @param {WalletType[]} [opts.types] the wallet types to create. Defaults to any types the instance supports that are not already present.
|
|
785
|
-
* @returns {Wallet[]} an array containing the created wallets.
|
|
786
|
-
**/
|
|
787
|
-
createPregenWalletPerType({ types, pregenIdentifier, pregenIdentifierType, }: {
|
|
788
|
-
pregenIdentifier: string;
|
|
789
|
-
pregenIdentifierType: TPregenIdentifierType;
|
|
790
|
-
types?: WalletType[];
|
|
791
|
-
}): Promise<Wallet[]>;
|
|
792
|
-
/**
|
|
793
|
-
* Claims a pregenerated wallet.
|
|
794
|
-
*
|
|
795
|
-
* @param {Object} opts the options object.
|
|
796
|
-
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
797
|
-
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the identifier of the user claiming the wallet
|
|
798
|
-
* @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
|
|
799
|
-
**/
|
|
800
|
-
claimPregenWallets({ pregenIdentifier, pregenIdentifierType, }?: {
|
|
801
|
-
pregenIdentifier?: string;
|
|
802
|
-
pregenIdentifierType?: TPregenIdentifierType;
|
|
803
|
-
}): Promise<string | undefined>;
|
|
804
|
-
/**
|
|
805
|
-
* Updates the identifier for a pregen wallet.
|
|
806
|
-
* @param {Object} opts the options object.
|
|
807
|
-
* @param {string} opts.walletId the pregen wallet ID
|
|
808
|
-
* @param {string} opts.newPregenIdentifier the new identtifier
|
|
809
|
-
* @param {TPregenIdentifierType} opts.newPregenIdentifierType: the new identifier type
|
|
810
|
-
**/
|
|
811
|
-
updatePregenWalletIdentifier({ walletId, newPregenIdentifier, newPregenIdentifierType, }: {
|
|
812
|
-
walletId: string;
|
|
813
|
-
newPregenIdentifier: string;
|
|
814
|
-
newPregenIdentifierType: TPregenIdentifierType;
|
|
815
|
-
}): Promise<void>;
|
|
816
|
-
/**
|
|
817
|
-
* Checks if a pregen Wallet exists for the given identifier with the current partner.
|
|
818
|
-
* @param {Object} opts the options object.
|
|
819
|
-
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
820
|
-
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the string of the identifier of the user claiming the wallet
|
|
821
|
-
* @returns {boolean} whether the pregen wallet exists
|
|
822
|
-
**/
|
|
823
|
-
hasPregenWallet({ pregenIdentifier, pregenIdentifierType, }: {
|
|
824
|
-
pregenIdentifier: string;
|
|
825
|
-
pregenIdentifierType: TPregenIdentifierType;
|
|
826
|
-
}): Promise<boolean>;
|
|
827
|
-
/**
|
|
828
|
-
* Get pregen wallets for the given identifier.
|
|
829
|
-
* @param {Object} opts the options object.
|
|
830
|
-
* @param {string} opts.pregenIdentifier - the identifier of the user claiming the wallet
|
|
831
|
-
* @param {TPregenIdentifierType} opts.pregenIdentifierType - type of the identifier of the user claiming the wallet
|
|
832
|
-
* @returns {Promise<WalletEntity[]>} the array of found wallets
|
|
833
|
-
**/
|
|
834
|
-
getPregenWallets({ pregenIdentifier, pregenIdentifierType, }?: {
|
|
835
|
-
pregenIdentifier?: string;
|
|
836
|
-
pregenIdentifierType?: TPregenIdentifierType;
|
|
837
|
-
}): Promise<WalletEntity[]>;
|
|
436
|
+
createWallet({ type: _type, skipDistribute, }?: CoreMethodParams<'createWallet'>): CoreMethodResponse<'createWallet'>;
|
|
838
437
|
private encodeWalletBase64;
|
|
839
438
|
/**
|
|
840
439
|
* Encodes the current wallets encoded in Base 64.
|
|
841
440
|
* @returns {string} the encoded wallet string
|
|
842
441
|
**/
|
|
843
|
-
getUserShare():
|
|
442
|
+
getUserShare(): CoreMethodResponse<'getUserShare'>;
|
|
844
443
|
/**
|
|
845
444
|
* Sets the current wallets from a Base 64 string.
|
|
846
445
|
* @param {string} base64Wallet the encoded wallet string
|
|
847
446
|
**/
|
|
848
|
-
setUserShare(base64Wallets:
|
|
447
|
+
setUserShare(base64Wallets: CoreMethodParams<'setUserShare'>): CoreMethodResponse<'setUserShare'>;
|
|
849
448
|
private getTransactionReviewUrl;
|
|
850
449
|
private getOnRampTransactionUrl;
|
|
851
|
-
getWalletBalance: ({ walletId, rpcUrl }: GetWalletBalanceParams) => Promise<string | undefined>;
|
|
852
450
|
/**
|
|
853
451
|
* Signs a message using one of the current wallets.
|
|
854
452
|
*
|
|
@@ -860,12 +458,7 @@ export declare abstract class ParaCore {
|
|
|
860
458
|
* @param {number} [opts.timeout] optional timeout in milliseconds. If not present, defaults to 30 seconds.
|
|
861
459
|
* @param {string} [opts.cosmosSignDocBase64] the Cosmos `SignDoc` in base64, if applicable
|
|
862
460
|
**/
|
|
863
|
-
signMessage({ walletId, messageBase64, timeoutMs, cosmosSignDocBase64, }:
|
|
864
|
-
walletId: string;
|
|
865
|
-
messageBase64: string;
|
|
866
|
-
timeoutMs?: number;
|
|
867
|
-
cosmosSignDocBase64?: string;
|
|
868
|
-
}): Promise<FullSignatureRes>;
|
|
461
|
+
signMessage({ walletId, messageBase64, timeoutMs, cosmosSignDocBase64, isCanceled, onCancel, onPoll, }: CoreMethodParams<'signMessage'>): CoreMethodResponse<'signMessage'>;
|
|
869
462
|
private signMessageInner;
|
|
870
463
|
/**
|
|
871
464
|
* Signs a transaction.
|
|
@@ -875,24 +468,7 @@ export declare abstract class ParaCore {
|
|
|
875
468
|
* @param {string} [opts.chainId] the EVM chain id of the chain the transaction is being sent on, if applicable
|
|
876
469
|
* @param {number} [opts.timeoutMs] the amount of time to wait for the user to sign the transaction, in milliseconds
|
|
877
470
|
**/
|
|
878
|
-
signTransaction({ walletId, rlpEncodedTxBase64, chainId, timeoutMs, }:
|
|
879
|
-
walletId: string;
|
|
880
|
-
rlpEncodedTxBase64: string;
|
|
881
|
-
chainId: string;
|
|
882
|
-
timeoutMs?: number;
|
|
883
|
-
}): Promise<FullSignatureRes>;
|
|
884
|
-
/**
|
|
885
|
-
* @deprecated
|
|
886
|
-
* Sends a transaction.
|
|
887
|
-
* @param walletId - id of the wallet to send the transaction from.
|
|
888
|
-
* @param rlpEncodedTxBase64 - rlp encoded tx as base64 string
|
|
889
|
-
* @param chainId - chain id of the chain the transaction is being sent on.
|
|
890
|
-
**/
|
|
891
|
-
sendTransaction({ walletId, rlpEncodedTxBase64, chainId, }: {
|
|
892
|
-
walletId: string;
|
|
893
|
-
rlpEncodedTxBase64: string;
|
|
894
|
-
chainId: string;
|
|
895
|
-
}): Promise<FullSignatureRes>;
|
|
471
|
+
signTransaction({ walletId, rlpEncodedTxBase64, chainId, timeoutMs, isCanceled, onCancel, onPoll, }: CoreMethodParams<'signTransaction'>): CoreMethodResponse<'signTransaction'>;
|
|
896
472
|
protected isProviderModalDisabled(): boolean;
|
|
897
473
|
/**
|
|
898
474
|
* Starts a on-ramp or off-ramp transaction and returns the Para Portal link for the user to finalize and complete it.
|
|
@@ -902,40 +478,41 @@ export declare abstract class ParaCore {
|
|
|
902
478
|
* @param {string} opts.walletId the wallet ID to use for the transaction, where funds will be sent or withdrawn.
|
|
903
479
|
* @param {string} opts.externalWalletAddress the external wallet address to send funds to or withdraw funds from, if using an external wallet.
|
|
904
480
|
**/
|
|
905
|
-
initiateOnRampTransaction(options:
|
|
906
|
-
params: OnRampPurchaseCreateParams;
|
|
907
|
-
shouldOpenPopup?: boolean;
|
|
908
|
-
}): Promise<{
|
|
909
|
-
onRampPurchase: OnRampPurchase;
|
|
910
|
-
portalUrl: string;
|
|
911
|
-
}>;
|
|
481
|
+
initiateOnRampTransaction(options: CoreMethodParams<'initiateOnRampTransaction'>): CoreMethodResponse<'initiateOnRampTransaction'>;
|
|
912
482
|
/**
|
|
913
483
|
* Returns `true` if session was successfully kept alive, `false` otherwise.
|
|
914
484
|
**/
|
|
915
485
|
keepSessionAlive(): Promise<boolean>;
|
|
916
486
|
/**
|
|
917
487
|
* Serialize the current session for import by another Para instance.
|
|
918
|
-
* @param {boolean} excludeSigners - whether or not to exclude the signer from the exported wallets.
|
|
919
488
|
* @returns {string} the serialized session
|
|
920
489
|
*/
|
|
921
|
-
exportSession(
|
|
922
|
-
excludeSigners?: boolean;
|
|
923
|
-
}): string;
|
|
490
|
+
exportSession(): CoreMethodResponse<'exportSession'>;
|
|
924
491
|
/**
|
|
925
492
|
* Imports a session serialized by another Para instance.
|
|
926
493
|
* @param {string} serializedInstanceBase64 the serialized session
|
|
927
494
|
*/
|
|
928
|
-
importSession(serializedInstanceBase64:
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
495
|
+
importSession(serializedInstanceBase64: CoreMethodParams<'importSession'>): CoreMethodResponse<'importSession'>;
|
|
496
|
+
/**
|
|
497
|
+
* @deprecated
|
|
498
|
+
*/
|
|
499
|
+
/**
|
|
500
|
+
* @deprecated
|
|
501
|
+
*/
|
|
502
|
+
/**
|
|
503
|
+
* @deprecated
|
|
504
|
+
*/
|
|
505
|
+
/**
|
|
506
|
+
* @deprecated
|
|
507
|
+
*/
|
|
508
|
+
/**
|
|
509
|
+
* @deprecated
|
|
510
|
+
*/
|
|
934
511
|
/**
|
|
935
512
|
* Retrieves a token to verify the current session.
|
|
936
513
|
* @returns {Promise<string>} the ID
|
|
937
514
|
**/
|
|
938
|
-
getVerificationToken():
|
|
515
|
+
getVerificationToken(): CoreMethodResponse<'getVerificationToken'>;
|
|
939
516
|
/**
|
|
940
517
|
* Logs the user out.
|
|
941
518
|
* @param {Object} opts the options object.
|
|
@@ -944,6 +521,7 @@ export declare abstract class ParaCore {
|
|
|
944
521
|
logout({ clearPregenWallets }?: {
|
|
945
522
|
clearPregenWallets?: boolean;
|
|
946
523
|
}): Promise<void>;
|
|
524
|
+
/** @deprecated */
|
|
947
525
|
protected getSupportedCreateAuthMethods(): Promise<Set<AuthMethod>>;
|
|
948
526
|
/**
|
|
949
527
|
* Converts to a string, removing sensitive data when logging this class.
|
|
@@ -951,4 +529,115 @@ export declare abstract class ParaCore {
|
|
|
951
529
|
* Doesn't work for all types of logging.
|
|
952
530
|
**/
|
|
953
531
|
toString(): string;
|
|
532
|
+
/** NEW METHODS */
|
|
533
|
+
protected getNewCredentialAndUrl({ authMethod, isForNewDevice, portalTheme, shorten, }?: NewCredentialUrlParams): Promise<{
|
|
534
|
+
credentialId: string;
|
|
535
|
+
url: string;
|
|
536
|
+
}>;
|
|
537
|
+
/**
|
|
538
|
+
* Returns a Para Portal URL for logging in with a WebAuth passkey or a password.
|
|
539
|
+
* @param {Object} opts the options object
|
|
540
|
+
* @param {String} opts.auth - the user auth to sign up or log in with, in the form ` { email: string } | { phone: `+${number}` } `
|
|
541
|
+
* @param {boolean} opts.useShortUrls - whether to shorten the generated portal URLs
|
|
542
|
+
* @param {Theme} opts.portalTheme the Para Portal theme to apply to the password creation URL, if other than the default theme
|
|
543
|
+
* @returns {SignUpOrLogInResponse} an object in the form of either: `{ stage: 'verify' }` or `{ stage: 'login'; passkeyUrl?: string; passwordUrl?: string; biometricHints?: BiometricLocationHint[] }`
|
|
544
|
+
*/
|
|
545
|
+
protected getLoginUrl({ authMethod, shorten, portalTheme, sessionId, }: LoginUrlParams): Promise<string>;
|
|
546
|
+
protected getOAuthUrl({ method, deeplinkUrl }: OAuthUrlParams): Promise<string>;
|
|
547
|
+
signUpOrLogIn({ auth, ...urlOptions }: CoreMethodParams<'signUpOrLogIn'>): CoreMethodResponse<'signUpOrLogIn'>;
|
|
548
|
+
verifyNewAccount({ verificationCode, ...urlOptions }: CoreMethodParams<'verifyNewAccount'>): CoreMethodResponse<'verifyNewAccount'>;
|
|
549
|
+
verifyOAuth({ method, deeplinkUrl, isCanceled, onCancel, onPoll, onOAuthUrl, ...urlOptions }: CoreMethodParams<'verifyOAuth'>): CoreMethodResponse<'verifyOAuth'>;
|
|
550
|
+
verifyFarcaster({ isCanceled, onConnectUri, onCancel, onPoll, ...urlOptions }: CoreMethodParams<'verifyFarcaster'>): CoreMethodResponse<'verifyFarcaster'>;
|
|
551
|
+
/**
|
|
552
|
+
* Validates the response received from an attempted Telegram login for authenticity, then
|
|
553
|
+
* creates or retrieves the corresponding Para user and prepares the Para instance to sign in with that user.
|
|
554
|
+
* @param authResponse - the response JSON object received from the Telegram widget.
|
|
555
|
+
* @returns `{ isValid: boolean; telegramUserId?: string; userId?: string; isNewUser?: boolean; supportedAuthMethods?: AuthMethod[]; biometricHints?: BiometricLocationHint[] }`
|
|
556
|
+
*/
|
|
557
|
+
verifyTelegram({ telegramAuthResponse, ...urlOptions }: CoreMethodParams<'verifyTelegram'>): CoreMethodResponse<'verifyTelegram'>;
|
|
558
|
+
/**
|
|
559
|
+
* Waits for the session to be active and sets up the user.
|
|
560
|
+
*
|
|
561
|
+
* @param {Object} opts the options object
|
|
562
|
+
* @param {Window} [opts.popupWindow] the popup window being used for login.
|
|
563
|
+
* @param {boolean} [opts.skipSessionRefresh] whether to skip refreshing the session.
|
|
564
|
+
* @returns {Object} `{ isComplete: boolean; isError: boolean; needsWallet: boolean; partnerId: string; }` the result data
|
|
565
|
+
**/
|
|
566
|
+
waitForLogin({ isCanceled, onCancel, onPoll, skipSessionRefresh, }?: CoreMethodParams<'waitForLogin'>): CoreMethodResponse<'waitForLogin'>;
|
|
567
|
+
waitForSignup({ isCanceled, onCancel, onPoll, }: CoreMethodParams<'waitForSignup'>): CoreMethodResponse<'waitForSignup'>;
|
|
568
|
+
waitForWalletCreation({ isCanceled, onCancel, }?: CoreMethodParams<'waitForWalletCreation'>): CoreMethodResponse<'waitForWalletCreation'>;
|
|
569
|
+
loginExternalWallet({ externalWallet, ...urlOptions }: CoreMethodParams<'loginExternalWallet'>): CoreMethodResponse<'loginExternalWallet'>;
|
|
570
|
+
verifyExternalWallet({ externalWallet, signedMessage, cosmosPublicKeyHex, cosmosSigner, ...urlOptions }: CoreMethodParams<'verifyExternalWallet'>): CoreMethodResponse<'verifyExternalWallet'>;
|
|
571
|
+
/**
|
|
572
|
+
* Performs 2FA verification.
|
|
573
|
+
* @param {Object} opts the options object
|
|
574
|
+
* @param {string} opts.email the email to use for performing a 2FA verification.
|
|
575
|
+
* @param {string} opts.verificationCode the verification code to received via 2FA.
|
|
576
|
+
* @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
|
|
577
|
+
*/
|
|
578
|
+
verify2fa({ auth, verificationCode }: CoreMethodParams<'verify2fa'>): CoreMethodResponse<'verify2fa'>;
|
|
579
|
+
/**
|
|
580
|
+
* Sets up two-factor authentication for the current user.
|
|
581
|
+
* @returns {string} uri - uri to use for setting up 2FA
|
|
582
|
+
* */
|
|
583
|
+
setup2fa(): CoreMethodResponse<'setup2fa'>;
|
|
584
|
+
/**
|
|
585
|
+
* Enables 2FA.
|
|
586
|
+
* @param {Object} opts the options object
|
|
587
|
+
* @param {string} opts.verificationCode - the verification code received via 2FA.
|
|
588
|
+
*/
|
|
589
|
+
enable2fa({ verificationCode }: CoreMethodParams<'enable2fa'>): CoreMethodResponse<'enable2fa'>;
|
|
590
|
+
/**
|
|
591
|
+
* Creates a new pregenerated wallet.
|
|
592
|
+
*
|
|
593
|
+
* @param {Object} opts the options object.
|
|
594
|
+
* @param {string} opts.pregenIdentifier the identifier associated with the new wallet.
|
|
595
|
+
* @param {TPregenIdentifierType} [opts.pregenIdentifierType] the identifier type. Defaults to `EMAIL`.
|
|
596
|
+
* @param {WalletType} [opts.type] the type of wallet to create. Defaults to the first non-optional type in the instance's `supportedWalletTypes` array.
|
|
597
|
+
* @returns {Wallet} the created wallet.
|
|
598
|
+
**/
|
|
599
|
+
createPregenWallet(opts: CoreMethodParams<'createPregenWallet'>): CoreMethodResponse<'createPregenWallet'>;
|
|
600
|
+
/**
|
|
601
|
+
* Creates new pregenerated wallets for each desired type.
|
|
602
|
+
* If no types are provided, this method will create one for each of the non-optional types
|
|
603
|
+
* specified in the instance's `supportedWalletTypes` array that are not already present.
|
|
604
|
+
* @param {Object} opts the options object.
|
|
605
|
+
* @param {string} opts.pregenIdentifier the identifier to associate each wallet with.
|
|
606
|
+
* @param {TPregenIdentifierType} opts.pregenIdentifierType - either `'EMAIL'` or `'PHONE'`.
|
|
607
|
+
* @param {WalletType[]} [opts.types] the wallet types to create. Defaults to any types the instance supports that are not already present.
|
|
608
|
+
* @returns {Wallet[]} an array containing the created wallets.
|
|
609
|
+
**/
|
|
610
|
+
createPregenWalletPerType({ types, pregenId, }: CoreMethodParams<'createPregenWalletPerType'>): CoreMethodResponse<'createPregenWalletPerType'>;
|
|
611
|
+
/**
|
|
612
|
+
* Claims a pregenerated wallet.
|
|
613
|
+
* @param {Object} opts the options object.
|
|
614
|
+
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
615
|
+
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the identifier of the user claiming the wallet
|
|
616
|
+
* @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
|
|
617
|
+
**/
|
|
618
|
+
claimPregenWallets({ pregenId, }?: CoreMethodParams<'claimPregenWallets'>): CoreMethodResponse<'claimPregenWallets'>;
|
|
619
|
+
/**
|
|
620
|
+
* Updates the identifier for a pregen wallet.
|
|
621
|
+
* @param {Object} opts the options object.
|
|
622
|
+
* @param {string} opts.walletId the pregen wallet ID
|
|
623
|
+
* @param {string} opts.newPregenIdentifier the new identtifier
|
|
624
|
+
* @param {TPregenIdentifierType} opts.newPregenIdentifierType: the new identifier type
|
|
625
|
+
**/
|
|
626
|
+
updatePregenWalletIdentifier({ walletId, newPregenId, }: CoreMethodParams<'updatePregenWalletIdentifier'>): CoreMethodResponse<'updatePregenWalletIdentifier'>;
|
|
627
|
+
/**
|
|
628
|
+
* Checks if a pregen Wallet exists for the given identifier with the current partner.
|
|
629
|
+
* @param {Object} opts the options object.
|
|
630
|
+
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
631
|
+
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the string of the identifier of the user claiming the wallet
|
|
632
|
+
* @returns {boolean} whether the pregen wallet exists
|
|
633
|
+
**/
|
|
634
|
+
hasPregenWallet({ pregenId }: CoreMethodParams<'hasPregenWallet'>): CoreMethodResponse<'hasPregenWallet'>;
|
|
635
|
+
/**
|
|
636
|
+
* Get pregen wallets for the given identifier.
|
|
637
|
+
* @param {Object} opts the options object.
|
|
638
|
+
* @param {string} opts.pregenIdentifier - the identifier of the user claiming the wallet
|
|
639
|
+
* @param {TPregenIdentifierType} opts.pregenIdentifierType - type of the identifier of the user claiming the wallet
|
|
640
|
+
* @returns {Promise<WalletEntity[]>} the array of found wallets
|
|
641
|
+
**/
|
|
642
|
+
getPregenWallets({ pregenId }?: CoreMethodParams<'getPregenWallets'>): CoreMethodResponse<'getPregenWallets'>;
|
|
954
643
|
}
|