@getpara/core-sdk 2.0.0-alpha.3 → 2.0.0-dev.1
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 +1465 -420
- package/dist/cjs/index.js.br +0 -0
- package/dist/cjs/index.js.gz +0 -0
- package/dist/esm/index.js +1468 -422
- package/dist/esm/index.js.br +0 -0
- package/dist/esm/index.js.gz +0 -0
- package/dist/types/ParaCore.d.ts +414 -35
- package/dist/types/types/coreApi.d.ts +20 -20
- package/dist/types/types/methods.d.ts +49 -1
- package/package.json +3 -4
package/dist/esm/index.js.br
CHANGED
|
Binary file
|
package/dist/esm/index.js.gz
CHANGED
|
Binary file
|
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, WalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType } from '@getpara/user-management-client';
|
|
1
|
+
import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, WalletEntity, WalletType, OAuthMethod, TPregenIdentifierType, PregenIds, BiometricLocationHint, TelegramAuthResponse, VerifyTelegramRes, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletLoginRes, 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, WalletFilters, WalletTypeProp, Wallet, PortalUrlOptions, ConstructorOpts, CoreAuthInfo, PortalUrlType, CoreMethodParams, CoreMethodResponse, OAuthUrlParams, NewCredentialUrlParams, LoginUrlParams, CoreInterface, ExternalWalletConnectionType } from './types/index.js';
|
|
3
|
+
import { Ctx, Environment, Theme, FullSignatureRes, GetWebAuthUrlForLoginParams, AccountSetupResponse, LoginResponse, WalletFilters, WalletTypeProp, Wallet, PortalUrlOptions, ConstructorOpts, RecoveryStatus, CoreAuthInfo, PortalUrlType, PortalUrlOptionsV2, CoreMethodParams, CoreMethodResponse, OAuthUrlParams, NewCredentialUrlParams, LoginUrlParams, CoreInterface, VerifyExternalWalletV1, ExternalWalletConnectionType } from './types/index.js';
|
|
4
4
|
import { PlatformUtils } from './PlatformUtils.js';
|
|
5
5
|
export declare abstract class ParaCore implements CoreInterface {
|
|
6
6
|
#private;
|
|
@@ -164,7 +164,8 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
164
164
|
getWallets(): Record<string, Wallet>;
|
|
165
165
|
getAddress(walletId?: string): string | undefined;
|
|
166
166
|
protected abstract getPlatformUtils(): PlatformUtils;
|
|
167
|
-
protected
|
|
167
|
+
protected constructPortalUrlV2(type: PortalUrlType, opts?: PortalUrlOptionsV2): Promise<string>;
|
|
168
|
+
private constructPortalUrl;
|
|
168
169
|
/**
|
|
169
170
|
* Constructs a new `ParaCore` instance.
|
|
170
171
|
* @param env - `Environment` to use.
|
|
@@ -196,7 +197,6 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
196
197
|
}): Promise<typeof this.authInfo>;
|
|
197
198
|
protected assertUserId(): string;
|
|
198
199
|
protected assertIsAuthSet(allowed?: AuthType[]): PrimaryAuthInfo;
|
|
199
|
-
assertIsUser: any;
|
|
200
200
|
/**
|
|
201
201
|
* Sets the email associated with the `ParaCore` instance.
|
|
202
202
|
* @param email - Email to set.
|
|
@@ -212,7 +212,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
212
212
|
* @param phone - Phone number to set.
|
|
213
213
|
* @param countryCode - Country Code to set.
|
|
214
214
|
*/
|
|
215
|
-
|
|
215
|
+
setPhoneNumber(phone: `+${number}` | string, countryCode?: string): Promise<void>;
|
|
216
216
|
/**
|
|
217
217
|
* Sets the farcaster username associated with the `ParaCore` instance.
|
|
218
218
|
* @param farcasterUsername - Farcaster Username to set.
|
|
@@ -305,6 +305,31 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
305
305
|
* @returns - portal URL
|
|
306
306
|
*/
|
|
307
307
|
protected getPortalURL(): Promise<string>;
|
|
308
|
+
private getWebAuthURLForCreate;
|
|
309
|
+
private getPasswordURLForCreate;
|
|
310
|
+
private getShortUrl;
|
|
311
|
+
shortenLoginLink(link: string): Promise<string>;
|
|
312
|
+
/**
|
|
313
|
+
* Generates a URL for registering a new WebAuth passkey.
|
|
314
|
+
* @deprecated
|
|
315
|
+
* @param {GetWebAuthUrlForLoginParams} opts the options object
|
|
316
|
+
* @returns - the URL for creating a new passkey
|
|
317
|
+
*/
|
|
318
|
+
getWebAuthURLForLogin(opts: GetWebAuthUrlForLoginParams): Promise<string>;
|
|
319
|
+
/**
|
|
320
|
+
* Generates a URL for registering a new user password.
|
|
321
|
+
* @deprecated
|
|
322
|
+
* @param {GetWebAuthUrlForLoginParams} opts the options object
|
|
323
|
+
* @returns - the URL for creating a new password
|
|
324
|
+
*/
|
|
325
|
+
getPasswordURLForLogin(opts: GetWebAuthUrlForLoginParams): Promise<string>;
|
|
326
|
+
/**
|
|
327
|
+
* Generates a URL for registering a new WebAuth passkey for a phone number.
|
|
328
|
+
* @deprecated
|
|
329
|
+
* @param {Omit<GetWebAuthUrlForLoginParams, 'authType'>} opts the options object
|
|
330
|
+
* @returns - web auth url
|
|
331
|
+
*/
|
|
332
|
+
getWebAuthURLForLoginForPhone(opts: Omit<GetWebAuthUrlForLoginParams, 'authType'>): Promise<string>;
|
|
308
333
|
/**
|
|
309
334
|
* Gets the private key for the given wallet.
|
|
310
335
|
* @param {string } [walletId] id of the wallet to get the private key for. Will default to the first wallet if not provided.
|
|
@@ -318,10 +343,174 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
318
343
|
fetchWallets(): CoreMethodResponse<'fetchWallets'>;
|
|
319
344
|
private populateWalletAddresses;
|
|
320
345
|
private populatePregenWalletAddresses;
|
|
346
|
+
/**
|
|
347
|
+
* Checks if a user exists for an email address.
|
|
348
|
+
* @deprecated
|
|
349
|
+
* @param {Object} opts the options object
|
|
350
|
+
* @param {string} opts.email the email to check.
|
|
351
|
+
* @returns true if user exists, false otherwise.
|
|
352
|
+
*/
|
|
353
|
+
checkIfUserExists({ email }: {
|
|
354
|
+
email: string;
|
|
355
|
+
}): Promise<boolean>;
|
|
356
|
+
/**
|
|
357
|
+
* Checks if a user exists for a phone number.
|
|
358
|
+
* @deprecated
|
|
359
|
+
* @param {Object} opts the options object
|
|
360
|
+
* @param {string} opts.phone - phone number to check.
|
|
361
|
+
* @param {string} opts.countryCode - the country code.
|
|
362
|
+
* @returns true if user exists, false otherwise.
|
|
363
|
+
*/
|
|
364
|
+
checkIfUserExistsByPhone(auth: Auth<'phone'>): Promise<boolean>;
|
|
365
|
+
/**
|
|
366
|
+
* Creates a new user.
|
|
367
|
+
* @deprecated
|
|
368
|
+
* @param {Object} opts the options object
|
|
369
|
+
* @param {string} opts.email the email to use.
|
|
370
|
+
*/
|
|
371
|
+
createUser({ email }: Auth<'email'>): Promise<void>;
|
|
372
|
+
/**
|
|
373
|
+
* Creates a new user with a phone number.
|
|
374
|
+
* @deprecated
|
|
375
|
+
* @param {Object} opts the options object
|
|
376
|
+
* @param {string} opts.phone - the phone number to use for creating the user.
|
|
377
|
+
* @param {string} opts.countryCode - the country code to use for creating the user.
|
|
378
|
+
*/
|
|
379
|
+
createUserByPhone(auth: Auth<'phone'>): Promise<void>;
|
|
380
|
+
/**
|
|
381
|
+
* Logs in or creates a new user using an external wallet address.
|
|
382
|
+
* @deprecated
|
|
383
|
+
* @param {Object} opts the options object
|
|
384
|
+
* @param {string} opts.address the external wallet address to use for identification.
|
|
385
|
+
* @param {WalletType} opts.type type of external wallet to use for identification.
|
|
386
|
+
* @param {string} opts.provider the name of the provider for the external wallet.
|
|
387
|
+
*/
|
|
388
|
+
externalWalletLogin(wallet: ExternalWalletInfo): Promise<ExternalWalletLoginRes>;
|
|
389
|
+
/**
|
|
390
|
+
* Passes the email code obtained from the user for verification.
|
|
391
|
+
* @deprecated
|
|
392
|
+
* @param {Object} opts the options object
|
|
393
|
+
* @param {string} verificationCode the six-digit code to check
|
|
394
|
+
* @returns {string} the web auth url for creating a new credential
|
|
395
|
+
*/
|
|
396
|
+
verifyEmail({ verificationCode }: {
|
|
397
|
+
verificationCode: string;
|
|
398
|
+
}): Promise<string>;
|
|
399
|
+
/** @deprecated */
|
|
400
|
+
verifyExternalWallet({ address, signedMessage, cosmosPublicKeyHex, cosmosSigner, }: VerifyExternalWalletV1): Promise<string>;
|
|
401
|
+
/**
|
|
402
|
+
* Passes the phone code obtained from the user for verification.
|
|
403
|
+
* @deprecated
|
|
404
|
+
* @param {Object} opts the options object
|
|
405
|
+
* @param {string} verificationCode the six-digit code to check
|
|
406
|
+
* @returns {string} the web auth url for creating a new credential
|
|
407
|
+
*/
|
|
408
|
+
verifyPhone({ verificationCode }: {
|
|
409
|
+
verificationCode: string;
|
|
410
|
+
}): Promise<string>;
|
|
411
|
+
/**
|
|
412
|
+
* Validates the response received from an attempted Telegram login for authenticity, then
|
|
413
|
+
* creates or retrieves the corresponding Para user and prepares the Para instance to sign in with that user.
|
|
414
|
+
* @deprecated
|
|
415
|
+
* @param authResponse - the response JSON object received from the Telegram widget.
|
|
416
|
+
* @returns `{ isValid: boolean; telegramUserId?: string; userId?: string; isNewUser?: boolean; supportedAuthMethods?: AuthMethod[]; biometricHints?: BiometricLocationHint[] }`
|
|
417
|
+
*/
|
|
418
|
+
verifyTelegram(authObject: TelegramAuthResponse): Promise<VerifyTelegramRes>;
|
|
419
|
+
/**
|
|
420
|
+
* Performs 2FA verification.
|
|
421
|
+
* @deprecated
|
|
422
|
+
* @param {Object} opts the options object
|
|
423
|
+
* @param {string} opts.email the email to use for performing a 2FA verification.
|
|
424
|
+
* @param {string} opts.verificationCode the verification code to received via 2FA.
|
|
425
|
+
* @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
|
|
426
|
+
*/
|
|
427
|
+
verify2FA({ email, verificationCode }: {
|
|
428
|
+
email: string;
|
|
429
|
+
verificationCode: string;
|
|
430
|
+
}): Promise<{
|
|
431
|
+
initiatedAt?: Date;
|
|
432
|
+
status?: RecoveryStatus;
|
|
433
|
+
userId: string;
|
|
434
|
+
wallets: Pick<Wallet, 'address' | 'id'>[];
|
|
435
|
+
}>;
|
|
436
|
+
/**
|
|
437
|
+
* Performs 2FA verification.
|
|
438
|
+
* @deprecated
|
|
439
|
+
* @param {Object} opts the options object
|
|
440
|
+
* @param {string} opts.phone the phone number
|
|
441
|
+
* @param {string} opts.countryCode - the country code
|
|
442
|
+
* @param {string} opts.verificationCode - verification code to received via 2FA.
|
|
443
|
+
* @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
|
|
444
|
+
*/
|
|
445
|
+
verify2FAForPhone({ phone, verificationCode, }: Auth<'phone'> & {
|
|
446
|
+
verificationCode: string;
|
|
447
|
+
}): Promise<{
|
|
448
|
+
initiatedAt?: Date;
|
|
449
|
+
status?: RecoveryStatus;
|
|
450
|
+
userId: string;
|
|
451
|
+
wallets: Pick<Wallet, 'address' | 'id'>[];
|
|
452
|
+
}>;
|
|
453
|
+
/**
|
|
454
|
+
* Sets up two-factor authentication for the current user.
|
|
455
|
+
* @deprecated
|
|
456
|
+
* @returns {string} uri - uri to use for setting up 2FA
|
|
457
|
+
* */
|
|
458
|
+
setup2FA(): Promise<{
|
|
459
|
+
uri?: string;
|
|
460
|
+
}>;
|
|
461
|
+
/**
|
|
462
|
+
* Enables 2FA.
|
|
463
|
+
* @deprecated
|
|
464
|
+
* @param {Object} opts the options object
|
|
465
|
+
* @param {string} opts.verificationCode - the verification code received via 2FA.
|
|
466
|
+
*/
|
|
467
|
+
enable2FA({ verificationCode }: {
|
|
468
|
+
verificationCode: string;
|
|
469
|
+
}): Promise<void>;
|
|
470
|
+
/**
|
|
471
|
+
* Determines if 2FA has been set up.
|
|
472
|
+
* @deprecated
|
|
473
|
+
* @returns {Object} `{ isSetup: boolean }` - true if 2FA is setup, false otherwise
|
|
474
|
+
*/
|
|
475
|
+
check2FAStatus(): Promise<{
|
|
476
|
+
isSetup: boolean;
|
|
477
|
+
}>;
|
|
321
478
|
/**
|
|
322
479
|
* Resend a verification email for the current user.
|
|
323
480
|
*/
|
|
324
481
|
resendVerificationCode(): CoreMethodResponse<'resendVerificationCode'>;
|
|
482
|
+
/**
|
|
483
|
+
* Resend a verification SMS for the current user.
|
|
484
|
+
* @deprecated
|
|
485
|
+
*/
|
|
486
|
+
resendVerificationCodeByPhone(): Promise<void>;
|
|
487
|
+
/**
|
|
488
|
+
* Returns a URL for setting up a new WebAuth passkey.
|
|
489
|
+
* @deprecated
|
|
490
|
+
* @param {Object} opts the options object
|
|
491
|
+
* @param {string} opts.authType - the auth type to use
|
|
492
|
+
* @param {boolean} opts.isForNewDevice whether the passkey is for a new device of an existing user
|
|
493
|
+
* @returns {string} the URL
|
|
494
|
+
*/
|
|
495
|
+
getSetUpBiometricsURL({ authType, isForNewDevice, }?: Pick<PortalUrlOptions, 'authType' | 'isForNewDevice'>): Promise<string>;
|
|
496
|
+
/**
|
|
497
|
+
* Returns a URL for setting up a new WebAuth passkey for a phone number.
|
|
498
|
+
* @deprecated
|
|
499
|
+
* @param {Object} opts the options object
|
|
500
|
+
* @param {boolean} opts.isForNewDevice whether the passkey is for a new device of an existing user
|
|
501
|
+
* @returns {string} the URL
|
|
502
|
+
*/
|
|
503
|
+
getSetUpBiometricsURLForPhone({ isForNewDevice, }?: Pick<PortalUrlOptions, 'isForNewDevice'>): Promise<string>;
|
|
504
|
+
/**
|
|
505
|
+
* Returns a URL for setting up a new password.
|
|
506
|
+
* @deprecated
|
|
507
|
+
* @param {Object} opts the options object
|
|
508
|
+
* @param {string} opts.authType - the auth type to use
|
|
509
|
+
* @param {boolean} opts.isForNewDevice whether the passkey is for a new device of an existing user
|
|
510
|
+
* @param {Theme} [opts.theme] the portal theme to use in place of the partner's default
|
|
511
|
+
* @returns {string} the URL
|
|
512
|
+
*/
|
|
513
|
+
getSetupPasswordURL({ authType, isForNewDevice, theme, }?: Pick<PortalUrlOptions, 'authType' | 'isForNewDevice' | 'theme'>): Promise<string>;
|
|
325
514
|
/**
|
|
326
515
|
* Checks if the current session is active.
|
|
327
516
|
* @returns `true` if active, `false` otherwise
|
|
@@ -332,6 +521,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
332
521
|
* @returns `true` if active, `false` otherwise
|
|
333
522
|
**/
|
|
334
523
|
isFullyLoggedIn(): CoreMethodResponse<'isFullyLoggedIn'>;
|
|
524
|
+
/** @deprecated */
|
|
335
525
|
protected supportedAuthMethods(auth: Auth<PrimaryAuthType | 'userId'>): Promise<Set<AuthMethod>>;
|
|
336
526
|
/**
|
|
337
527
|
* Get hints associated with the users stored biometrics.
|
|
@@ -339,6 +529,107 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
339
529
|
* @returns Array containing useragents and AAGuids for stored biometrics
|
|
340
530
|
*/
|
|
341
531
|
protected getUserBiometricLocationHints(): Promise<BiometricLocationHint[]>;
|
|
532
|
+
/**
|
|
533
|
+
* Initiates a login.
|
|
534
|
+
* @deprecated
|
|
535
|
+
* @param {Object} opts the options object
|
|
536
|
+
* @param {String} opts.email - the email to login with
|
|
537
|
+
* @param {boolean} opts.useShortURL - whether to shorten the link
|
|
538
|
+
* @returns - the WebAuth URL for logging in
|
|
539
|
+
**/
|
|
540
|
+
initiateUserLogin({ useShortUrl, ...auth }: PrimaryAuth & {
|
|
541
|
+
useShortUrl?: boolean;
|
|
542
|
+
}): Promise<string>;
|
|
543
|
+
/**
|
|
544
|
+
* Initiates a login.
|
|
545
|
+
* @deprecated
|
|
546
|
+
* @param email - the email to login with
|
|
547
|
+
* @returns - a set of supported auth methods for the user
|
|
548
|
+
**/
|
|
549
|
+
initiateUserLoginV2(auth: PrimaryAuth): Promise<Set<AuthMethod>>;
|
|
550
|
+
/**
|
|
551
|
+
* Initiates a login.
|
|
552
|
+
* @deprecated
|
|
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
|
+
* @deprecated
|
|
564
|
+
* Waits for the session to be active.
|
|
565
|
+
**/
|
|
566
|
+
waitForAccountCreation({ popupWindow }?: {
|
|
567
|
+
popupWindow?: Window | null;
|
|
568
|
+
}): Promise<boolean>;
|
|
569
|
+
/**
|
|
570
|
+
* @deprecated
|
|
571
|
+
*/
|
|
572
|
+
waitForPasskeyAndCreateWallet({ popupWindow, }?: {
|
|
573
|
+
popupWindow?: Window;
|
|
574
|
+
}): Promise<AccountSetupResponse>;
|
|
575
|
+
/**
|
|
576
|
+
* Initiates a Farcaster login attempt and return the URI for the user to connect.
|
|
577
|
+
* You can create a QR code with this URI that works with Farcaster's mobile app.
|
|
578
|
+
* @deprecated
|
|
579
|
+
* @return {string} the Farcaster connect URI
|
|
580
|
+
*/
|
|
581
|
+
getFarcasterConnectURL(): Promise<string>;
|
|
582
|
+
/**
|
|
583
|
+
* Awaits the response from a user's attempt to log in with Farcaster.
|
|
584
|
+
* If successful, this returns the user's Farcaster username and profile picture and indicates whether the user already exists.
|
|
585
|
+
* @deprecated
|
|
586
|
+
* @return {Object} `{userExists: boolean; username: string; pfpUrl?: string | null }` - the user's information and whether the user already exists.
|
|
587
|
+
*/
|
|
588
|
+
waitForFarcasterStatus(): Promise<{
|
|
589
|
+
userId: string;
|
|
590
|
+
userExists: boolean;
|
|
591
|
+
username: string;
|
|
592
|
+
pfpUrl?: string | null;
|
|
593
|
+
}>;
|
|
594
|
+
/**
|
|
595
|
+
* Generates a URL for the user to log in with OAuth using a desire method.
|
|
596
|
+
* @deprecated
|
|
597
|
+
* @param {Object} opts the options object
|
|
598
|
+
* @param {OAuthMethod} opts.method the third-party service to use for OAuth.
|
|
599
|
+
* @param {string} [opts.deeplinkUrl] the deeplink to redirect to after the OAuth flow. This is for mobile only.
|
|
600
|
+
* @returns {string} the URL for the user to log in with OAuth.
|
|
601
|
+
*/
|
|
602
|
+
getOAuthURL({ method, deeplinkUrl }: {
|
|
603
|
+
method: OAuthMethod;
|
|
604
|
+
deeplinkUrl?: string;
|
|
605
|
+
}): Promise<string>;
|
|
606
|
+
/**
|
|
607
|
+
* Awaits the response from a user's attempt to log in with OAuth.
|
|
608
|
+
* If successful, this returns the user's email address and indicates whether the user already exists.
|
|
609
|
+
* @deprecated
|
|
610
|
+
* @param {Object} opts the options object.
|
|
611
|
+
* @param {Window} [opts.popupWindow] the popup window being used for login.
|
|
612
|
+
* @return {Object} `{ email?: string; isError?: boolean; userExists: boolean; }` the result data
|
|
613
|
+
*/
|
|
614
|
+
waitForOAuth({ popupWindow }?: {
|
|
615
|
+
popupWindow?: Window | null;
|
|
616
|
+
}): Promise<{
|
|
617
|
+
email?: string;
|
|
618
|
+
isError?: boolean;
|
|
619
|
+
userExists: boolean;
|
|
620
|
+
}>;
|
|
621
|
+
/**
|
|
622
|
+
* Waits for the session to be active and sets up the user.
|
|
623
|
+
* @deprecated
|
|
624
|
+
* @param {Object} opts the options object
|
|
625
|
+
* @param {Window} [opts.popupWindow] the popup window being used for login.
|
|
626
|
+
* @param {boolean} [opts.skipSessionRefresh] whether to skip refreshing the session.
|
|
627
|
+
* @returns {Object} `{ isComplete: boolean; isError: boolean; needsWallet: boolean; partnerId: string; }` the result data
|
|
628
|
+
**/
|
|
629
|
+
waitForLoginAndSetup({ popupWindow, skipSessionRefresh, }?: {
|
|
630
|
+
popupWindow?: Window | null;
|
|
631
|
+
skipSessionRefresh?: boolean;
|
|
632
|
+
}): Promise<LoginResponse>;
|
|
342
633
|
/**
|
|
343
634
|
* Updates the session with the user management server, possibly
|
|
344
635
|
* opening a popup to refresh the session.
|
|
@@ -434,6 +725,85 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
434
725
|
* @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
|
|
435
726
|
**/
|
|
436
727
|
createWallet({ type: _type, skipDistribute, }?: CoreMethodParams<'createWallet'>): CoreMethodResponse<'createWallet'>;
|
|
728
|
+
/**
|
|
729
|
+
* Creates a new pregenerated wallet.
|
|
730
|
+
* @deprecated
|
|
731
|
+
* @param {Object} opts the options object.
|
|
732
|
+
* @param {string} opts.pregenIdentifier the identifier associated with the new wallet.
|
|
733
|
+
* @param {TPregenIdentifierType} [opts.pregenIdentifierType] the identifier type. Defaults to `EMAIL`.
|
|
734
|
+
* @param {WalletType} [opts.type] the type of wallet to create. Defaults to the first non-optional type in the instance's `supportedWalletTypes` array.
|
|
735
|
+
* @returns {Wallet} the created wallet.
|
|
736
|
+
**/
|
|
737
|
+
createPregenWallet(opts: {
|
|
738
|
+
type: WalletType;
|
|
739
|
+
pregenIdentifier: string;
|
|
740
|
+
pregenIdentifierType: TPregenIdentifierType;
|
|
741
|
+
}): Promise<Wallet>;
|
|
742
|
+
/**
|
|
743
|
+
* Creates new pregenerated wallets for each desired type.
|
|
744
|
+
* If no types are provided, this method will create one for each of the non-optional types
|
|
745
|
+
* specified in the instance's `supportedWalletTypes` array that are not already present.
|
|
746
|
+
* @deprecated
|
|
747
|
+
* @param {Object} opts the options object.
|
|
748
|
+
* @param {string} opts.pregenIdentifier the identifier to associate each wallet with.
|
|
749
|
+
* @param {TPregenIdentifierType} opts.pregenIdentifierType - either `'EMAIL'` or `'PHONE'`.
|
|
750
|
+
* @param {WalletType[]} [opts.types] the wallet types to create. Defaults to any types the instance supports that are not already present.
|
|
751
|
+
* @returns {Wallet[]} an array containing the created wallets.
|
|
752
|
+
**/
|
|
753
|
+
createPregenWalletPerType({ types, pregenIdentifier, pregenIdentifierType, }: {
|
|
754
|
+
pregenIdentifier: string;
|
|
755
|
+
pregenIdentifierType: TPregenIdentifierType;
|
|
756
|
+
types?: WalletType[];
|
|
757
|
+
}): Promise<Wallet[]>;
|
|
758
|
+
/**
|
|
759
|
+
* Claims a pregenerated wallet.
|
|
760
|
+
* @deprecated
|
|
761
|
+
* @param {Object} opts the options object.
|
|
762
|
+
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
763
|
+
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the identifier of the user claiming the wallet
|
|
764
|
+
* @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
|
|
765
|
+
**/
|
|
766
|
+
claimPregenWallets({ pregenIdentifier, pregenIdentifierType, }?: {
|
|
767
|
+
pregenIdentifier?: string;
|
|
768
|
+
pregenIdentifierType?: TPregenIdentifierType;
|
|
769
|
+
}): Promise<string | undefined>;
|
|
770
|
+
/**
|
|
771
|
+
* Updates the identifier for a pregen wallet.
|
|
772
|
+
* @deprecated
|
|
773
|
+
* @param {Object} opts the options object.
|
|
774
|
+
* @param {string} opts.walletId the pregen wallet ID
|
|
775
|
+
* @param {string} opts.newPregenIdentifier the new identtifier
|
|
776
|
+
* @param {TPregenIdentifierType} opts.newPregenIdentifierType: the new identifier type
|
|
777
|
+
**/
|
|
778
|
+
updatePregenWalletIdentifier({ walletId, newPregenIdentifier, newPregenIdentifierType, }: {
|
|
779
|
+
walletId: string;
|
|
780
|
+
newPregenIdentifier: string;
|
|
781
|
+
newPregenIdentifierType: TPregenIdentifierType;
|
|
782
|
+
}): Promise<void>;
|
|
783
|
+
/**
|
|
784
|
+
* Checks if a pregen Wallet exists for the given identifier with the current partner.
|
|
785
|
+
* @deprecated
|
|
786
|
+
* @param {Object} opts the options object.
|
|
787
|
+
* @param {string} opts.pregenIdentifier string the identifier of the user claiming the wallet
|
|
788
|
+
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the string of the identifier of the user claiming the wallet
|
|
789
|
+
* @returns {boolean} whether the pregen wallet exists
|
|
790
|
+
**/
|
|
791
|
+
hasPregenWallet({ pregenIdentifier, pregenIdentifierType, }: {
|
|
792
|
+
pregenIdentifier: string;
|
|
793
|
+
pregenIdentifierType: TPregenIdentifierType;
|
|
794
|
+
}): Promise<boolean>;
|
|
795
|
+
/**
|
|
796
|
+
* Get pregen wallets for the given identifier.
|
|
797
|
+
* @deprecated
|
|
798
|
+
* @param {Object} opts the options object.
|
|
799
|
+
* @param {string} opts.pregenIdentifier - the identifier of the user claiming the wallet
|
|
800
|
+
* @param {TPregenIdentifierType} opts.pregenIdentifierType - type of the identifier of the user claiming the wallet
|
|
801
|
+
* @returns {Promise<WalletEntity[]>} the array of found wallets
|
|
802
|
+
**/
|
|
803
|
+
getPregenWallets({ pregenIdentifier, pregenIdentifierType, }?: {
|
|
804
|
+
pregenIdentifier?: string;
|
|
805
|
+
pregenIdentifierType?: TPregenIdentifierType;
|
|
806
|
+
}): Promise<WalletEntity[]>;
|
|
437
807
|
private encodeWalletBase64;
|
|
438
808
|
/**
|
|
439
809
|
* Encodes the current wallets encoded in Base 64.
|
|
@@ -469,6 +839,18 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
469
839
|
* @param {number} [opts.timeoutMs] the amount of time to wait for the user to sign the transaction, in milliseconds
|
|
470
840
|
**/
|
|
471
841
|
signTransaction({ walletId, rlpEncodedTxBase64, chainId, timeoutMs, isCanceled, onCancel, onPoll, }: CoreMethodParams<'signTransaction'>): CoreMethodResponse<'signTransaction'>;
|
|
842
|
+
/**
|
|
843
|
+
* @deprecated
|
|
844
|
+
* Sends a transaction.
|
|
845
|
+
* @param walletId - id of the wallet to send the transaction from.
|
|
846
|
+
* @param rlpEncodedTxBase64 - rlp encoded tx as base64 string
|
|
847
|
+
* @param chainId - chain id of the chain the transaction is being sent on.
|
|
848
|
+
**/
|
|
849
|
+
sendTransaction({ walletId, rlpEncodedTxBase64, chainId, }: {
|
|
850
|
+
walletId: string;
|
|
851
|
+
rlpEncodedTxBase64: string;
|
|
852
|
+
chainId: string;
|
|
853
|
+
}): Promise<FullSignatureRes>;
|
|
472
854
|
protected isProviderModalDisabled(): boolean;
|
|
473
855
|
/**
|
|
474
856
|
* Starts a on-ramp or off-ramp transaction and returns the Para Portal link for the user to finalize and complete it.
|
|
@@ -496,18 +878,23 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
496
878
|
/**
|
|
497
879
|
* @deprecated
|
|
498
880
|
*/
|
|
881
|
+
protected exitAccountCreation(): void;
|
|
499
882
|
/**
|
|
500
883
|
* @deprecated
|
|
501
884
|
*/
|
|
885
|
+
protected exitLogin(): void;
|
|
502
886
|
/**
|
|
503
887
|
* @deprecated
|
|
504
888
|
*/
|
|
889
|
+
protected exitFarcaster(): void;
|
|
505
890
|
/**
|
|
506
891
|
* @deprecated
|
|
507
892
|
*/
|
|
893
|
+
protected exitOAuth(): void;
|
|
508
894
|
/**
|
|
509
895
|
* @deprecated
|
|
510
896
|
*/
|
|
897
|
+
protected exitLoops(): void;
|
|
511
898
|
/**
|
|
512
899
|
* Retrieves a token to verify the current session.
|
|
513
900
|
* @returns {Promise<string>} the ID
|
|
@@ -530,31 +917,23 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
530
917
|
**/
|
|
531
918
|
toString(): string;
|
|
532
919
|
/** NEW METHODS */
|
|
533
|
-
protected getNewCredentialAndUrl({ authMethod, isForNewDevice, portalTheme, shorten, }
|
|
920
|
+
protected getNewCredentialAndUrl({ authMethod, isForNewDevice, portalTheme, shorten, }: NewCredentialUrlParams): Promise<{
|
|
534
921
|
credentialId: string;
|
|
535
922
|
url: string;
|
|
536
923
|
}>;
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
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'>;
|
|
924
|
+
protected getLoginUrlV2({ authMethod, shorten, portalTheme, sessionId, }: LoginUrlParams): Promise<string>;
|
|
925
|
+
protected getOAuthUrlV2({ method, deeplinkUrl }: OAuthUrlParams): Promise<string>;
|
|
926
|
+
signUpOrLogInV2({ auth, ...urlOptions }: CoreMethodParams<'signUpOrLogInV2'>): CoreMethodResponse<'signUpOrLogInV2'>;
|
|
927
|
+
verifyNewAccountV2({ verificationCode, ...urlOptions }: CoreMethodParams<'verifyNewAccountV2'>): CoreMethodResponse<'verifyNewAccountV2'>;
|
|
928
|
+
verifyOAuthV2({ method, deeplinkUrl, isCanceled, onCancel, onPoll, onOAuthUrl, ...urlOptions }: CoreMethodParams<'verifyOAuthV2'>): CoreMethodResponse<'verifyOAuthV2'>;
|
|
929
|
+
verifyFarcasterV2({ isCanceled, onConnectUri, onCancel, onPoll, ...urlOptions }: CoreMethodParams<'verifyFarcasterV2'>): CoreMethodResponse<'verifyFarcasterV2'>;
|
|
551
930
|
/**
|
|
552
931
|
* Validates the response received from an attempted Telegram login for authenticity, then
|
|
553
932
|
* creates or retrieves the corresponding Para user and prepares the Para instance to sign in with that user.
|
|
554
933
|
* @param authResponse - the response JSON object received from the Telegram widget.
|
|
555
934
|
* @returns `{ isValid: boolean; telegramUserId?: string; userId?: string; isNewUser?: boolean; supportedAuthMethods?: AuthMethod[]; biometricHints?: BiometricLocationHint[] }`
|
|
556
935
|
*/
|
|
557
|
-
|
|
936
|
+
verifyTelegramV2({ telegramAuthResponse, ...urlOptions }: CoreMethodParams<'verifyTelegramV2'>): CoreMethodResponse<'verifyTelegramV2'>;
|
|
558
937
|
/**
|
|
559
938
|
* Waits for the session to be active and sets up the user.
|
|
560
939
|
*
|
|
@@ -563,11 +942,11 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
563
942
|
* @param {boolean} [opts.skipSessionRefresh] whether to skip refreshing the session.
|
|
564
943
|
* @returns {Object} `{ isComplete: boolean; isError: boolean; needsWallet: boolean; partnerId: string; }` the result data
|
|
565
944
|
**/
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
945
|
+
waitForLoginV2({ isCanceled, onCancel, onPoll, skipSessionRefresh, }?: CoreMethodParams<'waitForLoginV2'>): CoreMethodResponse<'waitForLoginV2'>;
|
|
946
|
+
waitForSignupV2({ isCanceled, onCancel, onPoll, }: CoreMethodParams<'waitForSignupV2'>): CoreMethodResponse<'waitForSignupV2'>;
|
|
947
|
+
waitForWalletCreationV2({ isCanceled, onCancel, }?: CoreMethodParams<'waitForWalletCreationV2'>): CoreMethodResponse<'waitForWalletCreationV2'>;
|
|
948
|
+
loginExternalWalletV2({ externalWallet, ...urlOptions }: CoreMethodParams<'loginExternalWalletV2'>): CoreMethodResponse<'loginExternalWalletV2'>;
|
|
949
|
+
verifyExternalWalletV2({ externalWallet, signedMessage, cosmosPublicKeyHex, cosmosSigner, ...urlOptions }: CoreMethodParams<'verifyExternalWalletV2'>): CoreMethodResponse<'verifyExternalWalletV2'>;
|
|
571
950
|
/**
|
|
572
951
|
* Performs 2FA verification.
|
|
573
952
|
* @param {Object} opts the options object
|
|
@@ -575,18 +954,18 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
575
954
|
* @param {string} opts.verificationCode the verification code to received via 2FA.
|
|
576
955
|
* @returns {Object} `{ address, initiatedAt, status, userId, walletId }`
|
|
577
956
|
*/
|
|
578
|
-
|
|
957
|
+
verify2faV2({ auth, verificationCode }: CoreMethodParams<'verify2faV2'>): CoreMethodResponse<'verify2faV2'>;
|
|
579
958
|
/**
|
|
580
959
|
* Sets up two-factor authentication for the current user.
|
|
581
960
|
* @returns {string} uri - uri to use for setting up 2FA
|
|
582
961
|
* */
|
|
583
|
-
|
|
962
|
+
setup2faV2(): CoreMethodResponse<'setup2faV2'>;
|
|
584
963
|
/**
|
|
585
964
|
* Enables 2FA.
|
|
586
965
|
* @param {Object} opts the options object
|
|
587
966
|
* @param {string} opts.verificationCode - the verification code received via 2FA.
|
|
588
967
|
*/
|
|
589
|
-
|
|
968
|
+
enable2faV2({ verificationCode }: CoreMethodParams<'enable2faV2'>): CoreMethodResponse<'enable2faV2'>;
|
|
590
969
|
/**
|
|
591
970
|
* Creates a new pregenerated wallet.
|
|
592
971
|
*
|
|
@@ -596,7 +975,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
596
975
|
* @param {WalletType} [opts.type] the type of wallet to create. Defaults to the first non-optional type in the instance's `supportedWalletTypes` array.
|
|
597
976
|
* @returns {Wallet} the created wallet.
|
|
598
977
|
**/
|
|
599
|
-
|
|
978
|
+
createPregenWalletV2(opts: CoreMethodParams<'createPregenWalletV2'>): CoreMethodResponse<'createPregenWalletV2'>;
|
|
600
979
|
/**
|
|
601
980
|
* Creates new pregenerated wallets for each desired type.
|
|
602
981
|
* If no types are provided, this method will create one for each of the non-optional types
|
|
@@ -607,7 +986,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
607
986
|
* @param {WalletType[]} [opts.types] the wallet types to create. Defaults to any types the instance supports that are not already present.
|
|
608
987
|
* @returns {Wallet[]} an array containing the created wallets.
|
|
609
988
|
**/
|
|
610
|
-
|
|
989
|
+
createPregenWalletPerTypeV2({ types, pregenId, }: CoreMethodParams<'createPregenWalletPerTypeV2'>): CoreMethodResponse<'createPregenWalletPerTypeV2'>;
|
|
611
990
|
/**
|
|
612
991
|
* Claims a pregenerated wallet.
|
|
613
992
|
* @param {Object} opts the options object.
|
|
@@ -615,7 +994,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
615
994
|
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the identifier of the user claiming the wallet
|
|
616
995
|
* @returns {[Wallet, string | null]} `[wallet, recoveryShare]` - the wallet object and the new recovery share.
|
|
617
996
|
**/
|
|
618
|
-
|
|
997
|
+
claimPregenWalletsV2({ pregenId, }?: CoreMethodParams<'claimPregenWalletsV2'>): CoreMethodResponse<'claimPregenWalletsV2'>;
|
|
619
998
|
/**
|
|
620
999
|
* Updates the identifier for a pregen wallet.
|
|
621
1000
|
* @param {Object} opts the options object.
|
|
@@ -623,7 +1002,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
623
1002
|
* @param {string} opts.newPregenIdentifier the new identtifier
|
|
624
1003
|
* @param {TPregenIdentifierType} opts.newPregenIdentifierType: the new identifier type
|
|
625
1004
|
**/
|
|
626
|
-
|
|
1005
|
+
updatePregenWalletIdentifierV2({ walletId, newPregenId, }: CoreMethodParams<'updatePregenWalletIdentifierV2'>): CoreMethodResponse<'updatePregenWalletIdentifierV2'>;
|
|
627
1006
|
/**
|
|
628
1007
|
* Checks if a pregen Wallet exists for the given identifier with the current partner.
|
|
629
1008
|
* @param {Object} opts the options object.
|
|
@@ -631,7 +1010,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
631
1010
|
* @param {TPregenIdentifierType} opts.pregenIdentifierType type of the string of the identifier of the user claiming the wallet
|
|
632
1011
|
* @returns {boolean} whether the pregen wallet exists
|
|
633
1012
|
**/
|
|
634
|
-
|
|
1013
|
+
hasPregenWalletV2({ pregenId }: CoreMethodParams<'hasPregenWalletV2'>): CoreMethodResponse<'hasPregenWalletV2'>;
|
|
635
1014
|
/**
|
|
636
1015
|
* Get pregen wallets for the given identifier.
|
|
637
1016
|
* @param {Object} opts the options object.
|
|
@@ -639,5 +1018,5 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
639
1018
|
* @param {TPregenIdentifierType} opts.pregenIdentifierType - type of the identifier of the user claiming the wallet
|
|
640
1019
|
* @returns {Promise<WalletEntity[]>} the array of found wallets
|
|
641
1020
|
**/
|
|
642
|
-
|
|
1021
|
+
getPregenWalletsV2({ pregenId, }?: CoreMethodParams<'getPregenWalletsV2'>): CoreMethodResponse<'getPregenWalletsV2'>;
|
|
643
1022
|
}
|