@getpara/user-management-client 2.0.0-alpha.3 → 2.0.0-alpha.30

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,6 +1,6 @@
1
- import { CurrentWalletIds, ExternalWalletType, SupportedWalletTypes } from './wallet.js';
2
- export declare const AUTH_TYPES: readonly ["email", "phone", "phoneLegacy", "farcaster", "telegram", "userId", "externalWallet", "discord", "x", "customId"];
3
- export type AuthType = 'email' | 'phone' | 'phoneLegacy' | 'farcaster' | 'telegram' | 'userId' | 'externalWallet' | 'discord' | 'x' | 'customId';
1
+ import { CurrentWalletIds, ExternalWalletType, SupportedWalletTypes, TExternalWallet } from './wallet.js';
2
+ export declare const AUTH_TYPES: readonly ["email", "phone", "phoneLegacy", "farcaster", "telegram", "userId", "externalWallet", "discord", "x", "customId", "guestId"];
3
+ export type AuthType = 'email' | 'phone' | 'phoneLegacy' | 'farcaster' | 'telegram' | 'userId' | 'externalWallet' | 'discord' | 'x' | 'customId' | 'guestId';
4
4
  export type PrimaryAuthType = Extract<AuthType, 'email' | 'phone' | 'farcaster' | 'telegram' | 'externalWallet'>;
5
5
  export type VerifiedAuthType = Extract<PrimaryAuthType, 'email' | 'phone' | 'externalWallet'>;
6
6
  export type PregenAuthType = Exclude<PrimaryAuthType, 'externalWallet'> | Extract<AuthType, 'discord' | 'x' | 'customId'>;
@@ -41,12 +41,15 @@ export type Auth<T extends AuthType = AuthType> = T extends 'email' ? {
41
41
  discordUsername: AuthIdentifier<'discord'>;
42
42
  } : T extends 'customId' ? {
43
43
  customId: AuthIdentifier<'customId'>;
44
+ } : T extends 'guestId' ? {
45
+ guestId: AuthIdentifier<'guestId'>;
44
46
  } : {
45
47
  userId: AuthIdentifier<'userId'>;
46
48
  };
47
49
  export type PrimaryAuth = Auth<PrimaryAuthType>;
48
50
  export type VerifiedAuth = Auth<VerifiedAuthType>;
49
51
  export type PregenAuth = Auth<PregenAuthType>;
