@getpara/core-sdk 2.25.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 +16 -9
- package/dist/cjs/constants.js +1 -1
- package/dist/cjs/services/AuthService.js +2 -2
- 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/state/CoreStateManager.js +37 -17
- package/dist/cjs/state/machines/authStateMachine.js +9 -0
- package/dist/esm/ParaCore.js +16 -9
- package/dist/esm/constants.js +1 -1
- package/dist/esm/services/AuthService.js +2 -2
- 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/state/CoreStateManager.js +37 -17
- package/dist/esm/state/machines/authStateMachine.js +9 -0
- package/dist/types/ParaCore.d.ts +8 -6
- package/dist/types/services/types/AuthServiceTypes.d.ts +4 -1
- package/dist/types/services/types/PortalUrlServiceTypes.d.ts +9 -5
- package/dist/types/state/machines/authStateMachine.d.ts +106 -1
- package/dist/types/state/machines/coreStateMachine.d.ts +646 -16
- package/dist/types/state/types/auth.d.ts +2 -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 +3 -1
- 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';
|
|
@@ -98,6 +98,7 @@ export interface AuthContext {
|
|
|
98
98
|
externalWalletInfo?: PerformConnectExternalWalletResponse;
|
|
99
99
|
externalWalletSignVerification?: BaseVerifyExternalWalletParams;
|
|
100
100
|
isLegacy: boolean;
|
|
101
|
+
selectedOAuthMethod: TOAuthMethod | null;
|
|
101
102
|
retryAttempts?: {
|
|
102
103
|
externalWalletVerification?: number;
|
|
103
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;
|
|
@@ -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": {
|