@getpara/core-sdk 2.0.0-alpha.63 → 2.0.0-alpha.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ParaCore.js +256 -103
- package/dist/cjs/constants.js +4 -1
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/types/coreApi.js +4 -2
- package/dist/cjs/utils/index.js +3 -1
- package/dist/cjs/utils/wallet.js +15 -0
- package/dist/cjs/utils/window.js +38 -0
- package/dist/esm/ParaCore.js +259 -104
- package/dist/esm/constants.js +3 -1
- package/dist/esm/index.js +10 -2
- package/dist/esm/types/coreApi.js +4 -2
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/wallet.js +14 -0
- package/dist/esm/utils/window.js +16 -0
- package/dist/types/ParaCore.d.ts +20 -5
- package/dist/types/constants.d.ts +1 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/shares/enclave.d.ts +1 -1
- package/dist/types/types/coreApi.d.ts +13 -4
- package/dist/types/types/methods.d.ts +15 -8
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/wallet.d.ts +1 -0
- package/dist/types/utils/window.d.ts +2 -0
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -34,8 +34,13 @@ import {
|
|
|
34
34
|
export * from "./types/coreApi.js";
|
|
35
35
|
export * from "./types/events.js";
|
|
36
36
|
export * from "./types/config.js";
|
|
37
|
-
import { getPortalDomain, dispatchEvent, entityToWallet, constructUrl, shortenUrl } from "./utils/index.js";
|
|
38
|
-
import {
|
|
37
|
+
import { getPortalDomain, dispatchEvent, entityToWallet, constructUrl, shortenUrl, isPortal } from "./utils/index.js";
|
|
38
|
+
import {
|
|
39
|
+
PREFIX,
|
|
40
|
+
PARA_PREFIX,
|
|
41
|
+
LOCAL_STORAGE_CURRENT_WALLET_IDS,
|
|
42
|
+
LOCAL_STORAGE_WALLETS
|
|
43
|
+
} from "./constants.js";
|
|
39
44
|
import { distributeNewShare } from "./shares/shareDistribution.js";
|
|
40
45
|
import { KeyContainer } from "./shares/KeyContainer.js";
|
|
41
46
|
import { getBaseUrl, initClient } from "./external/userManagementClient.js";
|
|
@@ -80,6 +85,8 @@ export {
|
|
|
80
85
|
EmailTheme,
|
|
81
86
|
KeyContainer,
|
|
82
87
|
LINKED_ACCOUNT_TYPES,
|
|
88
|
+
LOCAL_STORAGE_CURRENT_WALLET_IDS,
|
|
89
|
+
LOCAL_STORAGE_WALLETS,
|
|
83
90
|
NON_ED25519,
|
|
84
91
|
Network,
|
|
85
92
|
OAUTH_METHODS,
|
|
@@ -128,6 +135,7 @@ export {
|
|
|
128
135
|
getSHA256HashHex,
|
|
129
136
|
hashPasswordWithSalt,
|
|
130
137
|
initClient,
|
|
138
|
+
isPortal,
|
|
131
139
|
isWalletSupported,
|
|
132
140
|
mpcComputationClient,
|
|
133
141
|
paraVersion,
|
|
@@ -48,7 +48,8 @@ const PARA_CORE_METHODS = [
|
|
|
48
48
|
"getWalletBalance",
|
|
49
49
|
"issueJwt",
|
|
50
50
|
"getLinkedAccounts",
|
|
51
|
-
"accountLinkInProgress"
|
|
51
|
+
"accountLinkInProgress",
|
|
52
|
+
"addCredential"
|
|
52
53
|
];
|
|
53
54
|
const PARA_INTERNAL_METHODS = [
|
|
54
55
|
"linkAccount",
|
|
@@ -60,7 +61,8 @@ const PARA_INTERNAL_METHODS = [
|
|
|
60
61
|
"verifyExternalWalletLink",
|
|
61
62
|
"accountLinkInProgress",
|
|
62
63
|
"prepareLogin",
|
|
63
|
-
"sendLoginCode"
|
|
64
|
+
"sendLoginCode",
|
|
65
|
+
"supportedUserAuthMethods"
|
|
64
66
|
];
|
|
65
67
|
export {
|
|
66
68
|
PARA_CORE_METHODS,
|
package/dist/esm/utils/index.js
CHANGED
package/dist/esm/utils/wallet.js
CHANGED
|
@@ -91,8 +91,22 @@ function mergeCurrentWalletIds(original, additional) {
|
|
|
91
91
|
function newUuid() {
|
|
92
92
|
return uuid.v4();
|
|
93
93
|
}
|
|
94
|
+
function currentWalletIdsEq(a, b) {
|
|
95
|
+
if (!a && !b) return true;
|
|
96
|
+
if (!a || !b) return false;
|
|
97
|
+
const aKeys = Object.keys(a);
|
|
98
|
+
const bKeys = Object.keys(b);
|
|
99
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
100
|
+
return aKeys.every((key) => {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
const aIds = ((_a = a[key]) == null ? void 0 : _a.sort()) || [];
|
|
103
|
+
const bIds = ((_b = b[key]) == null ? void 0 : _b.sort()) || [];
|
|
104
|
+
return aIds.length === bIds.length && aIds.every((id, index) => id === bIds[index]);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
94
107
|
export {
|
|
95
108
|
WalletSchemeTypeMap,
|
|
109
|
+
currentWalletIdsEq,
|
|
96
110
|
entityToWallet,
|
|
97
111
|
getEquivalentTypes,
|
|
98
112
|
getSchemes,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "../chunk-W5CT3TVS.js";
|
|
2
|
+
import { getPortalBaseURL } from "./url.js";
|
|
3
|
+
function isPortal(ctx, env) {
|
|
4
|
+
var _a, _b;
|
|
5
|
+
if (typeof window === "undefined") return false;
|
|
6
|
+
const normalizedUrl = (_b = (_a = window.location) == null ? void 0 : _a.host) == null ? void 0 : _b.replace("getpara", "usecapsule");
|
|
7
|
+
const isOnPortalDomain = getPortalBaseURL(env ? { env } : ctx).includes(normalizedUrl);
|
|
8
|
+
if (!isOnPortalDomain) return false;
|
|
9
|
+
const isInIframe = window.parent !== window && !window.opener;
|
|
10
|
+
const isInPopup = window.opener && window.parent === window;
|
|
11
|
+
const isDirectAccess = !window.opener && !window.parent;
|
|
12
|
+
return isInIframe || isInPopup || isDirectAccess;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
isPortal
|
|
16
|
+
};
|
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
7
7
|
popupWindow: Window | null;
|
|
8
8
|
static version?: string;
|
|
9
9
|
ctx: Ctx;
|
|
10
|
+
protected walletSwitchIds?: CurrentWalletIds;
|
|
10
11
|
protected isNativePasskey: boolean;
|
|
11
12
|
protected isPartnerOptional?: boolean;
|
|
12
13
|
protected setModalError(_error?: string): void;
|
|
@@ -143,6 +144,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
143
144
|
onRampPurchase: OnRampPurchase;
|
|
144
145
|
} | undefined;
|
|
145
146
|
protected platformUtils: PlatformUtils;
|
|
147
|
+
protected nonPersistedStorageKeys: string[];
|
|
146
148
|
private localStorageGetItem;
|
|
147
149
|
private localStorageSetItem;
|
|
148
150
|
private localStorageRemoveItem;
|
|
@@ -163,7 +165,6 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
163
165
|
private convertBigInt;
|
|
164
166
|
private convertEncryptionKeyPair;
|
|
165
167
|
protected isPortal(envOverride?: Environment): boolean;
|
|
166
|
-
protected isRecoveryPortal(envOverride?: Environment): boolean;
|
|
167
168
|
private isParaConnect;
|
|
168
169
|
private requireApiKey;
|
|
169
170
|
private isWalletSupported;
|
|
@@ -351,7 +352,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
351
352
|
*/
|
|
352
353
|
findWalletByAddress(address: string, filter?: WalletFilters | undefined): any;
|
|
353
354
|
findWallet(idOrAddress?: string, overrideType?: TWalletType, filter?: WalletFilters): Omit<Wallet, 'signer'> | undefined;
|
|
354
|
-
get availableWallets(): Pick<Wallet, 'id' | 'type' | 'name' | 'address' | 'isExternal' | 'externalProviderId' | 'isExternalConnectionOnly'>[];
|
|
355
|
+
get availableWallets(): Pick<Wallet, 'id' | 'type' | 'name' | 'address' | 'partner' | 'isExternal' | 'externalProviderId' | 'isExternalConnectionOnly'>[];
|
|
355
356
|
/**
|
|
356
357
|
* Retrieves all usable wallets with the provided type (`'EVM' | 'COSMOS' | 'SOLANA'`)
|
|
357
358
|
* @param {string} type the wallet type to filter by.
|
|
@@ -380,7 +381,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
380
381
|
* @returns {WalletEntity[]} wallets that were fetched.
|
|
381
382
|
*/
|
|
382
383
|
fetchWallets(): CoreMethodResponse<'fetchWallets'>;
|
|
383
|
-
|
|
384
|
+
protected populateWalletAddresses(): Promise<void>;
|
|
384
385
|
private populatePregenWalletAddresses;
|
|
385
386
|
/**
|
|
386
387
|
* Logs in or creates a new user using an external wallet address.
|
|
@@ -436,8 +437,13 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
436
437
|
get isGuestMode(): boolean;
|
|
437
438
|
/**
|
|
438
439
|
* Get the auth methods available to an existing user
|
|
440
|
+
* @deprecated Use supportedUserAuthMethods instead
|
|
439
441
|
*/
|
|
440
442
|
protected supportedAuthMethods(auth: Auth<PrimaryAuthType | 'userId'>): Promise<Set<AuthMethod>>;
|
|
443
|
+
/**
|
|
444
|
+
* Get the auth methods available to an existing user
|
|
445
|
+
*/
|
|
446
|
+
protected supportedUserAuthMethods(): Promise<Set<AuthMethod>>;
|
|
441
447
|
/**
|
|
442
448
|
* Get hints associated with the users stored biometrics.
|
|
443
449
|
* @deprecated
|
|
@@ -482,7 +488,15 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
482
488
|
* @param {boolean} [opts.skipSessionRefresh] whether to skip refreshing the session.
|
|
483
489
|
* @returns {Object} `{ isComplete: boolean; isError: boolean; needsWallet: boolean; partnerId: string; }` the result data
|
|
484
490
|
**/
|
|
485
|
-
waitForLogin(
|
|
491
|
+
waitForLogin(args: CoreMethodParams<'waitForLogin'>): CoreMethodResponse<'waitForLogin'>;
|
|
492
|
+
protected waitForWalletSwitching(args: CoreMethodParams<'waitForLogin'>): CoreMethodResponse<'waitForLogin'>;
|
|
493
|
+
/**
|
|
494
|
+
* Gets the switch wallets URL for wallet selection.
|
|
495
|
+
* The authMethod is automatically included in the URL if available.
|
|
496
|
+
*
|
|
497
|
+
* @returns {Promise<{ url: string; authMethod: TAuthMethod }>} The switch wallets URL and authMethod
|
|
498
|
+
*/
|
|
499
|
+
protected getSwitchWalletsUrl(): Promise<string>;
|
|
486
500
|
/**
|
|
487
501
|
* Updates the session with the user management server, possibly
|
|
488
502
|
* opening a popup to refresh the session.
|
|
@@ -706,10 +720,11 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
706
720
|
**/
|
|
707
721
|
toString(): string;
|
|
708
722
|
protected devLog(...s: string[]): void;
|
|
709
|
-
protected getNewCredentialAndUrl({ authMethod, isForNewDevice, portalTheme, shorten, }?: NewCredentialUrlParams): Promise<{
|
|
723
|
+
protected getNewCredentialAndUrl({ authMethod: optsAuthMethod, isForNewDevice, portalTheme, shorten, }?: NewCredentialUrlParams): Promise<{
|
|
710
724
|
credentialId: string;
|
|
711
725
|
url?: string;
|
|
712
726
|
}>;
|
|
727
|
+
addCredential({ authMethod }: Pick<NewCredentialUrlParams, 'authMethod'>): Promise<string>;
|
|
713
728
|
/**
|
|
714
729
|
* Returns a Para Portal URL for logging in with a WebAuth passkey, password, PIN or OTP.
|
|
715
730
|
* @param {Object} opts the options object
|
|
@@ -16,6 +16,7 @@ export declare const LOCAL_STORAGE_CURRENT_WALLET_IDS = "@CAPSULE/currentWalletI
|
|
|
16
16
|
export declare const LOCAL_STORAGE_SESSION_COOKIE = "@CAPSULE/sessionCookie";
|
|
17
17
|
export declare const LOCAL_STORAGE_ENCLAVE_JWT = "@CAPSULE/enclaveJwt";
|
|
18
18
|
export declare const LOCAL_STORAGE_ENCLAVE_REFRESH_JWT = "@CAPSULE/enclaveRefreshJwt";
|
|
19
|
+
export declare const LOCAL_STORAGE_AUTH_METHOD = "@CAPSULE/authMethod";
|
|
19
20
|
export declare const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR = "@CAPSULE/loginEncryptionKeyPair";
|
|
20
21
|
export declare const POLLING_INTERVAL_MS = 2000;
|
|
21
22
|
export declare const SHORT_POLLING_INTERVAL_MS = 1000;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ParaCore } from './ParaCore.js';
|
|
2
|
-
export { type Auth, type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, type VerifiedAuth, AuthMethod, AuthMethodStatus, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, type TNetwork, WalletType, type TWalletType, WalletScheme, type TWalletScheme, OnRampAsset, type TOnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAssets, type OnRampPurchase, type OnRampAssetInfo, type ProviderAssetInfo, OnRampMethod, type Theme, OAuthMethod, type TOAuthMethod, type TLinkedAccountType, type SupportedAccountLinks, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, type LinkedAccount, type LinkedAccounts, type TExternalWallet, type ExternalWalletInfo, type PregenAuth, type Setup2faResponse, type TelegramAuthResponse, type VerifyExternalWalletParams, type AssetMetadata, type AssetMetadataIndexed, type AssetValue, type BalancesConfig, type WalletBalance, type ProfileBalance, type OfframpDepositRequest, RecoveryStatus, ThemeMode, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, LINKED_ACCOUNT_TYPES, EXTERNAL_WALLET_TYPES, EVM_WALLETS, SOLANA_WALLETS, COSMOS_WALLETS, } from '@getpara/user-management-client';
|
|
2
|
+
export { type Auth, type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, type VerifiedAuth, AuthMethod, type TAuthMethod, AuthMethodStatus, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, type TNetwork, WalletType, type TWalletType, WalletScheme, type TWalletScheme, OnRampAsset, type TOnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAssets, type OnRampPurchase, type OnRampAssetInfo, type ProviderAssetInfo, OnRampMethod, type Theme, OAuthMethod, type TOAuthMethod, type TLinkedAccountType, type SupportedAccountLinks, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, type LinkedAccount, type LinkedAccounts, type TExternalWallet, type ExternalWalletInfo, type PregenAuth, type Setup2faResponse, type TelegramAuthResponse, type VerifyExternalWalletParams, type AssetMetadata, type AssetMetadataIndexed, type AssetValue, type BalancesConfig, type WalletBalance, type ProfileBalance, type OfframpDepositRequest, RecoveryStatus, ThemeMode, NON_ED25519, PREGEN_IDENTIFIER_TYPES, WALLET_TYPES, WALLET_SCHEMES, OAUTH_METHODS, LINKED_ACCOUNT_TYPES, EXTERNAL_WALLET_TYPES, EVM_WALLETS, SOLANA_WALLETS, COSMOS_WALLETS, } from '@getpara/user-management-client';
|
|
3
3
|
export { PopupType, PregenIdentifierType, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type Wallet, type GetWalletBalanceParams, type AccountLinkInProgress, AccountLinkError, type InternalInterface, } from './types/index.js';
|
|
4
4
|
export * from './types/coreApi.js';
|
|
5
5
|
export * from './types/events.js';
|
|
6
6
|
export * from './types/config.js';
|
|
7
|
-
export { getPortalDomain, dispatchEvent, entityToWallet, constructUrl, shortenUrl } from './utils/index.js';
|
|
8
|
-
export { PREFIX as STORAGE_PREFIX, PARA_PREFIX as PARA_STORAGE_PREFIX } from './constants.js';
|
|
7
|
+
export { getPortalDomain, dispatchEvent, entityToWallet, constructUrl, shortenUrl, isPortal } from './utils/index.js';
|
|
8
|
+
export { PREFIX as STORAGE_PREFIX, PARA_PREFIX as PARA_STORAGE_PREFIX, LOCAL_STORAGE_CURRENT_WALLET_IDS, LOCAL_STORAGE_WALLETS, } from './constants.js';
|
|
9
9
|
export { distributeNewShare } from './shares/shareDistribution.js';
|
|
10
10
|
export { KeyContainer } from './shares/KeyContainer.js';
|
|
11
11
|
export type { PlatformUtils } from './PlatformUtils.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { BackupKitEmailProps, CurrentWalletIds, ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, PregenAuth, Setup2faResponse, VerifiedAuth, VerifyExternalWalletParams, WalletEntity, WalletParams, TWalletType, IssueJwtParams, IssueJwtResponse, TLinkedAccountType, LinkedAccounts } from '@getpara/user-management-client';
|
|
2
|
-
import { AuthStateLogin, AuthStateVerify, OAuthResponse, AuthStateBaseParams, WithCustomTheme, WithUseShortUrls, Verify2faResponse, AuthStateSignup, AuthStateVerifyOrLogin, OAuthUrlParams, StorageType, PollParams, CoreAuthInfo, GetWalletBalanceParams, GetWalletBalanceResponse, FarcasterParams, TelegramParams, OAuthParams } from './methods.js';
|
|
1
|
+
import { BackupKitEmailProps, CurrentWalletIds, ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, PregenAuth, Setup2faResponse, VerifiedAuth, VerifyExternalWalletParams, WalletEntity, WalletParams, TWalletType, IssueJwtParams, IssueJwtResponse, TLinkedAccountType, LinkedAccounts, AuthMethod } from '@getpara/user-management-client';
|
|
2
|
+
import { AuthStateLogin, AuthStateVerify, OAuthResponse, AuthStateBaseParams, WithCustomTheme, WithUseShortUrls, Verify2faResponse, AuthStateSignup, AuthStateVerifyOrLogin, OAuthUrlParams, StorageType, PollParams, CoreAuthInfo, GetWalletBalanceParams, GetWalletBalanceResponse, FarcasterParams, TelegramParams, OAuthParams, NewCredentialUrlParams } from './methods.js';
|
|
3
3
|
import { ParaCore } from '../ParaCore.js';
|
|
4
4
|
import { FullSignatureRes, Wallet } from './wallet.js';
|
|
5
5
|
import { AccountLinkInProgress } from './auth.js';
|
|
6
|
-
export declare const PARA_CORE_METHODS: readonly ["getAuthInfo", "signUpOrLogIn", "verifyNewAccount", "waitForLogin", "waitForSignup", "waitForWalletCreation", "getOAuthUrl", "verifyOAuth", "getFarcasterConnectUri", "verifyFarcaster", "verifyTelegram", "resendVerificationCode", "loginExternalWallet", "verifyExternalWallet", "setup2fa", "enable2fa", "verify2fa", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "importSession", "getVerificationToken", "getWallets", "getWalletsByType", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWallets", "hasPregenWallet", "updatePregenWalletIdentifier", "createPregenWallet", "createPregenWalletPerType", "claimPregenWallets", "createGuestWallets", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction", "getWalletBalance", "issueJwt", "getLinkedAccounts", "accountLinkInProgress"];
|
|
7
|
-
export declare const PARA_INTERNAL_METHODS: readonly ["linkAccount", "unlinkAccount", "verifyEmailOrPhoneLink", "verifyOAuthLink", "verifyFarcasterLink", "verifyTelegramLink", "verifyExternalWalletLink", "accountLinkInProgress", "prepareLogin", "sendLoginCode"];
|
|
6
|
+
export declare const PARA_CORE_METHODS: readonly ["getAuthInfo", "signUpOrLogIn", "verifyNewAccount", "waitForLogin", "waitForSignup", "waitForWalletCreation", "getOAuthUrl", "verifyOAuth", "getFarcasterConnectUri", "verifyFarcaster", "verifyTelegram", "resendVerificationCode", "loginExternalWallet", "verifyExternalWallet", "setup2fa", "enable2fa", "verify2fa", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "importSession", "getVerificationToken", "getWallets", "getWalletsByType", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWallets", "hasPregenWallet", "updatePregenWalletIdentifier", "createPregenWallet", "createPregenWalletPerType", "claimPregenWallets", "createGuestWallets", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction", "getWalletBalance", "issueJwt", "getLinkedAccounts", "accountLinkInProgress", "addCredential"];
|
|
7
|
+
export declare const PARA_INTERNAL_METHODS: readonly ["linkAccount", "unlinkAccount", "verifyEmailOrPhoneLink", "verifyOAuthLink", "verifyFarcasterLink", "verifyTelegramLink", "verifyExternalWalletLink", "accountLinkInProgress", "prepareLogin", "sendLoginCode", "supportedUserAuthMethods"];
|
|
8
8
|
export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
|
|
9
9
|
export type CoreMethodParams<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
|
|
10
10
|
params: infer P;
|
|
@@ -119,6 +119,7 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
119
119
|
params: OAuthUrlParams & {
|
|
120
120
|
sessionLookupId?: string;
|
|
121
121
|
encryptionKey?: string;
|
|
122
|
+
portalCallbackParams?: Record<string, string>;
|
|
122
123
|
};
|
|
123
124
|
response: string;
|
|
124
125
|
};
|
|
@@ -483,6 +484,10 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
483
484
|
userId: string;
|
|
484
485
|
};
|
|
485
486
|
};
|
|
487
|
+
addCredential: {
|
|
488
|
+
params: Pick<NewCredentialUrlParams, 'authMethod'>;
|
|
489
|
+
response: Promise<string>;
|
|
490
|
+
};
|
|
486
491
|
};
|
|
487
492
|
export type InternalMethods = {
|
|
488
493
|
linkAccount: {
|
|
@@ -531,6 +536,10 @@ export type InternalMethods = {
|
|
|
531
536
|
params: void;
|
|
532
537
|
response: void;
|
|
533
538
|
};
|
|
539
|
+
supportedUserAuthMethods: {
|
|
540
|
+
params: void;
|
|
541
|
+
response: Promise<Set<AuthMethod>>;
|
|
542
|
+
};
|
|
534
543
|
};
|
|
535
544
|
export type CoreInterface = {
|
|
536
545
|
[key in keyof CoreMethods]: Partial<CoreMethod<key>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateSignup,
|
|
1
|
+
import { PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateSignup, TAuthMethod, ServerAuthStateVerify, VerifiedAuth, AuthExtras, RecoveryStatus, Theme, TOAuthMethod, TWalletType, TelegramAuthResponse, VerifyThirdPartyAuth, ServerAuthStateDone } from '@getpara/user-management-client';
|
|
2
2
|
import { Wallet } from './wallet.js';
|
|
3
3
|
type Device = {
|
|
4
4
|
sessionId: string;
|
|
@@ -12,7 +12,7 @@ export type VerifyExternalWalletV1 = {
|
|
|
12
12
|
cosmosPublicKeyHex?: string;
|
|
13
13
|
cosmosSigner?: string;
|
|
14
14
|
};
|
|
15
|
-
export type PortalUrlType = 'createAuth' | 'createPassword' | 'loginAuth' | 'loginPassword' | 'txReview' | 'onRamp' | 'telegramLogin' | 'createPIN' | 'loginPIN' | 'oAuth' | 'oAuthCallback' | 'loginOTP' | 'telegramLoginVerify' | 'loginFarcaster';
|
|
15
|
+
export type PortalUrlType = 'createAuth' | 'createPassword' | 'loginAuth' | 'loginPassword' | 'txReview' | 'onRamp' | 'telegramLogin' | 'createPIN' | 'loginPIN' | 'oAuth' | 'oAuthCallback' | 'loginOTP' | 'telegramLoginVerify' | 'loginFarcaster' | 'switchWallets' | 'addNewCredential';
|
|
16
16
|
export type PortalUrlOptions = {
|
|
17
17
|
params?: Record<string, string | undefined | null>;
|
|
18
18
|
isForNewDevice?: boolean;
|
|
@@ -26,12 +26,15 @@ export type PortalUrlOptions = {
|
|
|
26
26
|
oAuthMethod?: OAuthUrlParams['method'];
|
|
27
27
|
appScheme?: string;
|
|
28
28
|
encryptionKey?: string;
|
|
29
|
+
addNewCredentialType?: Exclude<TAuthMethod, 'BASIC_LOGIN'>;
|
|
30
|
+
addNewCredentialPasswordId?: string;
|
|
31
|
+
addNewCredentialPasskeyId?: string;
|
|
29
32
|
};
|
|
30
33
|
export type WithAuthMethod = {
|
|
31
34
|
/**
|
|
32
|
-
* Which authorization method to use for the URL, either `'
|
|
35
|
+
* Which authorization method to use for the URL, either `'PASSKEY'`, `'PASSWORD'` or `'PIN'`.
|
|
33
36
|
*/
|
|
34
|
-
authMethod?: Uppercase<
|
|
37
|
+
authMethod?: Uppercase<TAuthMethod>;
|
|
35
38
|
};
|
|
36
39
|
export type WithCustomTheme = {
|
|
37
40
|
/**
|
|
@@ -89,11 +92,15 @@ export type TelegramParams = {
|
|
|
89
92
|
export type LoginUrlParams = WithAuthMethod & WithCustomTheme & WithShorten & {
|
|
90
93
|
sessionId?: string;
|
|
91
94
|
};
|
|
92
|
-
export type NewCredentialUrlParams =
|
|
95
|
+
export type NewCredentialUrlParams = WithCustomTheme & WithShorten & {
|
|
93
96
|
/**
|
|
94
97
|
* Whether the URL is meant to add a passkey for a previous user on a new device. Defaults to `false`.
|
|
95
98
|
*/
|
|
96
99
|
isForNewDevice?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* The authentication method to add.
|
|
102
|
+
*/
|
|
103
|
+
authMethod?: Exclude<TAuthMethod, 'BASIC_LOGIN'>;
|
|
97
104
|
};
|
|
98
105
|
export type OAuthUrlParams = {
|
|
99
106
|
/**
|
|
@@ -149,7 +156,7 @@ export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & Wi
|
|
|
149
156
|
/**
|
|
150
157
|
* Supported login auth methods for this session.
|
|
151
158
|
*/
|
|
152
|
-
loginAuthMethods?:
|
|
159
|
+
loginAuthMethods?: TAuthMethod[];
|
|
153
160
|
};
|
|
154
161
|
export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> & WithIsPasskeySupported & {
|
|
155
162
|
/**
|
|
@@ -179,10 +186,10 @@ export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> &
|
|
|
179
186
|
/**
|
|
180
187
|
* Supported signup auth methods for this session.
|
|
181
188
|
*/
|
|
182
|
-
signupAuthMethods?:
|
|
189
|
+
signupAuthMethods?: TAuthMethod[];
|
|
183
190
|
};
|
|
184
191
|
export type AuthStateDone = Omit<ServerAuthStateDone, 'authMethods'> & {
|
|
185
|
-
authMethods:
|
|
192
|
+
authMethods: TAuthMethod[];
|
|
186
193
|
};
|
|
187
194
|
export type AuthStateVerifyOrLogin = AuthStateVerify | AuthStateLogin;
|
|
188
195
|
export type AuthStateSignupOrLoginOrDone = AuthStateSignup | AuthStateLogin | AuthStateDone;
|
|
@@ -11,3 +11,4 @@ export declare function migrateWallet(obj: Record<string, unknown>): Wallet;
|
|
|
11
11
|
export declare function supportedWalletTypesEq(a: SupportedWalletTypes, b: SupportedWalletTypes): boolean;
|
|
12
12
|
export declare function mergeCurrentWalletIds(original: CurrentWalletIds, additional: CurrentWalletIds): CurrentWalletIds;
|
|
13
13
|
export declare function newUuid(): string;
|
|
14
|
+
export declare function currentWalletIdsEq(a: CurrentWalletIds | undefined, b: CurrentWalletIds | undefined): boolean;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.64",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@celo/utils": "^8.0.2",
|
|
6
6
|
"@cosmjs/encoding": "^0.32.4",
|
|
7
7
|
"@ethereumjs/util": "^9.1.0",
|
|
8
|
-
"@getpara/user-management-client": "2.0.0-alpha.
|
|
8
|
+
"@getpara/user-management-client": "2.0.0-alpha.64",
|
|
9
9
|
"@noble/hashes": "^1.5.0",
|
|
10
10
|
"base64url": "^3.0.1",
|
|
11
11
|
"libphonenumber-js": "^1.11.7",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dist",
|
|
28
28
|
"package.json"
|
|
29
29
|
],
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "c55ecfbbd200053ddb78d88c93c597c0f781a6bb",
|
|
31
31
|
"main": "dist/cjs/index.js",
|
|
32
32
|
"module": "dist/esm/index.js",
|
|
33
33
|
"scripts": {
|