@getpara/core-sdk 2.0.0-fc.2 → 2.0.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 +1111 -316
- package/dist/cjs/constants.js +10 -1
- package/dist/cjs/index.js +23 -3
- package/dist/cjs/shares/KeyContainer.js +3 -3
- package/dist/cjs/shares/enclave.js +287 -0
- package/dist/cjs/shares/shareDistribution.js +16 -1
- package/dist/cjs/transmission/transmissionUtils.js +4 -3
- package/dist/cjs/types/{theme.js → assets.js} +2 -2
- package/dist/cjs/types/coreApi.js +7 -2
- package/dist/cjs/types/events.js +2 -0
- package/dist/cjs/types/index.js +0 -21
- package/dist/cjs/types/popup.js +1 -0
- package/dist/cjs/utils/config.js +108 -0
- package/dist/cjs/utils/index.js +5 -1
- package/dist/cjs/utils/onRamps.js +2 -3
- package/dist/cjs/utils/wallet.js +18 -0
- package/dist/cjs/{types/onRamps.js → utils/window.js} +17 -12
- package/dist/esm/ParaCore.js +1115 -320
- package/dist/esm/constants.js +7 -1
- package/dist/esm/index.js +24 -5
- package/dist/esm/shares/KeyContainer.js +3 -3
- package/dist/esm/shares/enclave.js +247 -0
- package/dist/esm/shares/shareDistribution.js +16 -1
- package/dist/esm/transmission/transmissionUtils.js +4 -3
- package/dist/esm/types/coreApi.js +7 -2
- package/dist/esm/types/events.js +2 -0
- package/dist/esm/types/index.js +0 -16
- package/dist/esm/types/popup.js +1 -0
- package/dist/esm/utils/config.js +86 -0
- package/dist/esm/utils/index.js +2 -0
- package/dist/esm/utils/onRamps.js +2 -3
- package/dist/esm/utils/wallet.js +17 -0
- package/dist/esm/utils/window.js +16 -0
- package/dist/types/ParaCore.d.ts +90 -19
- package/dist/types/PlatformUtils.d.ts +2 -1
- package/dist/types/constants.d.ts +3 -0
- package/dist/types/index.d.ts +6 -4
- package/dist/types/shares/enclave.d.ts +83 -0
- package/dist/types/shares/shareDistribution.d.ts +4 -2
- package/dist/types/types/assets.d.ts +14 -0
- package/dist/types/types/config.d.ts +3 -2
- package/dist/types/types/coreApi.d.ts +47 -7
- package/dist/types/types/events.d.ts +7 -2
- package/dist/types/types/index.d.ts +0 -4
- package/dist/types/types/methods.d.ts +56 -12
- package/dist/types/types/popup.d.ts +2 -1
- package/dist/types/types/wallet.d.ts +8 -4
- package/dist/types/utils/config.d.ts +7 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/onRamps.d.ts +9 -10
- 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/cjs/types/recovery.js +0 -34
- package/dist/esm/types/onRamps.js +0 -11
- package/dist/esm/types/recovery.js +0 -12
- package/dist/types/types/onRamps.d.ts +0 -10
- package/dist/types/types/recovery.d.ts +0 -7
- package/dist/types/types/theme.d.ts +0 -12
- /package/dist/esm/types/{theme.js → assets.js} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "../chunk-7B52C2XE.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.parent === window && !window.opener;
|
|
12
|
+
return isInIframe || isInPopup || isDirectAccess;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
isPortal
|
|
16
|
+
};
|
package/dist/types/ParaCore.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, TWalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType, AccountMetadata, LinkedAccounts, VerifyLinkParams, VerifyExternalWalletParams, SupportedAccountLinks } from '@getpara/user-management-client';
|
|
1
|
+
import { AuthMethod, AuthExtras, CurrentWalletIds, EmailTheme, PartnerEntity, TWalletType, PregenIds, BiometricLocationHint, Auth, SupportedWalletTypes, AuthIdentifier, AuthType, ExternalWalletInfo, ServerAuthStateLogin, ServerAuthStateSignup, PrimaryAuthInfo, SessionInfo, PrimaryAuth, PrimaryAuthType, AccountMetadata, LinkedAccounts, VerifyLinkParams, VerifyExternalWalletParams, SupportedAccountLinks, OnRampPurchase, BalancesConfig, Theme, ServerAuthStateDone } from '@getpara/user-management-client';
|
|
2
2
|
import type { pki as pkiType } from 'node-forge';
|
|
3
|
-
import { Ctx, Environment,
|
|
3
|
+
import { Ctx, Environment, WalletFilters, Wallet, PortalUrlOptions, ConstructorOpts, CoreAuthInfo, PortalUrlType, CoreMethodParams, CoreMethodResponse, NewCredentialUrlParams, LoginUrlParams, CoreInterface, ExternalWalletConnectionType, AccountLinkInProgress, InternalMethodParams, InternalMethodResponse, AvailableWallet } from './types/index.js';
|
|
4
4
|
import { PlatformUtils } from './PlatformUtils.js';
|
|
5
5
|
export declare abstract class ParaCore implements CoreInterface {
|
|
6
6
|
#private;
|
|
7
|
+
popupWindow: Window | null;
|
|
7
8
|
static version?: string;
|
|
8
9
|
ctx: Ctx;
|
|
10
|
+
protected isSwitchingWallets: boolean;
|
|
9
11
|
protected isNativePasskey: boolean;
|
|
10
12
|
protected isPartnerOptional?: boolean;
|
|
13
|
+
protected setModalError(_error?: string): void;
|
|
11
14
|
isReady: boolean;
|
|
12
15
|
get authInfo(): CoreAuthInfo | undefined;
|
|
13
16
|
get email(): AuthIdentifier<'email'> | undefined;
|
|
@@ -16,13 +19,18 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
16
19
|
get telegramUserId(): AuthIdentifier<'telegram'> | undefined;
|
|
17
20
|
get externalWalletWithParaAuth(): Wallet | undefined;
|
|
18
21
|
get externalWalletConnectionType(): ExternalWalletConnectionType;
|
|
22
|
+
protected partner?: PartnerEntity;
|
|
19
23
|
userId?: string;
|
|
20
24
|
accountLinkInProgress: AccountLinkInProgress | undefined;
|
|
21
25
|
private sessionCookie?;
|
|
26
|
+
isEnclaveUser: boolean;
|
|
27
|
+
private enclaveJwt?;
|
|
28
|
+
private enclaveRefreshJwt?;
|
|
22
29
|
private isAwaitingAccountCreation;
|
|
23
30
|
private isAwaitingLogin;
|
|
24
31
|
private isAwaitingFarcaster;
|
|
25
32
|
private isAwaitingOAuth;
|
|
33
|
+
private isWorkerInitialized;
|
|
26
34
|
get isEmail(): boolean;
|
|
27
35
|
get isPhone(): boolean;
|
|
28
36
|
get isFarcaster(): boolean;
|
|
@@ -30,6 +38,8 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
30
38
|
get isExternalWalletAuth(): boolean;
|
|
31
39
|
get isExternalWalletWithVerification(): boolean;
|
|
32
40
|
get partnerId(): string | undefined;
|
|
41
|
+
protected get partnerName(): string | undefined;
|
|
42
|
+
protected get partnerLogo(): string | undefined;
|
|
33
43
|
/**
|
|
34
44
|
* The IDs of the currently active wallets, for each supported wallet type. Any signer integrations will default to the first viable wallet ID in this dictionary.
|
|
35
45
|
*/
|
|
@@ -115,7 +125,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
115
125
|
portalPrimaryButtonTextColor?: string;
|
|
116
126
|
/**
|
|
117
127
|
* Theme to use for the portal
|
|
118
|
-
*
|
|
128
|
+
* WARNING: This theme will override portal options set within the developer portal.
|
|
119
129
|
*/
|
|
120
130
|
portalTheme?: Theme;
|
|
121
131
|
/**
|
|
@@ -129,7 +139,12 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
129
139
|
get cosmosPrefix(): string | undefined;
|
|
130
140
|
get supportedAccountLinks(): SupportedAccountLinks;
|
|
131
141
|
get isWalletTypeEnabled(): Partial<Record<TWalletType, boolean>>;
|
|
132
|
-
|
|
142
|
+
protected onRampPopup: {
|
|
143
|
+
window: Window;
|
|
144
|
+
onRampPurchase: OnRampPurchase;
|
|
145
|
+
} | undefined;
|
|
146
|
+
protected platformUtils: PlatformUtils;
|
|
147
|
+
protected nonPersistedStorageKeys: string[];
|
|
133
148
|
private localStorageGetItem;
|
|
134
149
|
private localStorageSetItem;
|
|
135
150
|
private localStorageRemoveItem;
|
|
@@ -138,6 +153,10 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
138
153
|
private sessionStorageRemoveItem;
|
|
139
154
|
retrieveSessionCookie: () => string | undefined;
|
|
140
155
|
persistSessionCookie: (cookie: string) => void;
|
|
156
|
+
retrieveEnclaveJwt: () => string;
|
|
157
|
+
persistEnclaveJwt: (jwt: string) => void;
|
|
158
|
+
retrieveEnclaveRefreshJwt: () => string;
|
|
159
|
+
persistEnclaveRefreshJwt: (jwt: string) => void;
|
|
141
160
|
/**
|
|
142
161
|
* Remove all local storage and prefixed session storage.
|
|
143
162
|
* @param {'local' | 'session' | 'secure' | 'all'} type - Type of storage to clear. Defaults to 'all'.
|
|
@@ -145,7 +164,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
145
164
|
clearStorage: (type?: CoreMethodParams<"clearStorage">) => CoreMethodResponse<"clearStorage">;
|
|
146
165
|
private convertBigInt;
|
|
147
166
|
private convertEncryptionKeyPair;
|
|
148
|
-
|
|
167
|
+
protected isPortal(envOverride?: Environment): boolean;
|
|
149
168
|
private isParaConnect;
|
|
150
169
|
private requireApiKey;
|
|
151
170
|
private isWalletSupported;
|
|
@@ -153,6 +172,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
153
172
|
private isPregenWalletUnclaimed;
|
|
154
173
|
private isPregenWalletClaimable;
|
|
155
174
|
private isWalletUsable;
|
|
175
|
+
private truncateAddress;
|
|
156
176
|
/**
|
|
157
177
|
* Returns the formatted address for the desired wallet ID, depending on your app settings.
|
|
158
178
|
* @param {string} walletId the ID of the wallet address to display.
|
|
@@ -179,24 +199,28 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
179
199
|
protected abstract getPlatformUtils(): PlatformUtils;
|
|
180
200
|
abstract isPasskeySupported(): Promise<boolean>;
|
|
181
201
|
protected constructPortalUrl(type: PortalUrlType, opts?: PortalUrlOptions): Promise<string>;
|
|
202
|
+
static resolveEnvironment(env: Environment | undefined, apiKey: string | undefined): Environment;
|
|
182
203
|
/**
|
|
183
204
|
* Constructs a new `ParaCore` instance.
|
|
184
|
-
* @param env - `Environment` to use.
|
|
205
|
+
* @param env - `Environment` to use. Optional if the apiKey contains an environment prefix (e.g., "prod_your_api_key"). Updated API keys can be found at https://developer.getpara.com.
|
|
185
206
|
* @param apiKey - API key to use.
|
|
186
207
|
* @param opts - Additional constructor options; see `ConstructorOpts`.
|
|
187
208
|
* @returns - A new ParaCore instance.
|
|
188
209
|
*/
|
|
189
|
-
constructor(env: Environment, apiKey: string, opts?: ConstructorOpts);
|
|
210
|
+
constructor(env: Environment | undefined, apiKey: string, opts?: ConstructorOpts);
|
|
211
|
+
constructor(apiKey: string, opts?: ConstructorOpts);
|
|
190
212
|
private trackError;
|
|
191
213
|
private wrapMethodsWithErrorTracking;
|
|
192
214
|
private initializeFromStorage;
|
|
193
215
|
private updateAuthInfoFromStorage;
|
|
216
|
+
private updateEnclaveJwtFromStorage;
|
|
194
217
|
private updateUserIdFromStorage;
|
|
195
218
|
private updateWalletsFromStorage;
|
|
196
219
|
private updateWalletIdsFromStorage;
|
|
197
220
|
private updateSessionCookieFromStorage;
|
|
198
221
|
private updateLoginEncryptionKeyPairFromStorage;
|
|
199
222
|
private updateExternalWalletsFromStorage;
|
|
223
|
+
protected initializeWorker: () => Promise<void>;
|
|
200
224
|
touchSession(regenerate?: boolean): Promise<SessionInfo>;
|
|
201
225
|
private getVerificationEmailProps;
|
|
202
226
|
private getBackupKitEmailProps;
|
|
@@ -206,12 +230,29 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
206
230
|
* Init only needs to be called for storage that is async.
|
|
207
231
|
*/
|
|
208
232
|
init(): Promise<void>;
|
|
209
|
-
|
|
233
|
+
/**
|
|
234
|
+
* Call this method to perform initial setup for the `ParaCore` instance.
|
|
235
|
+
*
|
|
236
|
+
* This method will be called automatically if you use the React `ParaProvider` or when you call any methods that request an updated session.
|
|
237
|
+
*/
|
|
238
|
+
abstract ready(): Promise<void>;
|
|
210
239
|
protected setAuth(auth: PrimaryAuth, { extras, userId }?: {
|
|
211
240
|
extras?: AuthExtras;
|
|
212
241
|
userId?: string;
|
|
213
242
|
}): Promise<typeof this.authInfo>;
|
|
214
|
-
|
|
243
|
+
/**
|
|
244
|
+
* Display an error message in the modal (if available)
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
247
|
+
protected displayModalError(error?: string): void;
|
|
248
|
+
/**
|
|
249
|
+
* Handle specific touchSession errors with user-friendly messages
|
|
250
|
+
* @private
|
|
251
|
+
*/
|
|
252
|
+
private handleTouchSessionError;
|
|
253
|
+
protected assertUserId({ allowGuestMode }?: {
|
|
254
|
+
allowGuestMode?: boolean;
|
|
255
|
+
}): string;
|
|
215
256
|
protected assertIsAuthSet(allowed?: AuthType[]): PrimaryAuthInfo;
|
|
216
257
|
/**
|
|
217
258
|
* Sets the email associated with the `ParaCore` instance.
|
|
@@ -240,6 +281,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
240
281
|
* @param externalType - Type of external wallet to set.
|
|
241
282
|
*/
|
|
242
283
|
setExternalWallet(externalWallet: ExternalWalletInfo[] | ExternalWalletInfo): Promise<void>;
|
|
284
|
+
protected addExternalWallets(externalWallets: ExternalWalletInfo[]): Promise<void>;
|
|
243
285
|
/**
|
|
244
286
|
* Sets the user id associated with the `ParaCore` instance.
|
|
245
287
|
* @param userId - User id to set.
|
|
@@ -252,9 +294,9 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
252
294
|
setWallets(wallets: Record<string, Wallet>): Promise<void>;
|
|
253
295
|
/**
|
|
254
296
|
* Sets the external wallets associated with the `ParaCore` instance.
|
|
255
|
-
* @param externalWallets - External wallets to set.
|
|
297
|
+
* @param externalWallets - External wallets to set, or a function that modifies the current wallets.
|
|
256
298
|
*/
|
|
257
|
-
setExternalWallets(externalWallets: Record<string, Wallet>): Promise<void>;
|
|
299
|
+
setExternalWallets(externalWallets: Record<string, Wallet> | ((current: Record<string, Wallet>) => Record<string, Wallet>)): Promise<void>;
|
|
258
300
|
/**
|
|
259
301
|
* Sets the login encryption key pair associated with the `ParaCore` instance.
|
|
260
302
|
* @param keyPair - Encryption key pair generated from loginEncryptionKey.
|
|
@@ -311,7 +353,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
311
353
|
*/
|
|
312
354
|
findWalletByAddress(address: string, filter?: WalletFilters | undefined): any;
|
|
313
355
|
findWallet(idOrAddress?: string, overrideType?: TWalletType, filter?: WalletFilters): Omit<Wallet, 'signer'> | undefined;
|
|
314
|
-
get availableWallets():
|
|
356
|
+
get availableWallets(): AvailableWallet[];
|
|
315
357
|
/**
|
|
316
358
|
* Retrieves all usable wallets with the provided type (`'EVM' | 'COSMOS' | 'SOLANA'`)
|
|
317
359
|
* @param {string} type the wallet type to filter by.
|
|
@@ -340,7 +382,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
340
382
|
* @returns {WalletEntity[]} wallets that were fetched.
|
|
341
383
|
*/
|
|
342
384
|
fetchWallets(): CoreMethodResponse<'fetchWallets'>;
|
|
343
|
-
|
|
385
|
+
protected populateWalletAddresses(): Promise<void>;
|
|
344
386
|
private populatePregenWalletAddresses;
|
|
345
387
|
/**
|
|
346
388
|
* Logs in or creates a new user using an external wallet address.
|
|
@@ -349,8 +391,13 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
349
391
|
* @param {TWalletType} opts.type type of external wallet to use for identification.
|
|
350
392
|
* @param {string} opts.provider the name of the provider for the external wallet.
|
|
351
393
|
*/
|
|
352
|
-
loginExternalWallet({ externalWallet, ...urlOptions }: CoreMethodParams<'loginExternalWallet'>): CoreMethodResponse<'loginExternalWallet'>;
|
|
353
|
-
verifyExternalWallet(
|
|
394
|
+
loginExternalWallet({ externalWallet, chainId, uri, ...urlOptions }: CoreMethodParams<'loginExternalWallet'>): CoreMethodResponse<'loginExternalWallet'>;
|
|
395
|
+
verifyExternalWallet(params: {
|
|
396
|
+
serverAuthState: ServerAuthStateSignup | ServerAuthStateLogin | ServerAuthStateDone;
|
|
397
|
+
} & Omit<CoreMethodParams<'verifyExternalWallet'>, keyof VerifyExternalWalletParams>): CoreMethodResponse<'verifyExternalWallet'>;
|
|
398
|
+
verifyExternalWallet(params: VerifyExternalWalletParams & {
|
|
399
|
+
serverAuthState?: undefined;
|
|
400
|
+
} & Omit<CoreMethodParams<'verifyExternalWallet'>, 'serverAuthState'>): CoreMethodResponse<'verifyExternalWallet'>;
|
|
354
401
|
protected verifyExternalWalletLink(opts: InternalMethodParams<'verifyExternalWalletLink'>): InternalMethodResponse<'verifyExternalWalletLink'>;
|
|
355
402
|
protected verifyTelegramProcess(opts: CoreMethodParams<'verifyTelegram'> & {
|
|
356
403
|
isLinkAccount: false;
|
|
@@ -394,7 +441,15 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
394
441
|
**/
|
|
395
442
|
isFullyLoggedIn(): CoreMethodResponse<'isFullyLoggedIn'>;
|
|
396
443
|
get isGuestMode(): boolean;
|
|
444
|
+
/**
|
|
445
|
+
* Get the auth methods available to an existing user
|
|
446
|
+
* @deprecated Use supportedUserAuthMethods instead
|
|
447
|
+
*/
|
|
397
448
|
protected supportedAuthMethods(auth: Auth<PrimaryAuthType | 'userId'>): Promise<Set<AuthMethod>>;
|
|
449
|
+
/**
|
|
450
|
+
* Get the auth methods available to an existing user
|
|
451
|
+
*/
|
|
452
|
+
protected supportedUserAuthMethods(): Promise<Set<AuthMethod>>;
|
|
398
453
|
/**
|
|
399
454
|
* Get hints associated with the users stored biometrics.
|
|
400
455
|
* @deprecated
|
|
@@ -439,7 +494,15 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
439
494
|
* @param {boolean} [opts.skipSessionRefresh] whether to skip refreshing the session.
|
|
440
495
|
* @returns {Object} `{ isComplete: boolean; isError: boolean; needsWallet: boolean; partnerId: string; }` the result data
|
|
441
496
|
**/
|
|
442
|
-
waitForLogin(
|
|
497
|
+
waitForLogin(args: CoreMethodParams<'waitForLogin'>): CoreMethodResponse<'waitForLogin'>;
|
|
498
|
+
protected waitForWalletSwitching(args: CoreMethodParams<'waitForLogin'>): CoreMethodResponse<'waitForLogin'>;
|
|
499
|
+
/**
|
|
500
|
+
* Gets the switch wallets URL for wallet selection.
|
|
501
|
+
* The authMethod is automatically included in the URL if available.
|
|
502
|
+
*
|
|
503
|
+
* @returns {Promise<{ url: string; authMethod: TAuthMethod }>} The switch wallets URL and authMethod
|
|
504
|
+
*/
|
|
505
|
+
protected getSwitchWalletsUrl(): Promise<string>;
|
|
443
506
|
/**
|
|
444
507
|
* Updates the session with the user management server, possibly
|
|
445
508
|
* opening a popup to refresh the session.
|
|
@@ -662,13 +725,14 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
662
725
|
* Doesn't work for all types of logging.
|
|
663
726
|
**/
|
|
664
727
|
toString(): string;
|
|
665
|
-
protected devLog(...s:
|
|
666
|
-
protected getNewCredentialAndUrl({ authMethod, isForNewDevice, portalTheme, shorten, }?: NewCredentialUrlParams): Promise<{
|
|
728
|
+
protected devLog(...s: any[]): void;
|
|
729
|
+
protected getNewCredentialAndUrl({ authMethod: optsAuthMethod, isForNewDevice, portalTheme, shorten, }?: NewCredentialUrlParams): Promise<{
|
|
667
730
|
credentialId: string;
|
|
668
731
|
url?: string;
|
|
669
732
|
}>;
|
|
733
|
+
addCredential({ authMethod }: Pick<NewCredentialUrlParams, 'authMethod'>): Promise<string>;
|
|
670
734
|
/**
|
|
671
|
-
* Returns a Para Portal URL for logging in with a WebAuth passkey or
|
|
735
|
+
* Returns a Para Portal URL for logging in with a WebAuth passkey, password, PIN or OTP.
|
|
672
736
|
* @param {Object} opts the options object
|
|
673
737
|
* @param {String} opts.auth - the user auth to sign up or log in with, in the form ` { email: string } | { phone: `+${number}` } `
|
|
674
738
|
* @param {boolean} opts.useShortUrls - whether to shorten the generated portal URLs
|
|
@@ -676,6 +740,7 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
676
740
|
* @returns {SignUpOrLogInResponse} an object in the form of either: `{ stage: 'verify' }` or `{ stage: 'login'; passkeyUrl?: string; passwordUrl?: string; biometricHints?: BiometricLocationHint[] }`
|
|
677
741
|
*/
|
|
678
742
|
protected getLoginUrl({ authMethod, shorten, portalTheme, sessionId, }: LoginUrlParams): Promise<string>;
|
|
743
|
+
protected prepareLogin(): InternalMethodResponse<'prepareLogin'>;
|
|
679
744
|
signUpOrLogIn({ auth, ...urlOptions }: CoreMethodParams<'signUpOrLogIn'>): CoreMethodResponse<'signUpOrLogIn'>;
|
|
680
745
|
verifyNewAccount({ verificationCode, ...urlOptions }: CoreMethodParams<'verifyNewAccount'>): CoreMethodResponse<'verifyNewAccount'>;
|
|
681
746
|
getLinkedAccounts({ withMetadata, }?: CoreMethodParams<'getLinkedAccounts'>): CoreMethodResponse<'getLinkedAccounts'>;
|
|
@@ -685,4 +750,10 @@ export declare abstract class ParaCore implements CoreInterface {
|
|
|
685
750
|
accountLinkInProgress?: AccountLinkInProgress;
|
|
686
751
|
} & Partial<Pick<VerifyLinkParams, 'verificationCode' | 'telegramAuthResponse'> & VerifyExternalWalletParams>): Promise<LinkedAccounts>;
|
|
687
752
|
protected verifyEmailOrPhoneLink({ verificationCode, }: InternalMethodParams<'verifyEmailOrPhoneLink'>): InternalMethodResponse<'verifyEmailOrPhoneLink'>;
|
|
753
|
+
protected getProfileBalance({ config, refetch }?: {
|
|
754
|
+
config?: BalancesConfig;
|
|
755
|
+
refetch?: boolean;
|
|
756
|
+
}): Promise<import("@getpara/user-management-client").ProfileBalance>;
|
|
757
|
+
protected sendLoginCode(): Promise<void>;
|
|
758
|
+
exportPrivateKey(args?: CoreMethodParams<'exportPrivateKey'>): CoreMethodResponse<'exportPrivateKey'>;
|
|
688
759
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const PARA_CORE_VERSION: string;
|
|
2
2
|
export declare const PREFIX = "@CAPSULE/";
|
|
3
|
+
export declare const PARA_PREFIX = "@PARA/";
|
|
3
4
|
export declare const LOCAL_STORAGE_AUTH_INFO = "@CAPSULE/authInfo";
|
|
4
5
|
export declare const LOCAL_STORAGE_EMAIL = "@CAPSULE/e-mail";
|
|
5
6
|
export declare const LOCAL_STORAGE_PHONE = "@CAPSULE/phone";
|
|
@@ -13,6 +14,8 @@ export declare const LOCAL_STORAGE_WALLETS = "@CAPSULE/wallets";
|
|
|
13
14
|
export declare const LOCAL_STORAGE_EXTERNAL_WALLETS = "@CAPSULE/externalWallets";
|
|
14
15
|
export declare const LOCAL_STORAGE_CURRENT_WALLET_IDS = "@CAPSULE/currentWalletIds";
|
|
15
16
|
export declare const LOCAL_STORAGE_SESSION_COOKIE = "@CAPSULE/sessionCookie";
|
|
17
|
+
export declare const LOCAL_STORAGE_ENCLAVE_JWT = "@CAPSULE/enclaveJwt";
|
|
18
|
+
export declare const LOCAL_STORAGE_ENCLAVE_REFRESH_JWT = "@CAPSULE/enclaveRefreshJwt";
|
|
16
19
|
export declare const SESSION_STORAGE_LOGIN_ENCRYPTION_KEY_PAIR = "@CAPSULE/loginEncryptionKeyPair";
|
|
17
20
|
export declare const POLLING_INTERVAL_MS = 2000;
|
|
18
21
|
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, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, type TWalletType, WalletScheme, type TWalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type
|
|
3
|
-
export {
|
|
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, type WalletWithMetadata, 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, formatAssetQuantity, formatCurrency, type EstimateTransactionOpts, type EstimateTransactionResult, type BroadcastTransactionOpts, type BroadcastTransactionResult, } from '@getpara/user-management-client';
|
|
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 AvailableWallet, 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, entityToWallet, constructUrl, shortenUrl } from './utils/index.js';
|
|
8
|
-
export { PREFIX as 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';
|
|
@@ -18,9 +18,11 @@ export * from './errors.js';
|
|
|
18
18
|
export * from './utils/formatting.js';
|
|
19
19
|
export * from './utils/polling.js';
|
|
20
20
|
export * from './utils/phone.js';
|
|
21
|
+
export * from './utils/config.js';
|
|
21
22
|
export { isWalletSupported } from './utils/wallet.js';
|
|
22
23
|
export { getNetworkPrefix, getOnRampAssets, getOnRampNetworks, toAssetInfoArray } from './utils/onRamps.js';
|
|
23
24
|
export { getPortalBaseURL } from './utils/url.js';
|
|
24
25
|
export { retrieve as transmissionUtilsRetrieve } from './transmission/transmissionUtils.js';
|
|
26
|
+
export type { ShareData } from './shares/enclave.js';
|
|
25
27
|
export declare const paraVersion: string;
|
|
26
28
|
export default ParaCore;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import UserManagementClient from '@getpara/user-management-client';
|
|
2
|
+
export interface ShareData {
|
|
3
|
+
userId: string;
|
|
4
|
+
walletId: string;
|
|
5
|
+
walletScheme: string;
|
|
6
|
+
partnerId?: string;
|
|
7
|
+
protocolId?: string;
|
|
8
|
+
signer: string;
|
|
9
|
+
createdAt?: string;
|
|
10
|
+
updatedAt?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ShareQuery {
|
|
13
|
+
userId: string;
|
|
14
|
+
walletId?: string;
|
|
15
|
+
partnerId?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface EncryptedPayload {
|
|
18
|
+
encryptedData: string;
|
|
19
|
+
keyId: string;
|
|
20
|
+
algorithm: string;
|
|
21
|
+
ephemeral: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Enclave client for secure key share operations
|
|
25
|
+
* Handles encryption/decryption and communication with the enclave service
|
|
26
|
+
*/
|
|
27
|
+
export declare class EnclaveClient {
|
|
28
|
+
private userManagementClient;
|
|
29
|
+
private enclavePublicKey;
|
|
30
|
+
private frontendKeyPair;
|
|
31
|
+
private retrieveJwt;
|
|
32
|
+
private persistJwt;
|
|
33
|
+
private retrieveRefreshJwt;
|
|
34
|
+
private persistRefreshJwt;
|
|
35
|
+
constructor({ userManagementClient, retrieveJwt, persistJwt, retrieveRefreshJwt, persistRefreshJwt, }: {
|
|
36
|
+
userManagementClient: UserManagementClient;
|
|
37
|
+
retrieveJwt: () => string;
|
|
38
|
+
persistJwt: (jwt: string) => void;
|
|
39
|
+
retrieveRefreshJwt: () => string;
|
|
40
|
+
persistRefreshJwt: (refreshJwt: string) => void;
|
|
41
|
+
});
|
|
42
|
+
private refreshJwt;
|
|
43
|
+
private withJwtRefreshRetry;
|
|
44
|
+
issueEnclaveJwt(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Generate a P-256 keypair for the frontend to receive encrypted responses
|
|
47
|
+
*/
|
|
48
|
+
private generateFrontendKeyPair;
|
|
49
|
+
/**
|
|
50
|
+
* Get the enclave's public key from the user-management service
|
|
51
|
+
*/
|
|
52
|
+
private getEnclavePublicKey;
|
|
53
|
+
/**
|
|
54
|
+
* Import a PEM-formatted public key for use with Web Crypto API
|
|
55
|
+
*/
|
|
56
|
+
private importPublicKeyFromPEM;
|
|
57
|
+
/**
|
|
58
|
+
* Export a public key to PEM format
|
|
59
|
+
*/
|
|
60
|
+
private exportPublicKeyToPEM;
|
|
61
|
+
/**
|
|
62
|
+
* Encrypt data using P-256 ECIES for the enclave
|
|
63
|
+
*/
|
|
64
|
+
private encryptForEnclave;
|
|
65
|
+
/**
|
|
66
|
+
* Decrypt response encrypted for the frontend
|
|
67
|
+
*/
|
|
68
|
+
private decryptForFrontend;
|
|
69
|
+
/**
|
|
70
|
+
* Persist key shares to the enclave
|
|
71
|
+
* @param shares Array of share data to persist
|
|
72
|
+
*/
|
|
73
|
+
private persistShares;
|
|
74
|
+
/**
|
|
75
|
+
* Retrieve key shares from the enclave
|
|
76
|
+
* @param query Query parameters for finding shares (single query or array of queries)
|
|
77
|
+
*/
|
|
78
|
+
private retrieveShares;
|
|
79
|
+
deleteShares(): Promise<void>;
|
|
80
|
+
retrieveSharesWithRetry(query: ShareQuery[]): Promise<ShareData[]>;
|
|
81
|
+
persistSharesWithRetry(shares: ShareData[]): Promise<any>;
|
|
82
|
+
deleteSharesWithRetry(): Promise<void>;
|
|
83
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BackupKitEmailProps } from '@getpara/user-management-client';
|
|
1
|
+
import { BackupKitEmailProps, TWalletScheme } from '@getpara/user-management-client';
|
|
2
2
|
import { Ctx } from '../types/index.js';
|
|
3
|
-
export declare function distributeNewShare({ ctx, userId, walletId, userShare, ignoreRedistributingBackupEncryptedShare, emailProps, partnerId, protocolId, }: {
|
|
3
|
+
export declare function distributeNewShare({ ctx, userId, walletId, userShare, ignoreRedistributingBackupEncryptedShare, emailProps, partnerId, protocolId, isEnclaveUser, walletScheme, }: {
|
|
4
4
|
ctx: Ctx;
|
|
5
5
|
userId: string;
|
|
6
6
|
walletId: string;
|
|
@@ -9,4 +9,6 @@ export declare function distributeNewShare({ ctx, userId, walletId, userShare, i
|
|
|
9
9
|
emailProps?: BackupKitEmailProps;
|
|
10
10
|
partnerId?: string;
|
|
11
11
|
protocolId?: string;
|
|
12
|
+
isEnclaveUser: boolean;
|
|
13
|
+
walletScheme: TWalletScheme;
|
|
12
14
|
}): Promise<string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TNetwork, TOnRampAsset } from '@getpara/user-management-client';
|
|
2
|
+
import { Wallet } from './wallet.js';
|
|
3
|
+
export type AssetTransferType = 'INBOUND' | 'OUTBOUND';
|
|
4
|
+
export type AssetTransfer = {
|
|
5
|
+
wallet: Omit<Wallet, 'signer'>;
|
|
6
|
+
type: AssetTransferType;
|
|
7
|
+
sourceAddress: string;
|
|
8
|
+
destinationAddress: string;
|
|
9
|
+
asset: TOnRampAsset;
|
|
10
|
+
network: TNetwork;
|
|
11
|
+
quantity: string;
|
|
12
|
+
chainId?: string;
|
|
13
|
+
contractAddress?: string;
|
|
14
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
|
-
import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, PregenAuth, TWalletScheme, TWalletType } from '@getpara/user-management-client';
|
|
3
|
-
import {
|
|
2
|
+
import Client, { EmailTheme, Network, OnRampAsset, OnRampProvider, PregenAuth, TWalletScheme, TWalletType, Theme } from '@getpara/user-management-client';
|
|
3
|
+
import { EnclaveClient } from '../shares/enclave.js';
|
|
4
4
|
export declare enum Environment {
|
|
5
5
|
DEV = "DEV",
|
|
6
6
|
SANDBOX = "SANDBOX",
|
|
@@ -13,6 +13,7 @@ export interface Ctx {
|
|
|
13
13
|
env: Environment;
|
|
14
14
|
apiKey: string;
|
|
15
15
|
client: Client;
|
|
16
|
+
enclaveClient?: EnclaveClient;
|
|
16
17
|
disableWorkers?: boolean;
|
|
17
18
|
offloadMPCComputationURL?: string;
|
|
18
19
|
mpcComputationClient?: AxiosInstance;
|
|
@@ -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, ServerAuthStateSignup, ServerAuthStateLogin, ServerAuthStateDone } 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, AuthStateDone } 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"];
|
|
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", "exportPrivateKey"];
|
|
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;
|
|
@@ -118,6 +118,8 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
118
118
|
getOAuthUrl: {
|
|
119
119
|
params: OAuthUrlParams & {
|
|
120
120
|
sessionLookupId?: string;
|
|
121
|
+
encryptionKey?: string;
|
|
122
|
+
portalCallbackParams?: Record<string, string>;
|
|
121
123
|
};
|
|
122
124
|
response: string;
|
|
123
125
|
};
|
|
@@ -143,16 +145,28 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
143
145
|
* The external wallet information to use for login.
|
|
144
146
|
*/
|
|
145
147
|
externalWallet: ExternalWalletInfo | ExternalWalletInfo[];
|
|
148
|
+
/**
|
|
149
|
+
* The chain ID used to generate the SIWE message.
|
|
150
|
+
*/
|
|
151
|
+
chainId?: string;
|
|
152
|
+
/**
|
|
153
|
+
* The URI used to generate the SIWE message.
|
|
154
|
+
*/
|
|
155
|
+
uri?: string;
|
|
146
156
|
};
|
|
147
157
|
response: AuthStateVerifyOrLogin;
|
|
148
158
|
};
|
|
149
159
|
verifyExternalWallet: {
|
|
150
|
-
params: AuthStateBaseParams &
|
|
151
|
-
|
|
160
|
+
params: (AuthStateBaseParams & {
|
|
161
|
+
serverAuthState: ServerAuthStateSignup | ServerAuthStateLogin | ServerAuthStateDone;
|
|
162
|
+
}) | (AuthStateBaseParams & VerifyExternalWalletParams & {
|
|
163
|
+
serverAuthState?: undefined;
|
|
164
|
+
});
|
|
165
|
+
response: AuthStateSignup | AuthStateLogin | AuthStateDone;
|
|
152
166
|
};
|
|
153
167
|
resendVerificationCode: {
|
|
154
168
|
params: {
|
|
155
|
-
type?: 'SIGNUP' | 'LINK_ACCOUNT';
|
|
169
|
+
type?: 'SIGNUP' | 'LINK_ACCOUNT' | 'LOGIN';
|
|
156
170
|
} | undefined;
|
|
157
171
|
response: void;
|
|
158
172
|
};
|
|
@@ -482,6 +496,20 @@ export type CoreMethods = Record<CoreMethodName, {
|
|
|
482
496
|
userId: string;
|
|
483
497
|
};
|
|
484
498
|
};
|
|
499
|
+
addCredential: {
|
|
500
|
+
params: Pick<NewCredentialUrlParams, 'authMethod'>;
|
|
501
|
+
response: Promise<string>;
|
|
502
|
+
};
|
|
503
|
+
exportPrivateKey: {
|
|
504
|
+
params: {
|
|
505
|
+
walletId?: string;
|
|
506
|
+
shouldOpenPopup?: boolean;
|
|
507
|
+
} | undefined;
|
|
508
|
+
response: {
|
|
509
|
+
popupWindow?: Window;
|
|
510
|
+
url: string;
|
|
511
|
+
};
|
|
512
|
+
};
|
|
485
513
|
};
|
|
486
514
|
export type InternalMethods = {
|
|
487
515
|
linkAccount: {
|
|
@@ -522,6 +550,18 @@ export type InternalMethods = {
|
|
|
522
550
|
params: Omit<VerifyExternalWalletParams, 'externalWallet'>;
|
|
523
551
|
response: LinkedAccounts;
|
|
524
552
|
};
|
|
553
|
+
prepareLogin: {
|
|
554
|
+
params: void;
|
|
555
|
+
response: string;
|
|
556
|
+
};
|
|
557
|
+
sendLoginCode: {
|
|
558
|
+
params: void;
|
|
559
|
+
response: void;
|
|
560
|
+
};
|
|
561
|
+
supportedUserAuthMethods: {
|
|
562
|
+
params: void;
|
|
563
|
+
response: Promise<Set<AuthMethod>>;
|
|
564
|
+
};
|
|
525
565
|
};
|
|
526
566
|
export type CoreInterface = {
|
|
527
567
|
[key in keyof CoreMethods]: Partial<CoreMethod<key>>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CurrentWalletIds } from '@getpara/user-management-client';
|
|
1
|
+
import { CurrentWalletIds, OnRampPurchase } from '@getpara/user-management-client';
|
|
2
2
|
import { FullSignatureRes } from './wallet.js';
|
|
3
3
|
import { Wallet } from './wallet.js';
|
|
4
4
|
import { CoreMethodResponse } from './coreApi.js';
|
|
5
|
+
import { AssetTransfer } from './assets.js';
|
|
5
6
|
export declare enum ParaEvent {
|
|
6
7
|
LOGIN_EVENT = "paraLogin",
|
|
7
8
|
ACCOUNT_CREATION_EVENT = "paraAccountCreation",
|
|
@@ -13,7 +14,9 @@ export declare enum ParaEvent {
|
|
|
13
14
|
WALLETS_CHANGE_EVENT = "paraWalletsChange",
|
|
14
15
|
WALLET_CREATED = "paraWalletCreated",
|
|
15
16
|
PREGEN_WALLET_CLAIMED = "paraPregenWalletClaimed",
|
|
16
|
-
GUEST_WALLETS_CREATED = "paraGuestWalletsCreated"
|
|
17
|
+
GUEST_WALLETS_CREATED = "paraGuestWalletsCreated",
|
|
18
|
+
ASSET_TRANSFERRED = "paraAssetTransferred",
|
|
19
|
+
ONRAMP_TRANSACTION_COMPLETE = "paraOnRampTransactionComplete"
|
|
17
20
|
}
|
|
18
21
|
export type BaseEvent<T> = {
|
|
19
22
|
data: T;
|
|
@@ -48,3 +51,5 @@ export type PregenWalletClaimedResponse = {
|
|
|
48
51
|
};
|
|
49
52
|
export type PregenWalletClaimedEvent = CustomEventInit<BaseEvent<WalletCreatedResponse>>;
|
|
50
53
|
export type GuestWalletsCreatedEvent = CustomEventInit<BaseEvent<CoreMethodResponse<'createGuestWallets'>>>;
|
|
54
|
+
export type AssetTransferredEvent = CustomEventInit<BaseEvent<AssetTransfer>>;
|
|
55
|
+
export type OnRampTransactionCompleteResponse = CustomEventInit<BaseEvent<OnRampPurchase>>;
|
|
@@ -3,9 +3,5 @@ export * from './config.js';
|
|
|
3
3
|
export * from './coreApi.js';
|
|
4
4
|
export * from './wallet.js';
|
|
5
5
|
export * from './methods.js';
|
|
6
|
-
export * from './theme.js';
|
|
7
|
-
export * from './onRamps.js';
|
|
8
6
|
export * from './popup.js';
|
|
9
|
-
export * from './recovery.js';
|
|
10
7
|
export * from './events.js';
|
|
11
|
-
export { Network, OnRampAsset, OnRampProvider, OnRampPurchaseStatus, type OnRampPurchase, } from '@getpara/user-management-client';
|