@getpara/core-sdk 2.0.0-dev.0 → 2.0.0-dev.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.
@@ -1,9 +1,10 @@
1
1
  import { ParaCore } from './ParaCore.js';
2
- export { type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, AuthMethod, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, WalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
3
- export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type AuthExtras, type CoreAuthInfo, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, } from './types/index.js';
2
+ export { type AuthInfo, type PrimaryAuthInfo, type VerifiedAuthInfo, AuthMethod, type AuthExtras, type CurrentWalletIds, EmailTheme, type PartnerEntity, type WalletEntity, Network, WalletType, WalletScheme, OnRampAsset, OnRampPurchaseType, OnRampProvider, OnRampPurchaseStatus, type OnRampConfig, type OnRampAllowedAssets, type OnRampPurchase, OAuthMethod, type SupportedWalletTypes, type TPregenIdentifierType, type PregenIds, NON_ED25519, PREGEN_IDENTIFIER_TYPES, } from '@getpara/user-management-client';
3
+ export { OnRampMethod, PopupType, PregenIdentifierType, RecoveryStatus, type AuthStateSignup, type AuthStateVerify, type AuthStateLogin, type AuthState, type OAuthResponse, type CoreAuthInfo, type ProviderAssetInfo, type SignatureRes, type FullSignatureRes, type SuccessfulSignatureRes, type DeniedSignatureRes, type DeniedSignatureResWithUrl, type OnRampAssetInfo, type Theme, type Wallet, } from './types/index.js';
4
+ export * from './types/coreApi.js';
4
5
  export * from './types/events.js';
5
6
  export * from './types/config.js';
6
- export { getPortalDomain, entityToWallet } from './utils/index.js';
7
+ export { getPortalDomain, entityToWallet, constructUrl, shortenUrl } from './utils/index.js';
7
8
  export { PREFIX as STORAGE_PREFIX } from './constants.js';
8
9
  export { distributeNewShare } from './shares/shareDistribution.js';
9
10
  export { KeyContainer } from './shares/KeyContainer.js';
