@getpara/core-sdk 2.24.0 → 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/ParaCore.js +28 -9
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/services/AuthService.js +2 -2
- package/dist/cjs/services/ExternalWalletService.js +0 -3
- package/dist/cjs/services/LoginFlowService.js +24 -13
- package/dist/cjs/services/PollingService.js +3 -3
- package/dist/cjs/services/PortalUrlService.js +50 -43
- package/dist/cjs/services/SessionManagementService.js +3 -3
- package/dist/cjs/services/SignupFlowService.js +18 -3
- package/dist/cjs/services/VerificationFlowService.js +9 -4
- package/dist/cjs/services/WalletService.js +8 -1
- package/dist/cjs/state/CoreStateManager.js +37 -17
- package/dist/cjs/state/machines/authStateMachine.js +12 -0
- package/dist/cjs/types/coreApi.js +1 -0
- package/dist/esm/ParaCore.js +28 -9
- package/dist/esm/constants.js +1 -1
- package/dist/esm/services/AuthService.js +2 -2
- package/dist/esm/services/ExternalWalletService.js +0 -3
- package/dist/esm/services/LoginFlowService.js +24 -13
- package/dist/esm/services/PollingService.js +3 -3
- package/dist/esm/services/PortalUrlService.js +50 -43
- package/dist/esm/services/SessionManagementService.js +3 -3
- package/dist/esm/services/SignupFlowService.js +18 -3
- package/dist/esm/services/VerificationFlowService.js +9 -4
- package/dist/esm/services/WalletService.js +8 -1
- package/dist/esm/state/CoreStateManager.js +37 -17
- package/dist/esm/state/machines/authStateMachine.js +12 -0
- package/dist/esm/types/coreApi.js +1 -0
- package/dist/types/ParaCore.d.ts +17 -7
- package/dist/types/services/WalletService.d.ts +2 -1
- package/dist/types/services/types/AuthServiceTypes.d.ts +4 -1
- package/dist/types/services/types/PortalUrlServiceTypes.d.ts +9 -5
- package/dist/types/services/types/WalletServiceTypes.d.ts +12 -0
- package/dist/types/state/machines/authStateMachine.d.ts +112 -1
- package/dist/types/state/machines/coreStateMachine.d.ts +682 -16
- package/dist/types/state/types/auth.d.ts +4 -1
- package/dist/types/state/types/core.d.ts +11 -1
- package/dist/types/types/authState.d.ts +25 -0
- package/dist/types/types/config.d.ts +3 -2
- package/dist/types/types/coreApi.d.ts +9 -3
- package/dist/types/types/serviceInterfaces.d.ts +3 -3
- package/dist/types/types/util.d.ts +14 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ServerAuthState } from '@getpara/user-management-client';
|
|
1
|
+
import type { ServerAuthState, TOAuthMethod } from '@getpara/user-management-client';
|
|
2
2
|
import type { AuthState, WithCustomTheme, WithUseShortUrls } from '../../types/index.js';
|
|
3
3
|
import type { createAuthStateMachine } from '../machines/authStateMachine.js';
|
|
4
4
|
import type { CoreActor, ServerAuthStateResult } from './core.js';
|
|
@@ -75,6 +75,8 @@ export type AuthEvents = {
|
|
|
75
75
|
type: 'COMPLETE';
|
|
76
76
|
} | {
|
|
77
77
|
type: 'CANCEL';
|
|
78
|
+
} | {
|
|
79
|
+
type: 'LOGOUT';
|
|
78
80
|
} | {
|
|
79
81
|
type: 'INITIALIZE_GUEST_MODE';
|
|
80
82
|
} | {
|
|
@@ -96,6 +98,7 @@ export interface AuthContext {
|
|
|
96
98
|
externalWalletInfo?: PerformConnectExternalWalletResponse;
|
|
97
99
|
externalWalletSignVerification?: BaseVerifyExternalWalletParams;
|
|
98
100
|
isLegacy: boolean;
|
|
101
|
+
selectedOAuthMethod: TOAuthMethod | null;
|
|
99
102
|
retryAttempts?: {
|
|
100
103
|
externalWalletVerification?: number;
|
|
101
104
|
newAccountVerification?: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BiometricLocationHint, CurrentWalletIds, ServerAuthState } from '@getpara/user-management-client';
|
|
1
|
+
import type { BiometricLocationHint, CurrentWalletIds, ServerAuthState, TOAuthMethod } from '@getpara/user-management-client';
|
|
2
2
|
import type { AuthState, Wallet, WithCustomTheme, WithUseShortUrls } from '../../types/index.js';
|
|
3
3
|
import { AuthMachine, AuthPhase } from './auth.js';
|
|
4
4
|
import { WalletMachine, WalletPhase } from './wallet.js';
|
|
@@ -55,6 +55,7 @@ export interface CoreState {
|
|
|
55
55
|
} | null;
|
|
56
56
|
needsWallet: boolean;
|
|
57
57
|
externalWalletSignVerification?: BaseVerifyExternalWalletParams;
|
|
58
|
+
selectedOAuthMethod: TOAuthMethod | null;
|
|
58
59
|
guestWallets: Wallet[] | null;
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
@@ -77,16 +78,24 @@ export type AuthStateInfo = {
|
|
|
77
78
|
hasPin: boolean;
|
|
78
79
|
/** Portal URL for passkey login/signup */
|
|
79
80
|
passkeyUrl: string | null;
|
|
81
|
+
/** Full (unshortened) portal URL for passkey login/signup */
|
|
82
|
+
passkeyFullUrl: string | null;
|
|
80
83
|
/** Portal URL for authorizing from a known device with passkey */
|
|
81
84
|
passkeyKnownDeviceUrl: string | null;
|
|
82
85
|
/** Portal URL for password login/signup */
|
|
83
86
|
passwordUrl: string | null;
|
|
84
87
|
/** Portal URL for PIN login/signup */
|
|
85
88
|
pinUrl: string | null;
|
|
89
|
+
/** Full (unshortened) portal URL for password login/signup */
|
|
90
|
+
passwordFullUrl: string | null;
|
|
91
|
+
/** Full (unshortened) portal URL for PIN login/signup */
|
|
92
|
+
pinFullUrl: string | null;
|
|
86
93
|
/** The Para system ID for the user's passkey credential (signup only) */
|
|
87
94
|
passkeyId: string | null;
|
|
88
95
|
/** Verification URL for email/phone verification in SLO */
|
|
89
96
|
verificationUrl: string | null;
|
|
97
|
+
/** Full (unshortened) verification URL. Used by preloaded iframe. */
|
|
98
|
+
verificationFullUrl: string | null;
|
|
90
99
|
/** External wallet verification data when signature is needed */
|
|
91
100
|
externalWalletVerification: {
|
|
92
101
|
signatureVerificationMessage: string;
|
|
@@ -103,6 +112,7 @@ export type StateSnapshot = {
|
|
|
103
112
|
authPhase: AuthPhase;
|
|
104
113
|
walletPhase: WalletPhase;
|
|
105
114
|
authStateInfo: AuthStateInfo;
|
|
115
|
+
selectedOAuthMethod: TOAuthMethod | null;
|
|
106
116
|
error: Error | null;
|
|
107
117
|
isReady: boolean;
|
|
108
118
|
};
|
|
@@ -4,6 +4,7 @@ export type CoreAuthInfo = PrimaryAuthInfo & AuthExtras;
|
|
|
4
4
|
export type AuthStateBaseParams = WithCustomTheme & WithUseShortUrls;
|
|
5
5
|
export type AuthStateVerify = ServerAuthStateVerify & {
|
|
6
6
|
loginUrl?: string;
|
|
7
|
+
loginFullUrl?: string;
|
|
7
8
|
};
|
|
8
9
|
export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & WithIsPasskeySupported & {
|
|
9
10
|
/**
|
|
@@ -22,6 +23,18 @@ export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & Wi
|
|
|
22
23
|
* A Para Portal URL for logging in via a PIN.
|
|
23
24
|
*/
|
|
24
25
|
pinUrl?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Full (unshortened) portal URL for passkey login.
|
|
28
|
+
*/
|
|
29
|
+
passkeyFullUrl?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Full (unshortened) portal URL for password login.
|
|
32
|
+
*/
|
|
33
|
+
passwordFullUrl?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Full (unshortened) portal URL for PIN login.
|
|
36
|
+
*/
|
|
37
|
+
pinFullUrl?: string;
|
|
25
38
|
/**
|
|
26
39
|
* Supported login auth methods for this session.
|
|
27
40
|
*/
|
|
@@ -40,6 +53,18 @@ export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> &
|
|
|
40
53
|
* A Para Portal URL for creating a new user PIN.
|
|
41
54
|
*/
|
|
42
55
|
pinUrl?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Full (unshortened) portal URL for passkey creation.
|
|
58
|
+
*/
|
|
59
|
+
passkeyFullUrl?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Full (unshortened) portal URL for password creation.
|
|
62
|
+
*/
|
|
63
|
+
passwordFullUrl?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Full (unshortened) portal URL for PIN creation.
|
|
66
|
+
*/
|
|
67
|
+
pinFullUrl?: string;
|
|
43
68
|
/**
|
|
44
69
|
* The Para system ID for the newly generated passkey.
|
|
45
70
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, PregenAuth, TWalletScheme, TWalletType
|
|
2
|
+
import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, PregenAuth, TWalletScheme, TWalletType } from '@getpara/user-management-client';
|
|
3
3
|
import { EnclaveClient } from '../shares/enclave.js';
|
|
4
|
+
import type { PortalTheme } from './util.js';
|
|
4
5
|
export declare enum Environment {
|
|
5
6
|
DEV = "DEV",
|
|
6
7
|
SANDBOX = "SANDBOX",
|
|
@@ -94,7 +95,7 @@ export interface ConstructorOpts {
|
|
|
94
95
|
* Theme to use for the portal
|
|
95
96
|
* @deprecated configure theming through the developer portal
|
|
96
97
|
*/
|
|
97
|
-
portalTheme?:
|
|
98
|
+
portalTheme?: PortalTheme;
|
|
98
99
|
useDKLSForCreation?: boolean;
|
|
99
100
|
disableWebSockets?: boolean;
|
|
100
101
|
wasmOverride?: ArrayBuffer;
|
|
@@ -3,8 +3,8 @@ import type { OAuthResponse, WithCustomTheme, WithUseShortUrls, Verify2faParams,
|
|
|
3
3
|
import { ParaCore } from '../ParaCore.js';
|
|
4
4
|
import { FullSignatureRes, Wallet } from './wallet.js';
|
|
5
5
|
import { AccountLinkInProgress } from './accountLinking.js';
|
|
6
|
-
import type { WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, WaitForWalletCreationResponse, GetOAuthUrlParams, AddCredentialParams, LoginExternalWalletParams, LoginExternalWalletResponse, ResendVerificationCodeParams, SignUpOrLogInParams, SignUpOrLogInResponse, VerifyOAuthProcessParams, VerifyExternalWalletParams, VerifyExternalWalletResponse, VerifyFarcasterParams, VerifyTelegramParams, ClaimPregenWalletsParams, ClaimPregenWalletsResponse, CreateGuestWalletsResponse, CreatePregenWalletParams, CreatePregenWalletPerTypeParams, CreatePregenWalletPerTypeResponse, CreatePregenWalletResponse, CreateWalletParams, CreateWalletPerTypeParams, CreateWalletPerTypeResponse, CreateWalletResponse, DistributeNewWalletShareParams, GetPregenWalletsParams, GetPregenWalletsResponse, GetWalletBalanceParams, HasPregenWalletParams, PollingCallbacks, RefreshShareParams, RefreshShareResponse, UpdatePregenWalletIdentifierParams, BaseVerifyExternalWalletParams, AuthenticateWithEmailOrPhoneParams, AuthenticateWithEmailOrPhoneResponse, AuthenticateWithOAuthParams, AuthenticateWithOAuthResponse } from '../services/types';
|
|
7
|
-
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", "waitAndExportSession", "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", "exportPrivateKey", "authenticateWithEmailOrPhone", "authenticateWithOAuth"];
|
|
6
|
+
import type { WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, WaitForWalletCreationResponse, GetOAuthUrlParams, AddCredentialParams, LoginExternalWalletParams, LoginExternalWalletResponse, ResendVerificationCodeParams, SignUpOrLogInParams, SignUpOrLogInResponse, VerifyOAuthProcessParams, VerifyExternalWalletParams, VerifyExternalWalletResponse, VerifyFarcasterParams, VerifyTelegramParams, ClaimPregenWalletsParams, ClaimPregenWalletsResponse, CreateGuestWalletsResponse, CreatePregenWalletParams, CreatePregenWalletPerTypeParams, CreatePregenWalletPerTypeResponse, CreatePregenWalletResponse, CreateWalletParams, CreateWalletPerTypeParams, CreateWalletPerTypeResponse, CreateWalletResponse, DistributeNewWalletShareParams, GetPregenWalletsParams, GetPregenWalletsResponse, GetWalletBalanceParams, HasPregenWalletParams, PollingCallbacks, RefreshShareParams, RefreshShareResponse, RequestFaucetParams, RequestFaucetResponse, UpdatePregenWalletIdentifierParams, BaseVerifyExternalWalletParams, AuthenticateWithEmailOrPhoneParams, AuthenticateWithEmailOrPhoneResponse, AuthenticateWithOAuthParams, AuthenticateWithOAuthResponse } from '../services/types';
|
|
7
|
+
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", "waitAndExportSession", "importSession", "getVerificationToken", "getWallets", "getWalletsByType", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWallets", "hasPregenWallet", "updatePregenWalletIdentifier", "createPregenWallet", "createPregenWalletPerType", "claimPregenWallets", "createGuestWallets", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction", "getWalletBalance", "requestFaucet", "issueJwt", "getLinkedAccounts", "accountLinkInProgress", "addCredential", "exportPrivateKey", "authenticateWithEmailOrPhone", "authenticateWithOAuth"];
|
|
8
8
|
export declare const PARA_INTERNAL_METHODS: readonly ["linkAccount", "unlinkAccount", "verifyEmailOrPhoneLink", "verifyOAuthLink", "verifyFarcasterLink", "verifyTelegramLink", "verifyExternalWalletLink", "accountLinkInProgress", "prepareLogin", "sendLoginCode", "supportedUserAuthMethods"];
|
|
9
9
|
export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
|
|
10
10
|
export type CoreMethodParams<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
|
|
@@ -363,6 +363,10 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
363
363
|
params: GetWalletBalanceParams;
|
|
364
364
|
response: string;
|
|
365
365
|
};
|
|
366
|
+
requestFaucet: {
|
|
367
|
+
params: RequestFaucetParams;
|
|
368
|
+
response: RequestFaucetResponse;
|
|
369
|
+
};
|
|
366
370
|
issueJwt: {
|
|
367
371
|
params: IssueJwtParams;
|
|
368
372
|
response: IssueJwtResponse;
|
|
@@ -423,7 +427,9 @@ export type InternalMethods = {
|
|
|
423
427
|
};
|
|
424
428
|
sendLoginCode: {
|
|
425
429
|
params: void;
|
|
426
|
-
response:
|
|
430
|
+
response: {
|
|
431
|
+
userId: string;
|
|
432
|
+
};
|
|
427
433
|
};
|
|
428
434
|
supportedUserAuthMethods: {
|
|
429
435
|
params: void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { pki as pkiType } from 'node-forge';
|
|
2
|
-
import type { PartnerEntity, BackupKitEmailProps, VerificationEmailProps, TLinkedAccountType
|
|
3
|
-
import type { Ctx, Environment, AccountLinkInProgress, ConstructorOpts } from './index.js';
|
|
2
|
+
import type { PartnerEntity, BackupKitEmailProps, VerificationEmailProps, TLinkedAccountType } from '@getpara/user-management-client';
|
|
3
|
+
import type { Ctx, Environment, AccountLinkInProgress, ConstructorOpts, PortalTheme } from './index.js';
|
|
4
4
|
import type { PlatformUtils } from '../PlatformUtils.js';
|
|
5
5
|
import type { AuthService } from '../services/AuthService.js';
|
|
6
6
|
import type { WalletService } from '../services/WalletService.js';
|
|
@@ -71,7 +71,7 @@ export interface PortalUrlServiceInterface {
|
|
|
71
71
|
isPartnerOptional: boolean | undefined;
|
|
72
72
|
ctx: Ctx;
|
|
73
73
|
get loginEncryptionKeyPair(): pkiType.rsa.KeyPair | undefined;
|
|
74
|
-
portalTheme?:
|
|
74
|
+
portalTheme?: PortalTheme;
|
|
75
75
|
portalPrimaryButtonColor?: string;
|
|
76
76
|
portalTextColor?: string;
|
|
77
77
|
portalPrimaryButtonTextColor?: string;
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { TAuthMethod, Theme } from '@getpara/user-management-client';
|
|
2
|
+
/**
|
|
3
|
+
* Extended portal theme type that adds new theming fields not yet in the
|
|
4
|
+
* backend `Theme` type from `@getpara/user-management-client`.
|
|
5
|
+
*
|
|
6
|
+
* TODO: Remove this extension once the UMC `Theme` type includes
|
|
7
|
+
* `foregroundMixRatio` and `cssOverrides`.
|
|
8
|
+
*/
|
|
9
|
+
export type PortalTheme = Theme & {
|
|
10
|
+
/** Controls how much the foreground/accent color is mixed into generated UI palette steps. */
|
|
11
|
+
foregroundMixRatio?: number;
|
|
12
|
+
/** Raw CSS variable overrides applied after theme generation. Advanced use. */
|
|
13
|
+
cssOverrides?: Record<string, string>;
|
|
14
|
+
};
|
|
2
15
|
export type WithAuthMethod = {
|
|
3
16
|
/**
|
|
4
17
|
* Which authorization method to use for the URL, either `'PASSKEY'`, `'PASSWORD'` or `'PIN'`.
|
|
@@ -9,7 +22,7 @@ export type WithCustomTheme = {
|
|
|
9
22
|
/**
|
|
10
23
|
* The theme to apply to generated URLs, if different from your configured theme.
|
|
11
24
|
*/
|
|
12
|
-
portalTheme?:
|
|
25
|
+
portalTheme?: PortalTheme;
|
|
13
26
|
};
|
|
14
27
|
export type WithUseShortUrls = {
|
|
15
28
|
/**
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/core-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.0",
|
|
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": "
|
|
8
|
+
"@getpara/user-management-client": "3.0.0-alpha.0",
|
|
9
9
|
"@noble/hashes": "^1.5.0",
|
|
10
10
|
"axios": "^1.8.4",
|
|
11
11
|
"base64url": "^3.0.1",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dist",
|
|
31
31
|
"package.json"
|
|
32
32
|
],
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "f58e6e365ca63a447edaa44fba3b157e5ca7a368",
|
|
34
34
|
"main": "dist/cjs/index.js",
|
|
35
35
|
"module": "dist/esm/index.js",
|
|
36
36
|
"scripts": {
|