@getpara/core-sdk 2.26.0 → 3.0.0-alpha.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/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
|
@@ -80,7 +80,7 @@ const _CoreStateManager = class _CoreStateManager {
|
|
|
80
80
|
* Extracts all data needed by UI consumers from authStateResult.
|
|
81
81
|
*/
|
|
82
82
|
computeAuthStateInfo(authContext, walletContext) {
|
|
83
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B;
|
|
83
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I;
|
|
84
84
|
const defaultAuthStateInfo = {
|
|
85
85
|
userId: null,
|
|
86
86
|
isPasskeySupported: false,
|
|
@@ -89,11 +89,15 @@ const _CoreStateManager = class _CoreStateManager {
|
|
|
89
89
|
hasPassword: false,
|
|
90
90
|
hasPin: false,
|
|
91
91
|
passkeyUrl: null,
|
|
92
|
+
passkeyFullUrl: null,
|
|
92
93
|
passkeyKnownDeviceUrl: null,
|
|
93
94
|
passwordUrl: null,
|
|
94
95
|
pinUrl: null,
|
|
96
|
+
passwordFullUrl: null,
|
|
97
|
+
pinFullUrl: null,
|
|
95
98
|
passkeyId: null,
|
|
96
99
|
verificationUrl: null,
|
|
100
|
+
verificationFullUrl: null,
|
|
97
101
|
externalWalletVerification: null,
|
|
98
102
|
recoverySecret: null,
|
|
99
103
|
isNewUser: false
|
|
@@ -123,10 +127,14 @@ const _CoreStateManager = class _CoreStateManager {
|
|
|
123
127
|
let hasPin = false;
|
|
124
128
|
let isPasskeySupported = false;
|
|
125
129
|
let passkeyUrl = null;
|
|
130
|
+
let passkeyFullUrl = null;
|
|
126
131
|
let passkeyKnownDeviceUrl = null;
|
|
127
132
|
let passwordUrl = null;
|
|
128
133
|
let pinUrl = null;
|
|
134
|
+
let passwordFullUrl = null;
|
|
135
|
+
let pinFullUrl = null;
|
|
129
136
|
let verificationUrl = null;
|
|
137
|
+
let verificationFullUrl = null;
|
|
130
138
|
let passkeyHints = null;
|
|
131
139
|
let passkeyId = null;
|
|
132
140
|
if (stage === "login") {
|
|
@@ -137,24 +145,31 @@ const _CoreStateManager = class _CoreStateManager {
|
|
|
137
145
|
hasPin = authMethods.includes("PIN");
|
|
138
146
|
isPasskeySupported = (_k = loginState.isPasskeySupported) != null ? _k : false;
|
|
139
147
|
passkeyUrl = (_l = loginState.passkeyUrl) != null ? _l : null;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
passkeyFullUrl = (_m = loginState.passkeyFullUrl) != null ? _m : null;
|
|
149
|
+
passkeyKnownDeviceUrl = (_n = loginState.passkeyKnownDeviceUrl) != null ? _n : null;
|
|
150
|
+
passwordUrl = (_o = loginState.passwordUrl) != null ? _o : null;
|
|
151
|
+
pinUrl = (_p = loginState.pinUrl) != null ? _p : null;
|
|
152
|
+
passwordFullUrl = (_q = loginState.passwordFullUrl) != null ? _q : null;
|
|
153
|
+
pinFullUrl = (_r = loginState.pinFullUrl) != null ? _r : null;
|
|
154
|
+
passkeyHints = (_s = loginState.biometricHints) != null ? _s : null;
|
|
144
155
|
} else if (stage === "signup") {
|
|
145
156
|
const signupState = authStateResult;
|
|
146
|
-
const authMethods = (
|
|
157
|
+
const authMethods = (_t = signupState.signupAuthMethods) != null ? _t : [];
|
|
147
158
|
hasPasskey = authMethods.includes("PASSKEY");
|
|
148
159
|
hasPassword = authMethods.includes("PASSWORD");
|
|
149
160
|
hasPin = authMethods.includes("PIN");
|
|
150
|
-
isPasskeySupported = (
|
|
151
|
-
passkeyUrl = (
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
161
|
+
isPasskeySupported = (_u = signupState.isPasskeySupported) != null ? _u : false;
|
|
162
|
+
passkeyUrl = (_v = signupState.passkeyUrl) != null ? _v : null;
|
|
163
|
+
passkeyFullUrl = (_w = signupState.passkeyFullUrl) != null ? _w : null;
|
|
164
|
+
passwordUrl = (_x = signupState.passwordUrl) != null ? _x : null;
|
|
165
|
+
pinUrl = (_y = signupState.pinUrl) != null ? _y : null;
|
|
166
|
+
passwordFullUrl = (_z = signupState.passwordFullUrl) != null ? _z : null;
|
|
167
|
+
pinFullUrl = (_A = signupState.pinFullUrl) != null ? _A : null;
|
|
168
|
+
passkeyId = (_B = signupState.passkeyId) != null ? _B : null;
|
|
155
169
|
} else if (stage === "verify") {
|
|
156
170
|
const verifyState = authStateResult;
|
|
157
|
-
verificationUrl = (
|
|
171
|
+
verificationUrl = (_C = verifyState.loginUrl) != null ? _C : null;
|
|
172
|
+
verificationFullUrl = (_D = verifyState.loginFullUrl) != null ? _D : null;
|
|
158
173
|
}
|
|
159
174
|
return {
|
|
160
175
|
userId,
|
|
@@ -164,15 +179,19 @@ const _CoreStateManager = class _CoreStateManager {
|
|
|
164
179
|
hasPassword,
|
|
165
180
|
hasPin,
|
|
166
181
|
passkeyUrl,
|
|
182
|
+
passkeyFullUrl,
|
|
167
183
|
passkeyKnownDeviceUrl,
|
|
168
184
|
passwordUrl,
|
|
169
185
|
pinUrl,
|
|
186
|
+
passwordFullUrl,
|
|
187
|
+
pinFullUrl,
|
|
170
188
|
passkeyId,
|
|
171
189
|
verificationUrl,
|
|
190
|
+
verificationFullUrl,
|
|
172
191
|
externalWalletVerification: externalWalletVerification ? {
|
|
173
|
-
signatureVerificationMessage: (
|
|
174
|
-
walletAddress: (
|
|
175
|
-
walletType: (
|
|
192
|
+
signatureVerificationMessage: (_E = externalWalletVerification.signatureVerificationMessage) != null ? _E : "",
|
|
193
|
+
walletAddress: (_G = (_F = externalWalletVerification.externalWallet) == null ? void 0 : _F.address) != null ? _G : "",
|
|
194
|
+
walletType: (_I = (_H = externalWalletVerification.externalWallet) == null ? void 0 : _H.type) != null ? _I : ""
|
|
176
195
|
} : null,
|
|
177
196
|
recoverySecret,
|
|
178
197
|
isNewUser
|
|
@@ -202,6 +221,7 @@ const _CoreStateManager = class _CoreStateManager {
|
|
|
202
221
|
newWalletsResult: (walletMachineState == null ? void 0 : walletMachineState.context.newWalletsResult) || null,
|
|
203
222
|
externalWalletSignVerification: (authMachineState == null ? void 0 : authMachineState.context.externalWalletSignVerification) || null,
|
|
204
223
|
isNewUser: (authMachineState == null ? void 0 : authMachineState.context.isNewUser) || false,
|
|
224
|
+
selectedOAuthMethod: (authMachineState == null ? void 0 : authMachineState.context.selectedOAuthMethod) || null,
|
|
205
225
|
// Wallet process
|
|
206
226
|
guestWallets: (walletMachineState == null ? void 0 : walletMachineState.context.guestWallets) || null
|
|
207
227
|
};
|
|
@@ -229,11 +249,11 @@ const _CoreStateManager = class _CoreStateManager {
|
|
|
229
249
|
}
|
|
230
250
|
statesEqual(state1, state2) {
|
|
231
251
|
var _a, _b;
|
|
232
|
-
return state1.phase === state2.phase && state1.authStatePhase === state2.authStatePhase && state1.walletStatePhase === state2.walletStatePhase && state1.isLoading === state2.isLoading && state1.isReady === state2.isReady && state1.isNewUser === state2.isNewUser && state1.needsWallet === state2.needsWallet && ((_a = state1.error) == null ? void 0 : _a.message) === ((_b = state2.error) == null ? void 0 : _b.message) && state1.authStateResult === state2.authStateResult && state1.newWalletsResult === state2.newWalletsResult && state1.guestWallets === state2.guestWallets && state1.externalWalletSignVerification === state2.externalWalletSignVerification && this.authStateInfoEqual(state1.authStateInfo, state2.authStateInfo);
|
|
252
|
+
return state1.phase === state2.phase && state1.authStatePhase === state2.authStatePhase && state1.walletStatePhase === state2.walletStatePhase && state1.isLoading === state2.isLoading && state1.isReady === state2.isReady && state1.isNewUser === state2.isNewUser && state1.needsWallet === state2.needsWallet && ((_a = state1.error) == null ? void 0 : _a.message) === ((_b = state2.error) == null ? void 0 : _b.message) && state1.authStateResult === state2.authStateResult && state1.newWalletsResult === state2.newWalletsResult && state1.guestWallets === state2.guestWallets && state1.externalWalletSignVerification === state2.externalWalletSignVerification && state1.selectedOAuthMethod === state2.selectedOAuthMethod && this.authStateInfoEqual(state1.authStateInfo, state2.authStateInfo);
|
|
233
253
|
}
|
|
234
254
|
authStateInfoEqual(a, b) {
|
|
235
255
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
236
|
-
return a.userId === b.userId && a.isPasskeySupported === b.isPasskeySupported && a.hasPasskey === b.hasPasskey && a.hasPassword === b.hasPassword && a.hasPin === b.hasPin && a.passkeyUrl === b.passkeyUrl && a.passkeyKnownDeviceUrl === b.passkeyKnownDeviceUrl && a.passwordUrl === b.passwordUrl && a.pinUrl === b.pinUrl && a.passkeyId === b.passkeyId && a.verificationUrl === b.verificationUrl && a.recoverySecret === b.recoverySecret && a.isNewUser === b.isNewUser && ((_a = a.externalWalletVerification) == null ? void 0 : _a.signatureVerificationMessage) === ((_b = b.externalWalletVerification) == null ? void 0 : _b.signatureVerificationMessage) && ((_c = a.externalWalletVerification) == null ? void 0 : _c.walletAddress) === ((_d = b.externalWalletVerification) == null ? void 0 : _d.walletAddress) && ((_e = a.externalWalletVerification) == null ? void 0 : _e.walletType) === ((_f = b.externalWalletVerification) == null ? void 0 : _f.walletType) && ((_g = a.passkeyHints) == null ? void 0 : _g.length) === ((_h = b.passkeyHints) == null ? void 0 : _h.length) && ((_i = a.passkeyHints) != null ? _i : []).every(
|
|
256
|
+
return a.userId === b.userId && a.isPasskeySupported === b.isPasskeySupported && a.hasPasskey === b.hasPasskey && a.hasPassword === b.hasPassword && a.hasPin === b.hasPin && a.passkeyUrl === b.passkeyUrl && a.passkeyFullUrl === b.passkeyFullUrl && a.passkeyKnownDeviceUrl === b.passkeyKnownDeviceUrl && a.passwordUrl === b.passwordUrl && a.passwordFullUrl === b.passwordFullUrl && a.pinUrl === b.pinUrl && a.pinFullUrl === b.pinFullUrl && a.passkeyId === b.passkeyId && a.verificationUrl === b.verificationUrl && a.verificationFullUrl === b.verificationFullUrl && a.recoverySecret === b.recoverySecret && a.isNewUser === b.isNewUser && ((_a = a.externalWalletVerification) == null ? void 0 : _a.signatureVerificationMessage) === ((_b = b.externalWalletVerification) == null ? void 0 : _b.signatureVerificationMessage) && ((_c = a.externalWalletVerification) == null ? void 0 : _c.walletAddress) === ((_d = b.externalWalletVerification) == null ? void 0 : _d.walletAddress) && ((_e = a.externalWalletVerification) == null ? void 0 : _e.walletType) === ((_f = b.externalWalletVerification) == null ? void 0 : _f.walletType) && ((_g = a.passkeyHints) == null ? void 0 : _g.length) === ((_h = b.passkeyHints) == null ? void 0 : _h.length) && ((_i = a.passkeyHints) != null ? _i : []).every(
|
|
237
257
|
(hint, i) => hint.useragent === b.passkeyHints[i].useragent && hint.aaguid === b.passkeyHints[i].aaguid
|
|
238
258
|
);
|
|
239
259
|
}
|
|
@@ -114,6 +114,7 @@ function createAuthStateMachine(paraCoreInterface) {
|
|
|
114
114
|
shouldAutoCreateWallets: false,
|
|
115
115
|
skipSessionRefreshOnSetup: false,
|
|
116
116
|
isLegacy: false,
|
|
117
|
+
selectedOAuthMethod: null,
|
|
117
118
|
retryAttempts: {},
|
|
118
119
|
externalWalletInfo: void 0,
|
|
119
120
|
externalWalletSignVerification: void 0
|
|
@@ -175,6 +176,7 @@ function createAuthStateMachine(paraCoreInterface) {
|
|
|
175
176
|
shouldAutoCreateWallets: false,
|
|
176
177
|
skipSessionRefreshOnSetup: false,
|
|
177
178
|
isLegacy: false,
|
|
179
|
+
selectedOAuthMethod: null,
|
|
178
180
|
retryAttempts: {}
|
|
179
181
|
}),
|
|
180
182
|
on: {
|
|
@@ -215,6 +217,7 @@ function createAuthStateMachine(paraCoreInterface) {
|
|
|
215
217
|
}
|
|
216
218
|
},
|
|
217
219
|
unauthenticated: {
|
|
220
|
+
entry: [assign({ selectedOAuthMethod: null })],
|
|
218
221
|
on: __spreadProps(__spreadValues({}, AUTH_RESTART_TRANSITIONS), {
|
|
219
222
|
INITIALIZE_GUEST_MODE: "guest_mode",
|
|
220
223
|
SESSION_IMPORTED: "authenticated"
|
|
@@ -338,6 +341,12 @@ function createAuthStateMachine(paraCoreInterface) {
|
|
|
338
341
|
};
|
|
339
342
|
}
|
|
340
343
|
return null;
|
|
344
|
+
},
|
|
345
|
+
selectedOAuthMethod: ({ event }) => {
|
|
346
|
+
if (event.type === "AUTHENTICATE_OAUTH") {
|
|
347
|
+
return event.data.method;
|
|
348
|
+
}
|
|
349
|
+
return null;
|
|
341
350
|
}
|
|
342
351
|
}),
|
|
343
352
|
"setIsLegacy"
|
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, PartnerEntity, TWalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType, AccountMetadata, LinkedAccounts, VerifyLinkParams, VerifyExternalWalletParams as VerifyExternalWalletParamsServer, SupportedAccountLinks, OnRampPurchase, BalancesConfig,
|
|
1
|
+
import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, PartnerEntity, TWalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType, AccountMetadata, LinkedAccounts, VerifyLinkParams, VerifyExternalWalletParams as VerifyExternalWalletParamsServer, SupportedAccountLinks, OnRampPurchase, BalancesConfig, IssueJwtParams, TWalletScheme } from '@getpara/user-management-client';
|
|
2
2
|
import type { pki as pkiType } from 'node-forge';
|
|
3
|
-
import { Ctx, Environment, Wallet, ConstructorOpts, CoreAuthInfo, CoreMethodParams, CoreMethodResponse, CoreInterface, AccountLinkInProgress, InternalMethodParams, InternalMethodResponse, OAuthResponse, AvailableWallet } from './types/index.js';
|
|
3
|
+
import { Ctx, Environment, Wallet, ConstructorOpts, CoreAuthInfo, CoreMethodParams, CoreMethodResponse, CoreInterface, AccountLinkInProgress, InternalMethodParams, InternalMethodResponse, OAuthResponse, AvailableWallet, PortalTheme } from './types/index.js';
|
|
4
4
|
import { PlatformUtils } from './PlatformUtils.js';
|
|
5
5
|
import { AuthServiceInterface, ExternalWalletServiceInterface, PollingServiceInterface, PortalUrlServiceInterface, PregenWalletServiceInterface, SessionManagementServiceInterface, StateMachineInterface, WalletServiceInterface } from './types/serviceInterfaces.js';
|
|
6
6
|
import type { WaitForLoginParams, WaitForLoginResponse, WaitForSignupParams, WaitForWalletCreationParams, VerifyFarcasterParams, VerifyFarcasterResponse, VerifyNewAccountParams, VerifyTelegramParams, AddCredentialParams, GetNewCredentialAndUrlParams, GetNewCredentialAndUrlResponse, LoginExternalWalletParams, ResendVerificationCodeParams, SignUpOrLogInParams, VerifyOAuthProcessParams, VerifyOAuthProcessResponse, GetLoginUrlParams, GetOAuthUrlParams, PortalUrlOptions, PortalUrlType, ClaimPregenWalletsParams, CreatePregenWalletParams, CreatePregenWalletPerTypeParams, GetPregenWalletsParams, HasPregenWalletParams, UpdatePregenWalletIdentifierParams, CreateWalletParams, CreateWalletPerTypeParams, DistributeNewWalletShareParams, FindWalletByAddressParams, FindWalletIdParams, FindWalletParams, GetDisplayAddressParams, GetIdenticonHashParams, GetWalletBalanceParams, GetWalletsByTypeParams, RequestFaucetParams, RequestFaucetResponse, RefreshShareParams, SetCurrentWalletIdsParams, SetWalletsParams, RefreshSessionParams, VerifyExternalWalletParams, InitExternalWalletProviderParams, ConnectExternalWalletParams, ExternalSignMessageParams, AuthenticateWithEmailOrPhoneParams, AuthenticateWithOAuthParams } from './services/types';
|
|
@@ -198,7 +198,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
198
198
|
* Theme to use for the portal
|
|
199
199
|
* WARNING: This theme will override portal options set within the developer portal.
|
|
200
200
|
*/
|
|
201
|
-
portalTheme?:
|
|
201
|
+
portalTheme?: PortalTheme;
|
|
202
202
|
/**
|
|
203
203
|
* Whether or not to treat external wallets as connections only, skipping all Para functionality.
|
|
204
204
|
*/
|
|
@@ -258,7 +258,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
258
258
|
getAddress(walletId?: string): string | undefined;
|
|
259
259
|
protected abstract getPlatformUtils(): PlatformUtils;
|
|
260
260
|
abstract isPasskeySupported(): Promise<boolean>;
|
|
261
|
-
protected constructPortalUrl(type: PortalUrlType, opts?: PortalUrlOptions): Promise<
|
|
261
|
+
protected constructPortalUrl(type: PortalUrlType, opts?: PortalUrlOptions): Promise<import("./services/types").ConstructPortalUrlResult>;
|
|
262
262
|
static resolveEnvironment(env: Environment | undefined, apiKey: string | undefined): Environment;
|
|
263
263
|
/**
|
|
264
264
|
* Constructs a new `ParaCore` instance.
|
|
@@ -846,7 +846,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
846
846
|
* @param {Object} opts the options object
|
|
847
847
|
* @param {String} opts.auth - the user auth to sign up or log in with, in the form ` { email: string } | { phone: `+${number}` } `
|
|
848
848
|
* @param {boolean} opts.useShortUrls - whether to shorten the generated portal URLs
|
|
849
|
-
* @param {
|
|
849
|
+
* @param {PortalTheme} opts.portalTheme the Para Portal theme to apply to the password creation URL, if other than the default theme
|
|
850
850
|
* @returns {SignUpOrLogInResponse} an object in the form of either: `{ stage: 'verify' }` or `{ stage: 'login'; passkeyUrl?: string; passwordUrl?: string; biometricHints?: BiometricLocationHint[] }`
|
|
851
851
|
*/
|
|
852
852
|
protected getLoginUrl(params: GetLoginUrlParams): Promise<string>;
|
|
@@ -866,6 +866,8 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
866
866
|
config?: BalancesConfig;
|
|
867
867
|
refetch?: boolean;
|
|
868
868
|
}): Promise<import("@getpara/user-management-client").ProfileBalance>;
|
|
869
|
-
protected sendLoginCode(): Promise<
|
|
869
|
+
protected sendLoginCode(): Promise<{
|
|
870
|
+
userId: string;
|
|
871
|
+
}>;
|
|
870
872
|
exportPrivateKey(args?: CoreMethodParams<'exportPrivateKey'>): CoreMethodResponse<'exportPrivateKey'>;
|
|
871
873
|
}
|
|
@@ -18,8 +18,10 @@ export interface OAuthRedirectCallbacks {
|
|
|
18
18
|
/**
|
|
19
19
|
* Called when an OAuth URL is generated for redirect.
|
|
20
20
|
* If this is provided onOAuthPopup will not be called.
|
|
21
|
+
* @param url - The (possibly shortened) URL
|
|
22
|
+
* @param fullUrl - The full unshortened URL, for preloaded iframe navigation
|
|
21
23
|
*/
|
|
22
|
-
onOAuthUrl?: (url: string) => void;
|
|
24
|
+
onOAuthUrl?: (url: string, fullUrl?: string) => void;
|
|
23
25
|
}
|
|
24
26
|
export type SetAuthMethod = (_: PrimaryAuth, __?: {
|
|
25
27
|
extras?: AuthExtras;
|
|
@@ -133,6 +135,7 @@ export interface GetNewCredentialAndUrlParams extends WithCustomTheme, WithShort
|
|
|
133
135
|
export interface GetNewCredentialAndUrlResponse {
|
|
134
136
|
credentialId: string;
|
|
135
137
|
url?: string;
|
|
138
|
+
fullUrl?: string;
|
|
136
139
|
}
|
|
137
140
|
export type GetNewCredentialAndUrlMethod = (_?: GetNewCredentialAndUrlParams) => Promise<GetNewCredentialAndUrlResponse>;
|
|
138
141
|
export interface AddCredentialParams {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TAuthMethod,
|
|
2
|
-
import type { AccountLinkInProgress, WithAuthMethod, WithCustomTheme, WithSessionId, WithShorten } from '../../types/index.js';
|
|
1
|
+
import type { TAuthMethod, TOAuthMethod } from '@getpara/user-management-client';
|
|
2
|
+
import type { AccountLinkInProgress, PortalTheme, WithAuthMethod, WithCustomTheme, WithSessionId, WithShorten } from '../../types/index.js';
|
|
3
3
|
type Device = {
|
|
4
4
|
sessionId: string;
|
|
5
5
|
encryptionKey: string;
|
|
@@ -11,7 +11,7 @@ export type PortalUrlOptions = {
|
|
|
11
11
|
thisDevice?: Device;
|
|
12
12
|
newDevice?: Device;
|
|
13
13
|
sessionId?: string;
|
|
14
|
-
portalTheme?:
|
|
14
|
+
portalTheme?: PortalTheme;
|
|
15
15
|
pathId?: string;
|
|
16
16
|
shorten?: boolean;
|
|
17
17
|
isEmbedded?: boolean;
|
|
@@ -23,9 +23,13 @@ export type PortalUrlOptions = {
|
|
|
23
23
|
addNewCredentialPasskeyId?: string;
|
|
24
24
|
useLegacyUrl?: boolean;
|
|
25
25
|
};
|
|
26
|
-
export type
|
|
26
|
+
export type ConstructPortalUrlResult = {
|
|
27
|
+
url: string;
|
|
28
|
+
fullUrl: string;
|
|
29
|
+
};
|
|
30
|
+
export type ConstructPortalUrlMethod = (type: PortalUrlType, opts?: PortalUrlOptions) => Promise<ConstructPortalUrlResult>;
|
|
27
31
|
export type GetLoginUrlParams = WithAuthMethod & WithCustomTheme & WithShorten & WithSessionId;
|
|
28
|
-
export type GetLoginUrlMethod = (_: GetLoginUrlParams) => Promise<
|
|
32
|
+
export type GetLoginUrlMethod = (_: GetLoginUrlParams) => Promise<ConstructPortalUrlResult>;
|
|
29
33
|
export type BaseOAuthUrlParams = {
|
|
30
34
|
/**
|
|
31
35
|
* The third-party OAuth service.
|
|
@@ -623,6 +623,7 @@ export declare function createAuthStateMachine(paraCoreInterface: StateMachineIn
|
|
|
623
623
|
shouldAutoCreateWallets: false;
|
|
624
624
|
skipSessionRefreshOnSetup: false;
|
|
625
625
|
isLegacy: false;
|
|
626
|
+
selectedOAuthMethod: any;
|
|
626
627
|
retryAttempts: {};
|
|
627
628
|
};
|
|
628
629
|
readonly on: {
|
|
@@ -666,6 +667,110 @@ export declare function createAuthStateMachine(paraCoreInterface: StateMachineIn
|
|
|
666
667
|
};
|
|
667
668
|
};
|
|
668
669
|
readonly unauthenticated: {
|
|
670
|
+
readonly entry: readonly [import("xstate").ActionFunction<AuthContext, AuthEvents, AuthEvents, undefined, import("xstate").Values<{
|
|
671
|
+
connectExternalWallet: {
|
|
672
|
+
src: "connectExternalWallet";
|
|
673
|
+
logic: import("xstate").PromiseActorLogic<import("../../index.js").PerformConnectExternalWalletResponse, import("../../index.js").ConnectExternalWalletParams, import("xstate").EventObject>;
|
|
674
|
+
id: string;
|
|
675
|
+
};
|
|
676
|
+
verifyNewAccount: {
|
|
677
|
+
src: "verifyNewAccount";
|
|
678
|
+
logic: import("xstate").PromiseActorLogic<{
|
|
679
|
+
authState: ServerAuthState;
|
|
680
|
+
opts: import("../../types/util.js").WithCustomTheme & import("../../types/util.js").WithUseShortUrls;
|
|
681
|
+
}, import("../../services/types/VerificationFlowServiceTypes.js").PerformVerifyNewAccountParams, import("xstate").EventObject>;
|
|
682
|
+
id: string;
|
|
683
|
+
};
|
|
684
|
+
verifyExternalWallet: {
|
|
685
|
+
src: "verifyExternalWallet";
|
|
686
|
+
logic: import("xstate").PromiseActorLogic<{
|
|
687
|
+
authState: ServerAuthState;
|
|
688
|
+
opts: import("../../types/util.js").WithCustomTheme & import("../../types/util.js").WithUseShortUrls;
|
|
689
|
+
}, import("../../services/types/VerificationFlowServiceTypes.js").VerifyExternalWalletParams, import("xstate").EventObject>;
|
|
690
|
+
id: string;
|
|
691
|
+
};
|
|
692
|
+
authenticateWithEmailOrPhone: {
|
|
693
|
+
src: "authenticateWithEmailOrPhone";
|
|
694
|
+
logic: import("xstate").PromiseActorLogic<{
|
|
695
|
+
authState: ServerAuthState;
|
|
696
|
+
opts: import("../../types/util.js").WithCustomTheme & import("../../types/util.js").WithUseShortUrls;
|
|
697
|
+
}, import("../../index.js").SignUpOrLogInParams, import("xstate").EventObject>;
|
|
698
|
+
id: string;
|
|
699
|
+
};
|
|
700
|
+
polling: {
|
|
701
|
+
src: "polling";
|
|
702
|
+
logic: import("xstate").CallbackActorLogic<any, import("../../index.js").PollingConfig<any>, import("xstate").EventObject>;
|
|
703
|
+
id: string;
|
|
704
|
+
};
|
|
705
|
+
checkUserState: {
|
|
706
|
+
src: "checkUserState";
|
|
707
|
+
logic: import("xstate").PromiseActorLogic<{
|
|
708
|
+
isAuthenticated: boolean;
|
|
709
|
+
isFullyLoggedIn: boolean;
|
|
710
|
+
isGuestMode: boolean;
|
|
711
|
+
}, {}, import("xstate").EventObject>;
|
|
712
|
+
id: string;
|
|
713
|
+
};
|
|
714
|
+
authenticateWithExternalWallet: {
|
|
715
|
+
src: "authenticateWithExternalWallet";
|
|
716
|
+
logic: import("xstate").PromiseActorLogic<{
|
|
717
|
+
authState: ServerAuthState;
|
|
718
|
+
opts: import("../../types/util.js").WithCustomTheme & import("../../types/util.js").WithUseShortUrls;
|
|
719
|
+
}, import("../../index.js").LoginExternalWalletParams, import("xstate").EventObject>;
|
|
720
|
+
id: string;
|
|
721
|
+
};
|
|
722
|
+
authenticateWithTelegram: {
|
|
723
|
+
src: "authenticateWithTelegram";
|
|
724
|
+
logic: import("xstate").PromiseActorLogic<AuthenticationOutput, import("../../index.js").WaitForTelegramEventParams, import("xstate").EventObject>;
|
|
725
|
+
id: string;
|
|
726
|
+
};
|
|
727
|
+
authenticateWithTelegramLegacy: {
|
|
728
|
+
src: "authenticateWithTelegramLegacy";
|
|
729
|
+
logic: import("xstate").PromiseActorLogic<{
|
|
730
|
+
authState: ServerAuthState;
|
|
731
|
+
opts: import("../../types/util.js").WithCustomTheme & import("../../types/util.js").WithUseShortUrls;
|
|
732
|
+
}, import("../../services/types/VerificationFlowServiceTypes.js").VerifyTelegramParams, import("xstate").EventObject>;
|
|
733
|
+
id: string;
|
|
734
|
+
};
|
|
735
|
+
authenticateWithFarcaster: {
|
|
736
|
+
src: "authenticateWithFarcaster";
|
|
737
|
+
logic: import("xstate").PromiseActorLogic<AuthenticationOutput, import("../../index.js").WaitForFarcasterEventParams, import("xstate").EventObject>;
|
|
738
|
+
id: string;
|
|
739
|
+
};
|
|
740
|
+
authenticateWithFarcasterLegacy: {
|
|
741
|
+
src: "authenticateWithFarcasterLegacy";
|
|
742
|
+
logic: import("xstate").PromiseActorLogic<import("../../services/types/VerificationFlowServiceTypes.js").PerformVerifyFarcasterResponse, import("../../services/types/VerificationFlowServiceTypes.js").VerifyFarcasterParams, import("xstate").EventObject>;
|
|
743
|
+
id: string;
|
|
744
|
+
};
|
|
745
|
+
processAuthentication: {
|
|
746
|
+
src: "processAuthentication";
|
|
747
|
+
logic: import("xstate").PromiseActorLogic<AuthState, {
|
|
748
|
+
authState: ServerAuthState;
|
|
749
|
+
opts: import("../../types/util.js").WithCustomTheme & import("../../types/util.js").WithUseShortUrls & {
|
|
750
|
+
sessionLookupId?: string;
|
|
751
|
+
isFromExternalWallet?: boolean;
|
|
752
|
+
};
|
|
753
|
+
}, import("xstate").EventObject>;
|
|
754
|
+
id: string;
|
|
755
|
+
};
|
|
756
|
+
signExternalWalletVerification: {
|
|
757
|
+
src: "signExternalWalletVerification";
|
|
758
|
+
logic: import("xstate").PromiseActorLogic<BaseVerifyExternalWalletParams, import("../../index.js").ExternalSignMessageParams & {
|
|
759
|
+
externalWallet: import("@getpara/user-management-client").ExternalWalletInfo;
|
|
760
|
+
}, import("xstate").EventObject>;
|
|
761
|
+
id: string;
|
|
762
|
+
};
|
|
763
|
+
switchExternalWallet: {
|
|
764
|
+
src: "switchExternalWallet";
|
|
765
|
+
logic: import("xstate").PromiseActorLogic<import("../../index.js").PerformSwitchExternalWalletResponse, import("../../index.js").WatchWalletChangeCallbackParams, import("xstate").EventObject>;
|
|
766
|
+
id: string;
|
|
767
|
+
};
|
|
768
|
+
logoutActor: {
|
|
769
|
+
src: "logoutActor";
|
|
770
|
+
logic: import("xstate").PromiseActorLogic<void, {}, import("xstate").EventObject>;
|
|
771
|
+
id: string;
|
|
772
|
+
};
|
|
773
|
+
}>, never, never, never, never>];
|
|
669
774
|
readonly on: {
|
|
670
775
|
readonly INITIALIZE_GUEST_MODE: "guest_mode";
|
|
671
776
|
readonly SESSION_IMPORTED: "authenticated";
|
|
@@ -737,7 +842,7 @@ export declare function createAuthStateMachine(paraCoreInterface: StateMachineIn
|
|
|
737
842
|
data: {
|
|
738
843
|
authState: ServerAuthState;
|
|
739
844
|
sessionLookupId: string;
|
|
740
|
-
portalTheme: import("
|
|
845
|
+
portalTheme: import("../../types/util.js").PortalTheme;
|
|
741
846
|
useShortUrls: boolean;
|
|
742
847
|
};
|
|
743
848
|
finished: boolean;
|