@@ -0,0 +1,437 @@
1
+ import { BackupKitEmailProps, CurrentWalletIds, ExternalWalletInfo, OnRampPurchase, OnRampPurchaseCreateParams, PregenAuth, Setup2faResponse, TelegramAuthResponse, VerifiedAuth, VerifyExternalWalletParams, WalletEntity, WalletParams, WalletType } from '@getpara/user-management-client';
2
+ import { AuthStateLogin, AuthStateVerify, OAuthResponse, AuthStateBaseParams, WithCustomTheme, WithUseShortUrls, Verify2faResponse, AuthStateSignup, AuthStateVerifyOrLogin, OAuthUrlParams, StorageType, PollParams } from './methods.js';
3
+ import { ParaCore } from '../ParaCore.js';
4
+ import { FullSignatureRes, Wallet } from './wallet.js';
5
+ export declare const PARA_CORE_METHODS: readonly ["signUpOrLogInV2", "verifyNewAccountV2", "waitForLoginV2", "waitForSignupV2", "waitForWalletCreationV2", "verifyOAuthV2", "verifyFarcasterV2", "verifyTelegramV2", "resendVerificationCode", "loginExternalWalletV2", "verifyExternalWalletV2", "setup2faV2", "enable2faV2", "verify2faV2", "logout", "clearStorage", "isSessionActive", "isFullyLoggedIn", "refreshSession", "keepSessionAlive", "exportSession", "importSession", "getVerificationToken", "fetchWallets", "createWallet", "createWalletPerType", "getPregenWalletsV2", "hasPregenWalletV2", "updatePregenWalletIdentifierV2", "createPregenWalletV2", "createPregenWalletPerTypeV2", "claimPregenWalletsV2", "distributeNewWalletShare", "getUserShare", "setUserShare", "refreshShare", "signMessage", "signTransaction", "initiateOnRampTransaction"];
6
+ export type CoreMethodName = (typeof PARA_CORE_METHODS)[number];
7
+ export type CoreMethodParams<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
8
+ params: infer P;
9
+ } ? P : never;
10
+ export type CoreMethodResponse<method extends CoreMethodName & keyof CoreMethods> = CoreMethods[method] extends {
11
+ response: infer R;
12
+ } ? CoreMethods[method] extends {
13
+ sync: true;
14
+ } ? R : Promise<R> : void;
15
+ export type CoreMethod<method extends CoreMethodName & keyof CoreMethods> = CoreMethodParams<method> extends void | never ? () => CoreMethodResponse<method> : (_?: CoreMethodParams<method>) => CoreMethodResponse<method>;
16
+ export type CoreAction<method extends CoreMethodName & keyof CoreMethods> = CoreMethodParams<method> extends void | never ? (_?: ParaCore) => CoreMethodResponse<method> : (_?: ParaCore, __?: CoreMethodParams<method>) => CoreMethodResponse<method>;
17
+ export type CoreMethods = Record<CoreMethodName, {
18
+ params?: unknown;
19
+ response?: unknown;
20
+ sync?: true;
21
+ }> & {
22
+ signUpOrLogInV2: {
23
+ params: WithCustomTheme & WithUseShortUrls & {
24
+ /**
25
+ * The user's email address or phone number, in the form `{ email: '...' } | { phone: '+1...' }`}
26
+ */
27
+ auth: VerifiedAuth;
28
+ };
29
+ response: AuthStateVerify | AuthStateLogin;
30
+ };
31
+ verifyNewAccountV2: {
32
+ params: WithCustomTheme & WithUseShortUrls & {
33
+ /**
34
+ * The verification code entered by the user.
35
+ */
36
+ verificationCode: string;
37
+ };
38
+ response: AuthStateSignup;
39
+ };
40
+ waitForLoginV2: {
41
+ params: PollParams & {
42
+ /**
43
+ * Whether to skip the session refresh
44
+ */
45
+ skipSessionRefresh?: boolean;
46
+ /**
47
+ * A function returning a boolean, indicating whether the login process should be cancelled.
48
+ */
49
+ isCanceled?: () => boolean;
50
+ };
51
+ response: {
52
+ /**
53
+ * Whether the signed-in user still needs to create one or more wallets for this application.
54
+ */
55
+ needsWallet?: boolean;
56
+ /**
57
+ * The partner ID for the current application.
58
+ */
59
+ partnerId?: string;
60
+ };
61
+ };
62
+ waitForSignupV2: {
63
+ params: PollParams & {
64
+ /**
65
+ * A function returning a boolean, indicating whether the signup process should be cancelled.
66
+ */
67
+ isCanceled?: () => boolean;
68
+ };
69
+ response: true;
70
+ };
71
+ waitForWalletCreationV2: {
72
+ params: PollParams & {
73
+ /**
74
+ * A function returning a boolean, indicating whether wallet creation should be cancelled.
75
+ */
76
+ isCanceled?: () => boolean;
77
+ };
78
+ response: {
79
+ /**
80
+ * The IDs of the newly created wallets.
81
+ */
82
+ walletIds: CurrentWalletIds;
83
+ /**
84
+ * The recovery secret for the new wallets, if available.
85
+ */
86
+ recoverySecret?: string;
87
+ };
88
+ };
89
+ verifyOAuthV2: {
90
+ params: AuthStateBaseParams & OAuthUrlParams & PollParams & {
91
+ /**
92
+ * A function returning a boolean, indicating whether the OAuth process should be cancelled.
93
+ */
94
+ isCanceled?: () => boolean;
95
+ /**
96
+ * A callback function that will be invoked with the OAuth URL when it is available.
97
+ * For example, you can use this to open the URL in a new window or tab.
98
+ */
99
+ onOAuthUrl?: (url: string) => void;
100
+ };
101
+ response: OAuthResponse;
102
+ };
103
+ verifyFarcasterV2: {
104
+ params: AuthStateBaseParams & PollParams & {
105
+ /**
106
+ * A function returning a boolean, indicating whether the Farcaster login process should be cancelled.
107
+ */
108
+ isCanceled?: () => boolean;
109
+ /**
110
+ * A callback function that will be invoked with the Farcaster Connect URI when it is available.
111
+ * You will need to display the URI as a QR code.
112
+ */
113
+ onConnectUri: (uri: string) => void;
114
+ };
115
+ response: OAuthResponse;
116
+ };
117
+ verifyTelegramV2: {
118
+ params: AuthStateBaseParams & {
119
+ /**
120
+ * The response received from the Telegram login bot.
121
+ */
122
+ telegramAuthResponse: TelegramAuthResponse;
123
+ };
124
+ response: OAuthResponse;
125
+ };
126
+ loginExternalWalletV2: {
127
+ params: AuthStateBaseParams & {
128
+ /**
129
+ * The external wallet information to use for login.
130
+ */
131
+ externalWallet: ExternalWalletInfo;
132
+ };
133
+ response: AuthStateVerifyOrLogin;
134
+ };
135
+ verifyExternalWalletV2: {
136
+ params: AuthStateBaseParams & VerifyExternalWalletParams;
137
+ response: AuthStateSignup;
138
+ };
139
+ resendVerificationCode: {
140
+ params: void;
141
+ response: void;
142
+ };
143
+ logout: {
144
+ params: {
145
+ /**
146
+ * Whether to remove all pregen wallets from storage.
147
+ */
148
+ clearPregenWallets?: boolean;
149
+ };
150
+ response: void;
151
+ };
152
+ clearStorage: {
153
+ params: StorageType | undefined;
154
+ response: void;
155
+ };
156
+ isSessionActive: {
157
+ params: void;
158
+ response: boolean;
159
+ };
160
+ isFullyLoggedIn: {
161
+ params: void;
162
+ response: boolean;
163
+ };
164
+ refreshSession: {
165
+ params: {
166
+ shouldOpenPopup?: boolean;
167
+ };
168
+ response: string;
169
+ };
170
+ keepSessionAlive: {
171
+ params: void;
172
+ response: boolean;
173
+ };
174
+ exportSession: {
175
+ params: void;
176
+ response: string;
177
+ sync: true;
178
+ };
179
+ importSession: {
180
+ params: string;
181
+ response: void;
182
+ };
183
+ getVerificationToken: {
184
+ params: void;
185
+ response: string;
186
+ };
187
+ setup2faV2: {
188
+ params: void;
189
+ response: Setup2faResponse;
190
+ };
191
+ enable2faV2: {
192
+ params: {
193
+ /**
194
+ * The two-factor authentication code entered by the user.
195
+ */
196
+ verificationCode: string;
197
+ };
198
+ response: void;
199
+ };
200
+ verify2faV2: {
201
+ params: {
202
+ /**
203
+ * The email or phone number for the user to verify, in the form `{ email: '...' } | { phone: '+1...' }`
204
+ */
205
+ auth: VerifiedAuth;
206
+ /**
207
+ * The two-factor authentication code entered by the user.
208
+ */
209
+ verificationCode: string;
210
+ };
211
+ response: Verify2faResponse;
212
+ };
213
+ fetchWallets: {
214
+ params: void;
215
+ response: WalletEntity[];
216
+ };
217
+ createWallet: {
218
+ params: {
219
+ type?: Uppercase<WalletType>;
220
+ skipDistribute?: boolean;
221
+ };
222
+ response: [Wallet, string | undefined];
223
+ };
224
+ createWalletPerType: {
225
+ params: {
226
+ /**
227
+ * Array of the wallet types to create
228
+ */
229
+ types?: Uppercase<WalletType>[];
230
+ /**
231
+ * If `true`, skip distributing the new wallets shares.
232
+ */
233
+ skipDistribute?: boolean;
234
+ };
235
+ response: {
236
+ /**
237
+ * Array of the created wallets
238
+ */
239
+ wallets: Wallet[];
240
+ /**
241
+ * The `CurrentWalletIds` value for the new wallets
242
+ */
243
+ walletIds: CurrentWalletIds;
244
+ /**
245
+ * The recovery secret for the new wallets, if available.
246
+ */
247
+ recoverySecret?: string;
248
+ };
249
+ };
250
+ getPregenWalletsV2: {
251
+ params: {
252
+ /**
253
+ * The pregen ID for the wallets to fetch. If not provided, all available wallets will be retrieved.
254
+ */
255
+ pregenId?: PregenAuth;
256
+ };
257
+ response: WalletEntity[];
258
+ };
259
+ updatePregenWalletIdentifierV2: {
260
+ params: {
261
+ /**
262
+ * The ID of the pregen wallet to update.
263
+ */
264
+ walletId: string;
265
+ /**
266
+ * The new identifer for the wallet.
267
+ */
268
+ newPregenId: PregenAuth;
269
+ };
270
+ response: void;
271
+ };
272
+ hasPregenWalletV2: {
273
+ params: {
274
+ /**
275
+ * The pregen ID for the wallet to check.
276
+ */
277
+ pregenId: PregenAuth;
278
+ };
279
+ response: boolean;
280
+ };
281
+ createPregenWalletV2: {
282
+ params: {
283
+ /**
284
+ * The type of wallet to create, 'EVM' | 'SOLANA' | 'COSMOS'
285
+ */
286
+ type: WalletType;
287
+ /**
288
+ * The pregen identifier for the wallet, in the form: `{ email: string } | { phone: string } | { telegramUserId: string } | { farcasterUsername: string } | { xUsername: string } | { discordUsername: string } | { customId: string }`
289
+ */
290
+ pregenId: PregenAuth;
291
+ };
292
+ response: Wallet;
293
+ };
294
+ createPregenWalletPerTypeV2: {
295
+ params: {
296
+ /**
297
+ * The wallet types to create. If not provided, defaults to your application's `supportedWalletTypes` setting.
298
+ */
299
+ types?: WalletType[];
300
+ /**
301
+ * The pregen identifier for the wallets, in the form: `{ email: string } | { phone: string } | { telegramUserId: string } | { farcasterUsername: string } | { xUsername: string } | { discordUsername: string } | { customId: string }`
302
+ */
303
+ pregenId: PregenAuth;
304
+ };
305
+ response: Wallet[];
306
+ };
307
+ claimPregenWalletsV2: {
308
+ params: {
309
+ /**
310
+ * The pregen identifier for the wallet to claim. If not provided, will attempt to claim all wallets in storage.
311
+ */
312
+ pregenId?: PregenAuth;
313
+ };
314
+ response: string | undefined;
315
+ };
316
+ distributeNewWalletShare: {
317
+ params: {
318
+ /**
319
+ * The ID of the wallet whose share to distribute.
320
+ */
321
+ walletId: string;
322
+ /**
323
+ * The user share string.
324
+ */
325
+ userShare?: string;
326
+ /**
327
+ * If `true`, skip biometric share creation.
328
+ */
329
+ skipBiometricShareCreation?: boolean;
330
+ /**
331
+ * If `true`, force a session refresh.
332
+ */
333
+ forceRefresh?: boolean;
334
+ };
335
+ response: string;
336
+ };
337
+ getUserShare: {
338
+ params: void;
339
+ response: string | null;
340
+ sync: true;
341
+ };
342
+ setUserShare: {
343
+ params: string | null;
344
+ response: void;
345
+ };
346
+ refreshShare: {
347
+ params: {
348
+ walletId: string;
349
+ share: string;
350
+ oldPartnerId?: string;
351
+ newPartnerId?: string;
352
+ keyShareProtocolId?: string;
353
+ redistributeBackupEncryptedShares?: boolean;
354
+ emailProps?: BackupKitEmailProps;
355
+ };
356
+ response: {
357
+ protocolId: string;
358
+ recoverySecret?: string;
359
+ signer: string;
360
+ };
361
+ };
362
+ signMessage: {
363
+ params: PollParams & {
364
+ /**
365
+ * The ID of the wallet to use for signing.
366
+ */
367
+ walletId: string;
368
+ /**
369
+ * The message to sign as a base64-encoded string.
370
+ */
371
+ messageBase64: string;
372
+ /**
373
+ * The duration in milliseconds to wait before the signing operation times out.
374
+ */
375
+ timeoutMs?: number;
376
+ /**
377
+ * For Cosmos transactions, the `SignDoc` as a base64-encoded string.
378
+ */
379
+ cosmosSignDocBase64?: string;
380
+ /**
381
+ * A callback that returns a boolean, indicating whether the signing operation should be cancelled.
382
+ */
383
+ isCanceled?: () => boolean;
384
+ };
385
+ response: FullSignatureRes;
386
+ };
387
+ signTransaction: {
388
+ params: PollParams & {
389
+ /**
390
+ * The ID of the wallet to use for signing.
391
+ */
392
+ walletId: string;
393
+ /**
394
+ * The transaction to sign as a base64-encoded string.
395
+ */
396
+ rlpEncodedTxBase64: string;
397
+ /**
398
+ * For EVM transactions, the chain ID.
399
+ */
400
+ chainId: string;
401
+ /**
402
+ * The duration in milliseconds to wait before the signing operation times out.
403
+ */
404
+ timeoutMs?: number;
405
+ /**
406
+ * A callback that returns a boolean, indicating whether the signing operation should be cancelled.
407
+ */
408
+ isCanceled?: () => boolean;
409
+ };
410
+ response: FullSignatureRes;
411
+ };
412
+ initiateOnRampTransaction: {
413
+ params: WalletParams & {
414
+ /**
415
+ * The on-ramp transaction options.
416
+ */
417
+ params: OnRampPurchaseCreateParams;
418
+ /**
419
+ * Whether to open a popup window for the user to complete the transaction.
420
+ */
421
+ shouldOpenPopup?: boolean;
422
+ };
423
+ response: {
424
+ /**
425
+ * The newly created on-ramp transaction.
426
+ */
427
+ onRampPurchase: OnRampPurchase;
428
+ /**
429
+ * A Para Portal URL for the user to complete the transaction.
430
+ */
431
+ portalUrl: string;
432
+ };
433
+ };
434
+ };
435
+ export type CoreInterface = {
436
+ [key in keyof CoreMethods]: CoreMethod<key>;
437
+ };
@@ -1,4 +1,5 @@
1
1
  export * from './config.js';