52
+ export type PregenOrGuestAuth = Auth<PregenAuthType | 'guestId'>;
50
53
  export type AuthExtras = {
51
54
  /**
52
55
  * The current user's third-party username.
@@ -97,6 +100,7 @@ export interface EncryptedKeyShare {
97
100
  partnerId?: string;
98
101
  protocolId?: string;
99
102
  }
103
+ /** @deprecated use the string union type `TOAuthMethod` instead */
100
104
  export declare enum OAuthMethod {
101
105
  GOOGLE = "GOOGLE",
102
106
  TWITTER = "TWITTER",
@@ -106,6 +110,11 @@ export declare enum OAuthMethod {
106
110
  FARCASTER = "FARCASTER",
107
111
  TELEGRAM = "TELEGRAM"
108
112
  }
113
+ export declare const OAUTH_METHODS: readonly ["GOOGLE", "TWITTER", "APPLE", "DISCORD", "FACEBOOK", "FARCASTER", "TELEGRAM"];
114
+ export type TOAuthMethod = (typeof OAUTH_METHODS)[number];
115
+ export declare const LINKED_ACCOUNT_TYPES: readonly ["EMAIL", "PHONE", "GOOGLE", "FACEBOOK", "APPLE", "TWITTER", "DISCORD", "TELEGRAM", "FARCASTER", "EXTERNAL_WALLET"];
116
+ export type TLinkedAccountType = (typeof LINKED_ACCOUNT_TYPES)[number] | 'EXTERNAL_WALLET';
117
+ export type SupportedAccountLinks = (TLinkedAccountType | TExternalWallet)[];
109
118
  export declare enum AuthMethod {
110
119
  PASSWORD = "PASSWORD",
111
120
  PASSKEY = "PASSKEY"
@@ -136,6 +145,7 @@ export type SessionInfo = {
136
145
  cosmosPrefix?: string;
137
146
  origin?: string;
138
147
  email?: string;
148
+ verifiedExternalWalletAddresses?: string[];
139
149
  };
140
150
  export type ServerAuthStateBase = AuthExtras & {
141
151
  auth: PrimaryAuth;
@@ -153,14 +163,20 @@ export type ServerAuthStateLogin = ServerAuthStateBase & {
153
163
  stage: 'login';
154
164
  biometricHints?: BiometricLocationHint[];
155
165
  loginAuthMethods: AuthMethod[];
166
+ isWalletSelectionNeeded?: boolean;
156
167
  };
157
168
  export type VerifyThirdPartyAuth = ServerAuthStateSignup | ServerAuthStateLogin;
158
169
  export type ExternalWalletInfo = {
159
170
  address: string;
160
171
  type: ExternalWalletType;
161
172
  provider?: string;
173
+ providerId?: TExternalWallet;
162
174
  addressBech32?: string;
163
175
  withFullParaAuth?: boolean;
176
+ ensName?: string | null;
177
+ ensAvatar?: string | null;
178
+ isConnectionOnly?: boolean;
179
+ withVerification?: boolean;
164
180
  };
165
181
  export type VerifyExternalWalletParams = {
166
182
  /**
@@ -200,3 +216,48 @@ export type Setup2faResponse = {
200
216
  */
201
217
  uri: string;
202
218
  };
219
+ export type AccountMetadataKey = Lowercase<Exclude<TOAuthMethod, 'TWITTER'> | 'X'>;
220
+ export type AccountMetadata = Partial<Record<AccountMetadataKey, {
221
+ date: Date;
222
+ metadata: Record<string, any>;
223
+ }>>;
224
+ export type IssueJwtParams = {
225
+ /**
226
+ * The index of the Para RSA keypair to use for signing the JWT. Defaults to `0`.
227
+ */
228
+ keyIndex?: number;
229
+ };
230
+ export type IssueJwtResponse = {
231
+ /**
232
+ * The Para JWT token.
233
+ */
234
+ token: string;
235
+ /**
236
+ * The `keyid`` / `kid` of the keypair used to sign the JWT.
237
+ */
238
+ keyId: string;
239
+ };
240
+ export type LinkedAccount<D extends Date | string = Date> = {
241
+ id?: string;
242
+ date: D;
243
+ type: TLinkedAccountType;
244
+ identifier: string;
245
+ displayName: string;
246
+ externalWallet?: ExternalWalletInfo;
247
+ metadata?: unknown;
248
+ };
249
+ export type LinkedAccounts<D extends Date | string = Date> = {
250
+ primary: LinkedAccount<D>[];
251
+ linked: LinkedAccount<D>[];
252
+ };
253
+ export type LinkAccountParams = {
254
+ type: TLinkedAccountType;
255
+ identifier?: string;
256
+ externalWallet?: ExternalWalletInfo;
257
+ };
258
+ export type VerifyLinkParams = {
259
+ linkedAccountId: string;
260
+ userId: string;
261
+ telegramAuthResponse?: TelegramAuthResponse;
262
+ verificationCode?: string;
263
+ };
@@ -20,3 +20,8 @@ export interface BackupKitEmailProps {
20
20
  supportUrl?: string;
21
21
  brandColor?: string;
22
22
  }
23
+ export type ResendVerificationCodeParams = VerificationEmailProps & {
24
+ userId: string;
25
+ type?: 'EMAIL' | 'PHONE';
26
+ linkedAccountId?: string;
27
+ };
@@ -1,4 +1,4 @@
1
- import { Network, WalletType } from './wallet.js';
1
+ import { Network, TWalletType } from './wallet.js';
2
2
  export declare enum OnRampProvider {
3
3
  RAMP = "RAMP",
4
4
  STRIPE = "STRIPE",
@@ -14,7 +14,8 @@ export declare enum OnRampAsset {
14
14
  CELO = "CELO",
15
15
  CUSD = "CUSD",
16
16
  CEUR = "CEUR",
17
- CREAL = "CREAL"
17
+ CREAL = "CREAL",
18
+ BERA = "BERA"
18
19
  }
19
20
  export declare enum OnRampPurchaseStatus {
20
21
  INITIATED = "INITIATED",
@@ -30,7 +31,7 @@ export interface OnRampPurchase {
30
31
  userId: string;
31
32
  type?: OnRampPurchaseType;
32
33
  walletId?: string | null;
33
- walletType?: WalletType;
34
+ walletType?: TWalletType;
34
35
  externalWalletAddress?: string | null;
35
36
  address?: string | null;
36
37
  status?: OnRampPurchaseStatus;
@@ -51,7 +52,7 @@ export type OnRampPurchaseCreateParams = Omit<OnRampPurchase, 'id' | 'userId'> &
51
52
  };
52
53
  export type OnRampPurchaseUpdateParams = Omit<OnRampPurchase, 'id' | 'userId'>;
53
54
  type ProviderAssetInfo = [string, Partial<Record<OnRampPurchaseType, boolean>>];
54
- export type OnRampAssetInfo = Record<WalletType, Partial<Record<Network, Partial<Record<OnRampAsset, Partial<Record<OnRampProvider, ProviderAssetInfo>>>>>>>;
55
+ export type OnRampAssetInfo = Record<TWalletType, Partial<Record<Network, Partial<Record<OnRampAsset, Partial<Record<OnRampProvider, ProviderAssetInfo>>>>>>>;
55
56
  export type OnRampAllowedAssets = Partial<Record<Network, true | OnRampAsset[]>>;
56
57
  export type OnRampConfig = {
57
58
  isBuyEnabled: boolean;
@@ -1,4 +1,4 @@
1
- import { AuthMethod } from './auth.js';
1
+ import { AuthMethod, SupportedAccountLinks } from './auth.js';
2
2
  import { SupportedWalletTypes } from './wallet.js';
3
3
  export interface PartnerEntity {
4
4
  id: string;
@@ -16,5 +16,6 @@ export interface PartnerEntity {
16
16
  portalUrl?: string;
17
17
  supportedAuthMethods?: AuthMethod[];
18
18
  supportedWalletTypes?: SupportedWalletTypes;
19
+ supportedAccountLinks?: SupportedAccountLinks;
19
20
  cosmosPrefix?: string;
20
21
  }
@@ -1,14 +1,20 @@
1
1
  import { PartnerEntity } from './partner.js';
2
+ /** @deprecated use the string union type `TWalletScheme` instead */
2
3
  export declare enum WalletScheme {
3
4
  DKLS = "DKLS",
4
5
  CGGMP = "CGGMP",
5
6
  ED25519 = "ED25519"
6
7
  }
8
+ export declare const WALLET_SCHEMES: readonly ["DKLS", "CGGMP", "ED25519"];
9
+ export type TWalletScheme = (typeof WALLET_SCHEMES)[number];
10
+ /** @deprecated use the string union type `TWalletType` instead */
7
11
  export declare enum WalletType {
8
12
  EVM = "EVM",
9
13
  SOLANA = "SOLANA",
10
14
  COSMOS = "COSMOS"
11
15
  }
16
+ export declare const WALLET_TYPES: readonly ["EVM", "SOLANA", "COSMOS"];
17
+ export type TWalletType = (typeof WALLET_TYPES)[number];
12
18
  export declare enum Chain {
13
19
  ETH = "ETH",
14
20
  CELO = "CELO",
@@ -24,16 +30,18 @@ export declare enum Network {
24
30
  SOLANA = "SOLANA",
25
31
  COSMOS = "COSMOS",
26
32
  CELO = "CELO",
27
- NOBLE = "NOBLE"
33
+ NOBLE = "NOBLE",
34
+ SOLANA_DEVNET = "SOLANA_DEVNET",
35
+ BERACHAIN = "BERACHAIN"
28
36
  }
29
37
  export type WalletRef = 'walletId' | 'externalWalletAddress';
30
38
  export type WalletParams = Partial<{
31
39
  walletId?: string;
32
40
  externalWalletAddress?: string;
33
41
  }>;
34
- export type EmbeddedWalletType = Exclude<WalletType, never>;
35
- export type ExternalWalletType = Exclude<WalletType, never>;
36
- export declare const PREGEN_IDENTIFIER_TYPES: readonly ["EMAIL", "PHONE", "CUSTOM_ID", "DISCORD", "TWITTER", "TELEGRAM", "FARCASTER"];
42
+ export type EmbeddedWalletType = Exclude<TWalletType, never>;
43
+ export type ExternalWalletType = Exclude<TWalletType, never>;
44
+ export declare const PREGEN_IDENTIFIER_TYPES: readonly ["EMAIL", "PHONE", "CUSTOM_ID", "GUEST_ID", "DISCORD", "TWITTER", "TELEGRAM", "FARCASTER"];
37
45
  export type TPregenIdentifierType = (typeof PREGEN_IDENTIFIER_TYPES)[number];
38
46
  export type PregenIds = Partial<Record<TPregenIdentifierType, string[]>>;
39
47
  export interface WalletEntity {
@@ -49,16 +57,23 @@ export interface WalletEntity {
49
57
  partner?: PartnerEntity;
50
58
  publicKey: string | null;
51
59
  scheme: string;
52
- type: WalletType;
60
+ type: TWalletType;
53
61
  updatedAt: string;
54
62
  userId: string | null;
55
63
  lastUsedAt: string | null;
56
64
  lastUsedPartnerId?: string;
57
65
  lastUsedPartner?: PartnerEntity;
66
+ ensName?: string | null;
67
+ ensAvatar?: string | null;
58
68
  }
59
- export type CurrentWalletIds = Partial<Record<WalletType, string[]>>;
60
- export declare const NON_ED25519: WalletScheme[];
69
+ export type CurrentWalletIds = Partial<Record<TWalletType, string[]>>;
70
+ export declare const NON_ED25519: string[];
61
71
  export type SupportedWalletTypes = {
62
- type: WalletType;
72
+ type: TWalletType;
63
73
  optional?: boolean;
64
74
  }[];
75
+ export declare const EVM_WALLETS: readonly ["METAMASK", "RAINBOW", "COINBASE", "WALLETCONNECT", "FARCASTER", "ZERION", "SAFE", "RABBY", "OKX", "HAHA", "BACKPACK", "PHANTOM", "VALORA"];
76
+ export declare const SOLANA_WALLETS: readonly ["PHANTOM", "GLOW", "BACKPACK", "SOLFLARE"];
77
+ export declare const COSMOS_WALLETS: readonly ["KEPLR", "LEAP", "COSMOSTATION"];
78
+ export declare const EXTERNAL_WALLET_TYPES: readonly ("FARCASTER" | "METAMASK" | "RAINBOW" | "COINBASE" | "WALLETCONNECT" | "ZERION" | "SAFE" | "RABBY" | "OKX" | "HAHA" | "BACKPACK" | "PHANTOM" | "VALORA" | "GLOW" | "SOLFLARE" | "KEPLR" | "LEAP" | "COSMOSTATION")[];
79
+ export type TExternalWallet = (typeof EXTERNAL_WALLET_TYPES)[number];
@@ -1,5 +1,5 @@
1
1
  import { Auth, AuthInfo, AuthParams, PrimaryAuth, PrimaryAuthInfo, VerifiedAuth, WalletParams, WalletRef } from './types/index.js';
2
- import { PregenAuth, PregenAuthInfo } from './types/auth.js';
2
+ import { AccountMetadata, AccountMetadataKey, LinkedAccounts, PregenAuth, PregenAuthInfo, PregenOrGuestAuth } from './types/auth.js';
3
3
  import { PregenIds, TPregenIdentifierType } from './types/wallet.js';
4
4
  export declare function isWalletId(params: WalletParams): params is {
5
5
  walletId: string;
@@ -17,6 +17,7 @@ export declare function isExternalWallet(params: AuthParams | undefined): params
17
17
  export declare function isX(params: AuthParams | undefined): params is Auth<'x'>;
18
18
  export declare function isDiscord(params: AuthParams | undefined): params is Auth<'discord'>;
19
19
  export declare function isCustomId(params: AuthParams | undefined): params is Auth<'customId'>;
20
+ export declare function isGuestId(params: AuthParams | undefined): params is Auth<'guestId'>;
20
21
  export declare function isUserId(params: AuthParams | undefined): params is Auth<'userId'>;
21
22
  export declare function isPrimary(params: AuthParams | undefined): params is PrimaryAuth;
22
23
  export declare function isVerifiedAuth(params: AuthParams | undefined): params is VerifiedAuth;
@@ -48,6 +49,11 @@ export declare function extractAuthInfo(obj: AuthParams, opts: ExtractAuthOpts &
48
49
  allowPregen: true;
49
50
  isRequired: true;
50
51
  }): PregenAuthInfo;
51
- export declare function toPregenTypeAndId(auth: PregenAuth): [TPregenIdentifierType, string];
52
+ export declare function toPregenTypeAndId(auth: PregenOrGuestAuth): [TPregenIdentifierType, string];
52
53
  export declare function toPregenIds(auth: PregenAuth): PregenIds;
54
+ export declare function fromAccountMetadata(obj: Partial<Record<AccountMetadataKey, {
55
+ date: string;
56
+ metadata: object;
57
+ }>> | undefined): AccountMetadata;
58
+ export declare function fromLinkedAccounts({ primary, linked }: LinkedAccounts<string>): LinkedAccounts<Date>;
53
59
  export {};
package/package.json CHANGED
@@ -1,31 +1,13 @@
1
1
  {
2
2
  "name": "@getpara/user-management-client",
3
- "version": "2.0.0-alpha.3",
4
- "main": "dist/cjs/index.js",
5
- "module": "dist/esm/index.js",
6
- "types": "dist/types/index.d.ts",
7
- "typings": "dist/types/index.d.ts",
8
- "sideEffects": false,
9
- "scripts": {
10
- "build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
11
- "old-build": "yarn build:cjs && yarn build:esm && yarn build:types",
12
- "build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
13
- "build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && printf '{\"type\":\"module\",\"sideEffects\":false}' > dist/esm/package.json",
14
- "build:types": "rm -rf dist/types && tsc --module es6 --declarationDir dist/types --emitDeclarationOnly --declaration",
15
- "test": "vitest run --coverage"
16
- },
3
+ "version": "2.0.0-alpha.30",
17
4
  "dependencies": {
18
- "axios": "^1.6.3",
19
- "libphonenumber-js": "1.11.2",
20
- "qs": "^6.12.0"
5
+ "axios": "^1.8.4",
6
+ "libphonenumber-js": "^1.11.7"
21
7
  },
22
8
  "devDependencies": {
23
- "typescript": "^5.0.4"
9
+ "typescript": "^5.8.3"
24
10
  },
25
- "files": [
26
- "dist",
27
- "package.json"
28
- ],
29
11
  "exports": {
30
12
  ".": {
31
13
  "types": "./dist/types/index.d.ts",
@@ -33,5 +15,22 @@
33
15
  "require": "./dist/cjs/index.js"
34
16
  }
35
17
  },
36
- "gitHead": "77a1e04b06258842ca9c81e3db2a2b0092517659"
18
+ "files": [
19
+ "dist",
20
+ "package.json"
21
+ ],
22
+ "gitHead": "8b06219b9c248a3fbdbd05dc7501e8042c369301",
23
+ "main": "dist/cjs/index.js",
24
+ "module": "dist/esm/index.js",
25
+ "scripts": {
26
+ "build": "rm -rf dist && node ./scripts/build.mjs && yarn build:types",
27
+ "build:cjs": "rm -rf dist/cjs && tsc --module commonjs --outDir dist/cjs && printf '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
28
+ "build:esm": "rm -rf dist/esm && tsc --module es6 --outDir dist/esm && printf '{\"type\":\"module\",\"sideEffects\":false}' > dist/esm/package.json",
29
+ "build:types": "rm -rf dist/types && tsc --module es6 --declarationDir dist/types --emitDeclarationOnly --declaration",
30
+ "old-build": "yarn build:cjs && yarn build:esm && yarn build:types",
31
+ "test": "vitest run --coverage"
32
+ },
33
+ "sideEffects": false,
34
+ "types": "dist/types/index.d.ts",
35
+ "typings": "dist/types/index.d.ts"
37
36
  }
Binary file
Binary file
Binary file
Binary file