2
+ export * from './coreApi.js';
2
3
  export * from './wallet.js';
3
4
  export * from './methods.js';
4
5
  export * from './theme.js';
@@ -1,20 +1,20 @@
1
- import { AuthType, PrimaryAuthInfo, WalletType } from '@getpara/user-management-client';
1
+ import { AuthType, PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateSignup, AuthMethod, ServerAuthStateVerify, VerifiedAuth, AuthExtras, OAuthMethod, WalletType } from '@getpara/user-management-client';
2
2
  import { Theme } from './theme.js';
3
+ import { RecoveryStatus } from './recovery.js';
4
+ import { Wallet } from './wallet.js';
5
+ type Device = {
6
+ sessionId: string;
7
+ encryptionKey: string;
8
+ };
3
9
  export type EmbeddedWalletType = Exclude<WalletType, never>;
4
10
  export type ExternalWalletType = Exclude<WalletType, never>;
5
- export type ExternalWalletInfo = {
6
- address: string;
7
- type: ExternalWalletType;
8
- provider?: string;
9
- addressBech32?: string;
10
- withFullParaAuth?: boolean;
11
- };
12
- export type VerifyExternalWallet = {
11
+ export type VerifyExternalWalletV1 = {
13
12
  address: string;
14
13
  signedMessage: string;
15
14
  cosmosPublicKeyHex?: string;
16
15
  cosmosSigner?: string;
17
16
  };
17
+ export type PortalUrlType = 'createAuth' | 'createPassword' | 'loginAuth' | 'loginPassword' | 'txReview' | 'onRamp';
18
18
  export type PortalUrlOptions = {
19
19
  params?: Record<string, string | undefined | null>;
20
20
  authType?: AuthType;
@@ -29,19 +29,15 @@ export type PortalUrlOptions = {
29
29
  displayName?: string;
30
30
  pfpUrl?: string;
31
31
  };
32
- export type AuthExtras = {
33
- /**
34
- * The current user's third-party username.
35
- */
36
- username?: string;
37
- /**
38
- * The current user's third-party display name.
39
- */
40
- displayName?: string;
41
- /**
42
- * The current user's third-party profile picture URL.
43
- */
44
- pfpUrl?: string;
32
+ export type PortalUrlOptionsV2 = {
33
+ params?: Record<string, string | undefined | null>;
34
+ isForNewDevice?: boolean;
35
+ thisDevice?: Device;
36
+ newDevice?: Device;
37
+ sessionId?: string;
38
+ portalTheme?: Theme;
39
+ pathId?: string;
40
+ shorten?: boolean;
45
41
  };
46
42
  export type GetWebAuthUrlForLoginParams = {
47
43
  /**
@@ -77,4 +73,119 @@ export type GetWebAuthUrlForLoginParams = {
77
73
  */
78
74
  pfpUrl?: string;
79
75
  };
76
+ export type WithAuthMethod = {
77
+ /**
78
+ * Which authorization method to use for the URL, either `'passkey'` or `'passwprd'`.
79
+ */
80
+ authMethod?: Uppercase<AuthMethod>;
81
+ };
82
+ export type WithCustomTheme = {
83
+ /**
84
+ * The theme to apply to generated URLs, if different from your configured theme.
85
+ */
86
+ portalTheme?: Theme;
87
+ };
88
+ export type WithUseShortUrls = {
89
+ /**
90
+ * Whether to shorten generated URLs. This may correct any issues with generated QR codes. Defaults to `false`.
91
+ */
92
+ useShortUrls?: boolean;
93
+ };
94
+ export type WithShorten = {
95
+ /**
96
+ * Whether to shorten the generated URL. This may correct any issues with generated QR codes. Defaults to `false`.
97
+ */
98
+ shorten?: boolean;
99
+ };
100
+ export type PollParams = {
101
+ /**
102
+ * A callback function that will be invoked on each method poll.
103
+ */
104
+ onPoll?: () => void;
105
+ /**
106
+ * A callback function that will be invoked if the method call is canceled.
107
+ */
108
+ onCancel?: () => void;
109
+ };
110
+ export type LoginUrlParams = WithAuthMethod & WithCustomTheme & WithShorten & {
111
+ sessionId?: string;
112
+ };
113
+ export type NewCredentialUrlParams = WithAuthMethod & WithCustomTheme & WithShorten & {
114
+ /**
115
+ * Whether the URL is meant to add a passkey for a previous user on a new device. Defaults to `false`.
116
+ */
117
+ isForNewDevice?: boolean;
118
+ };
119
+ export type OAuthUrlParams = {
120
+ /**
121
+ * The third-party OAuth service.
122
+ */
123
+ method: Exclude<OAuthMethod, 'TELEGRAM' | 'FARCASTER'>;
124
+ /**
125
+ * The deeplink URL to redirect to after OAuth is complete.
126
+ */
127
+ deeplinkUrl?: string;
128
+ };
129
+ export type AuthStateBaseParams = WithCustomTheme & WithUseShortUrls;
130
+ export type AuthStateVerify = ServerAuthStateVerify;
131
+ export type AuthStateLogin = Omit<ServerAuthStateLogin, 'loginAuthMethods'> & {
132
+ /**
133
+ * A Para Portal URL for logging in via a WebAuth passkey. For best compatibility, you should open this URL in a new window or tab.
134
+ */
135
+ passkeyUrl?: string;
136
+ /**
137
+ * A Para Portal URL for authorizing a new device using a WebAuth passkey located elsewhere, to be visited using that other device.
138
+ */
139
+ passkeyKnownDeviceUrl?: string;
140
+ /**
141
+ * A Para Portal URL for logging in via a password.
142
+ */
143
+ passwordUrl?: string;
144
+ };
145
+ export type AuthStateSignup = Omit<ServerAuthStateSignup, 'signupAuthMethods'> & {
146
+ /**
147
+ * A Para Portal URL for creating a new WebAuth passkey.
148
+ */
149
+ passkeyUrl?: string;
150
+ /**
151
+ * A Para Portal URL for creating a new user password.
152
+ */
153
+ passwordUrl?: string;
154
+ /**
155
+ * The Para system ID for the newly generated passkey.
156
+ */
157
+ passkeyId?: string;
158
+ /**
159
+ * The Para system ID for the newly generated password.
160
+ */
161
+ passwordId?: string;
162
+ };
163
+ export type AuthStateVerifyOrLogin = AuthStateVerify | AuthStateLogin;
164
+ export type AuthStateSignupOrLogin = AuthStateSignup | AuthStateLogin;
165
+ export type OAuthResponse = AuthStateSignupOrLogin;
166
+ export type AuthState = AuthStateVerify | AuthStateLogin | AuthStateSignup;
167
+ export type Verify2faParams = {
168
+ auth: VerifiedAuth;
169
+ verificationCode: string;
170
+ };
171
+ export type Verify2faResponse = {
172
+ /**
173
+ * When the 2FA verification code was sent.
174
+ */
175
+ initiatedAt?: Date;
176
+ /**
177
+ * The status for the 2FA process.
178
+ */
179
+ status?: RecoveryStatus;
180
+ /**
181
+ * The matched user ID.
182
+ */
183
+ userId: string;
184
+ /**
185
+ * The wallets protected by this 2FA instance.
186
+ */
187
+ wallets: Pick<Wallet, 'address' | 'id'>[];
188
+ };
80
189
  export type CoreAuthInfo = PrimaryAuthInfo & AuthExtras;
190
+ export type StorageType = 'local' | 'session' | 'secure' | 'all';
191
+ export {};
@@ -1,5 +1,4 @@
1
- import { PartnerEntity, TPregenIdentifierType, WalletScheme } from '@getpara/user-management-client';
2
- import { EmbeddedWalletType, ExternalWalletType } from './methods.js';
1
+ import { EmbeddedWalletType, ExternalWalletType, PartnerEntity, TPregenIdentifierType, WalletScheme } from '@getpara/user-management-client';
3
2
  export interface Wallet {
4
3
  createdAt?: string;
5
4
  id: string;
@@ -6,5 +6,6 @@ export * from './listeners.js';
6
6
  export * from './onRamps.js';
7
7
  export * from './phone.js';
8
8
  export * from './polling.js';
9
+ export * from './types.js';
9
10
  export * from './url.js';
10
11
  export * from './wallet.js';
@@ -1,7 +1,7 @@
1
- export declare function formatPhoneNumber(phone: string | undefined, countryCode?: string | undefined, opts?: {
1
+ export declare function formatPhoneNumber(phone: string, countryCode?: string | undefined, opts?: {
2
2
  forDisplay: undefined | false;
3
3
  }): `+${number}` | null;
4
- export declare function formatPhoneNumber(phone: string | undefined, countryCode: string | undefined, opts: {
4
+ export declare function formatPhoneNumber(phone: string, countryCode: string | undefined, opts: {
5
5
  forDisplay: true;
6
6
  }): string | null;
7
7
  export declare function displayPhoneNumber(phone: string, countryCode?: string): string;
@@ -0,0 +1,2 @@
1
+ import { ServerAuthState } from '@getpara/user-management-client';
2
+ export declare function isServerAuthState(obj: ServerAuthState | Record<string, never>): obj is ServerAuthState;
@@ -1,4 +1,4 @@
1
- import { Environment } from '../types/index.js';
1
+ import { Ctx, Environment } from '../types/index.js';
2
2
  export declare function getPortalDomain(env: Environment, isE2E?: boolean): "localhost" | "app.sandbox.usecapsule.com" | "app.beta.usecapsule.com" | "app.usecapsule.com";
3
3
  export declare function getPortalBaseURL({ env, isE2E }: {
4
4
  env: Environment;
@@ -13,3 +13,4 @@ export declare function constructUrl({ base, path, params, }: {
13
13
  path: string;
14
14
  params?: Record<string, string | undefined | null>;
15
15
  }): string;
16
+ export declare function shortenUrl(ctx: Ctx, url: string): Promise<string>;
@@ -1,4 +1,4 @@
1
- import { SupportedWalletTypes, TPregenIdentifierType, WalletEntity, WalletScheme, WalletType } from '@getpara/user-management-client';
1
+ import { CurrentWalletIds, SupportedWalletTypes, TPregenIdentifierType, WalletEntity, WalletScheme, WalletType } from '@getpara/user-management-client';
2
2
  import { Wallet, WalletTypeProp } from '../types/index.js';
3
3
  export declare const WalletSchemeTypeMap: Record<WalletScheme, Partial<Record<WalletType, true>>>;
4
4
  export declare function isPregenIdentifierMatch(a: string | null | undefined, b: string | null | undefined, type: TPregenIdentifierType): boolean;
@@ -9,3 +9,4 @@ export declare function getEquivalentTypes(types: WalletTypeProp[] | WalletTypeP
9
9
  export declare function entityToWallet(w: WalletEntity): Omit<Wallet, 'signer'>;
10
10
  export declare function migrateWallet(obj: Record<string, unknown>): Wallet;
11
11
  export declare function supportedWalletTypesEq(a: SupportedWalletTypes, b: SupportedWalletTypes): boolean;
12
+ export declare function mergeCurrentWalletIds(original: CurrentWalletIds, additional: CurrentWalletIds): CurrentWalletIds;