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

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/index.js CHANGED
@@ -1,38 +1,9 @@
1
1
  var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __getProtoOf = Object.getPrototypeOf;
9
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __objRest = (source, exclude) => {
25
- var target = {};
26
- for (var prop in source)
27
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
- target[prop] = source[prop];
29
- if (source != null && __getOwnPropSymbols)
30
- for (var prop of __getOwnPropSymbols(source)) {
31
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
- target[prop] = source[prop];
33
- }
34
- return target;
35
- };
36
7
  var __export = (target, all) => {
37
8
  for (var name in all)
38
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -45,6 +16,7 @@ var __copyProps = (to, from, except, desc) => {
45
16
  }
46
17
  return to;
47
18
  };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
48
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
49
21
  // If the importer is in node compatibility mode or this is not an ESM
50
22
  // file that has been converted to a CommonJS file using a Babel-
@@ -54,1270 +26,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
54
26
  mod
55
27
  ));
56
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
57
- var __async = (__this, __arguments, generator) => {
58
- return new Promise((resolve, reject) => {
59
- var fulfilled = (value) => {
60
- try {
61
- step(generator.next(value));
62
- } catch (e) {
63
- reject(e);
64
- }
65
- };
66
- var rejected = (value) => {
67
- try {
68
- step(generator.throw(value));
69
- } catch (e) {
70
- reject(e);
71
- }
72
- };
73
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
74
- step((generator = generator.apply(__this, __arguments)).next());
75
- });
76
- };
77
-
78
- // src/index.ts
79
29
  var src_exports = {};
80
30
  __export(src_exports, {
81
- AUTH_TYPES: () => AUTH_TYPES,
82
- AuthMethod: () => AuthMethod,
83
- Chain: () => Chain,
84
- EmailTheme: () => EmailTheme,
85
- EncryptorType: () => EncryptorType,
86
- KeyShareType: () => KeyShareType,
87
- NON_ED25519: () => NON_ED25519,
88
- Network: () => Network,
89
- OAuthMethod: () => OAuthMethod,
90
- OnRampAsset: () => OnRampAsset,
91
- OnRampProvider: () => OnRampProvider,
92
- OnRampPurchaseStatus: () => OnRampPurchaseStatus,
93
- OnRampPurchaseType: () => OnRampPurchaseType,
94
- PREGEN_IDENTIFIER_TYPES: () => PREGEN_IDENTIFIER_TYPES,
95
- ParaApiError: () => ParaApiError,
96
- PasswordStatus: () => PasswordStatus,
97
- PublicKeyStatus: () => PublicKeyStatus,
98
- PublicKeyType: () => PublicKeyType,
99
- WalletScheme: () => WalletScheme,
100
- WalletType: () => WalletType,
101
- default: () => src_default,
102
- extractAuthInfo: () => extractAuthInfo,
103
- extractWalletRef: () => extractWalletRef,
104
- handleResponseError: () => handleResponseError,
105
- handleResponseSuccess: () => handleResponseSuccess,
106
- isCustomId: () => isCustomId,
107
- isDiscord: () => isDiscord,
108
- isEmail: () => isEmail,
109
- isExternalWallet: () => isExternalWallet,
110
- isExternalWalletAddress: () => isExternalWalletAddress,
111
- isFarcaster: () => isFarcaster,
112
- isPhone: () => isPhone,
113
- isPhoneLegacy: () => isPhoneLegacy,
114
- isPregenAuth: () => isPregenAuth,
115
- isPrimary: () => isPrimary,
116
- isTelegram: () => isTelegram,
117
- isUserId: () => isUserId,
118
- isVerifiedAuth: () => isVerifiedAuth,
119
- isWalletId: () => isWalletId,
120
- isX: () => isX,
121
- toPregenIds: () => toPregenIds,
122
- toPregenTypeAndId: () => toPregenTypeAndId
31
+ default: () => src_default
123
32
  });
124
33
  module.exports = __toCommonJS(src_exports);
125
-
126
- // src/client.ts
127
- var import_axios = __toESM(require("axios"));
128
- var import_qs = __toESM(require("qs"));
129
-
130
- // src/utils.ts
131
- var import_libphonenumber_js = __toESM(require("libphonenumber-js"));
132
- function isWalletId(params) {
133
- return !!params.walletId && !params.externalWalletAddress;
134
- }
135
- function isExternalWalletAddress(params) {
136
- return !!params.externalWalletAddress && !params.walletId;
137
- }
138
- function extractWalletRef(params) {
139
- if (isWalletId(params)) {
140
- return ["walletId", params.walletId];
141
- } else if (isExternalWalletAddress(params)) {
142
- return ["externalWalletAddress", params.externalWalletAddress];
143
- }
144
- throw new Error("invalid wallet params");
145
- }
146
- function isValid(s) {
147
- return !!s && s !== "null" && s !== "undefined" && s !== "";
148
- }
149
- function isEmail(params) {
150
- return !!params && isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
151
- }
152
- function isPhone(params) {
153
- return !!params && isValid(params.phone) && /^\+\d+$/.test(params.phone) && !isValid(params.countryCode) && !isValid(params.email) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.userId) && !isValid(params.externalWalletAddress);
154
- }
155
- function isPhoneLegacy(params) {
156
- return !!params && isValid(params.phone) && isValid(params.countryCode) && !isValid(params.email) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
157
- }
158
- function isFarcaster(params) {
159
- return !!params && isValid(params.farcasterUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
160
- }
161
- function isTelegram(params) {
162
- return !!params && isValid(params.telegramUserId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
163
- }
164
- function isExternalWallet(params) {
165
- return !!params && isValid(params.externalWalletAddress) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId);
166
- }
167
- function isX(params) {
168
- return !!params && isValid(params.xUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
169
- }
170
- function isDiscord(params) {
171
- return !!params && isValid(params.discordUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
172
- }
173
- function isCustomId(params) {
174
- return !!params && isValid(params.customId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.externalWalletAddress);
175
- }
176
- function isUserId(params) {
177
- return !!params && isValid(params.userId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.telegramUserId) && !isValid(params.externalWalletAddress);
178
- }
179
- function isPrimary(params) {
180
- return isEmail(params) || isPhone(params) || isFarcaster(params) || isTelegram(params) || isExternalWallet(params);
181
- }
182
- function isVerifiedAuth(params) {
183
- return isEmail(params) || isPhone(params);
184
- }
185
- function isPregenAuth(params) {
186
- return isPrimary(params) && !isExternalWallet(params) || isX(params) || isDiscord(params) || isCustomId(params);
187
- }
188
- function extractAuthInfo(obj, { allowUserId = false, allowPregen = false, isRequired = false } = {}) {
189
- obj = Object.entries(obj || {}).reduce((acc, [k, v]) => {
190
- return __spreadValues(__spreadValues({}, acc), !!v && v !== "null" && v !== "undefined" && v !== "" ? { [k]: v } : {});
191
- }, {});
192
- let error;
193
- switch (true) {
194
- case isEmail(obj):
195
- return {
196
- auth: { email: obj.email },
197
- authType: "email",
198
- identifier: obj.email
199
- };
200
- case isPhone(obj):
201
- if (!(0, import_libphonenumber_js.default)(obj.phone)) {
202
- error = "invalid phone number";
203
- break;
204
- }
205
- return {
206
- auth: { phone: obj.phone },
207
- authType: "phone",
208
- identifier: obj.phone
209
- };
210
- case isPhoneLegacy(obj):
211
- const identifier = `${obj.countryCode.startsWith("+") ? "" : "+"}${obj.countryCode}${obj.phone}`;
212
- if (!(0, import_libphonenumber_js.default)(identifier)) {
213
- error = "invalid phone number";
214
- break;
215
- }
216
- return {
217
- auth: { phone: identifier },
218
- authType: "phone",
219
- identifier
220
- };
221
- case isFarcaster(obj):
222
- return {
223
- auth: { farcasterUsername: obj.farcasterUsername },
224
- authType: "farcaster",
225
- identifier: obj.farcasterUsername
226
- };
227
- case isTelegram(obj):
228
- return {
229
- auth: { telegramUserId: obj.telegramUserId },
230
- authType: "telegram",
231
- identifier: obj.telegramUserId
232
- };
233
- case isExternalWallet(obj):
234
- return {
235
- auth: { externalWalletAddress: obj.externalWalletAddress },
236
- authType: "externalWallet",
237
- identifier: obj.externalWalletAddress
238
- };
239
- case (allowPregen && isX(obj)):
240
- return {
241
- auth: { xUsername: obj.xUsername },
242
- authType: "x",
243
- identifier: obj.xUsername
244
- };
245
- case (allowPregen && isDiscord(obj)):
246
- return {
247
- auth: { discordUsername: obj.discordUsername },
248
- authType: "discord",
249
- identifier: obj.discordUsername
250
- };
251
- case (allowPregen && isCustomId(obj)):
252
- return {
253
- auth: { customId: obj.customId },
254
- authType: "customId",
255
- identifier: obj.customId
256
- };
257
- case (isUserId(obj) && allowUserId):
258
- return {
259
- auth: { userId: obj.userId },
260
- authType: "userId",
261
- identifier: obj.userId
262
- };
263
- default:
264
- break;
265
- }
266
- if (isRequired) {
267
- throw new Error(error != null ? error : "invalid auth object");
268
- }
269
- return void 0;
270
- }
271
- function toPregenTypeAndId(auth) {
272
- const { authType, identifier: pregenIdentifier } = extractAuthInfo(auth, { isRequired: true, allowPregen: true });
273
- const pregenIdentifierType = {
274
- email: "EMAIL",
275
- phone: "PHONE",
276
- farcaster: "FARCASTER",
277
- telegram: "TELEGRAM",
278
- discord: "DISCORD",
279
- x: "TWITTER",
280
- customId: "CUSTOM_ID"
281
- }[authType];
282
- return [pregenIdentifierType, pregenIdentifier];
283
- }
284
- function toPregenIds(auth) {
285
- const [pregenIdentifierType, pregenIdentifier] = toPregenTypeAndId(auth);
286
- return { [pregenIdentifierType]: [pregenIdentifier] };
287
- }
288
-
289
- // src/consts.ts
290
- var SESSION_COOKIE_HEADER_NAME = "x-capsule-sid";
291
- var VERSION_HEADER_NAME = "x-para-version";
292
- var PARTNER_ID_HEADER_NAME = "x-partner-id";
293
- var API_KEY_HEADER_NAME = "X-External-API-Key";
294
-
295
- // src/error.ts
296
- function ParaApiError(message, code, status, responseURL) {
297
- Error.call(this);
298
- if (Error.captureStackTrace) {
299
- Error.captureStackTrace(this, this.constructor);
300
- } else {
301
- this.stack = new Error().stack;
302
- }
303
- this.message = message;
304
- this.name = "ParaApiError";
305
- code && (this.code = code);
306
- status && (this.status = status);
307
- responseURL && (this.responseURL = responseURL);
308
- }
309
- var prototype = ParaApiError.prototype;
310
- Object.defineProperty(prototype, "isParaApiError", { value: true });
311
-
312
- // src/client.ts
313
- var handleResponseSuccess = (response) => {
314
- if (response.status === 200) {
315
- return response;
316
- }
317
- throw new ParaApiError("Invalid status code");
318
- };
319
- var handleResponseError = (error) => {
320
- var _a, _b, _c;
321
- if (error === null) throw new ParaApiError("Error is null");
322
- if (import_axios.default.isAxiosError(error)) {
323
- let message = (_b = (_a = error.response) == null ? void 0 : _a.data) != null ? _b : "Unknown error";
324
- if (error.code === "ERR_NETWORK") {
325
- message = "Connection error";
326
- } else if (error.code === "ERR_CANCELED") {
327
- message = "Connection canceled";
328
- }
329
- throw new ParaApiError(message, error.code, error.response.status, (_c = error.request) == null ? void 0 : _c.responseURL);
330
- }
331
- throw new ParaApiError("Unknown error");
332
- };
333
- var Client = class {
334
- constructor({
335
- userManagementHost,
336
- apiKey,
337
- partnerId,
338
- version,
339
- opts,
340
- retrieveSessionCookie,
341
- persistSessionCookie
342
- }) {
343
- this.signUpOrLogIn = (body) => __async(this, null, function* () {
344
- const res = yield this.baseRequest.post(`/users/init`, body);
345
- return res.data;
346
- });
347
- /**
348
- * @deprecated
349
- */
350
- this.createUser = (body) => __async(this, null, function* () {
351
- const res = yield this.baseRequest.post(`/users`, body);
352
- return res.data;
353
- });
354
- this.checkUserExists = (auth) => __async(this, null, function* () {
355
- const res = yield this.baseRequest.get("/users/exists", {
356
- params: __spreadValues({}, auth)
357
- });
358
- return res;
359
- });
360
- this.verifyTelegram = (authObject) => __async(this, null, function* () {
361
- return (yield this.baseRequest.post("/users/telegram/v2", {
362
- authObject
363
- })).data;
364
- });
365
- this.verifyOAuth = () => __async(this, null, function* () {
366
- const res = yield this.baseRequest.post("/users/verify-oauth");
367
- return res.data;
368
- });
369
- this.loginExternalWallet = (_0) => __async(this, [_0], function* ({
370
- externalWallet,
371
- shouldTrackUser
372
- }) {
373
- const res = yield this.baseRequest.post(`/users/external-wallets/login/v2`, {
374
- externalWallet,
375
- shouldTrackUser
376
- });
377
- return res.data;
378
- });
379
- this.verifyNewAccount = (userId, body) => __async(this, null, function* () {
380
- const res = yield this.baseRequest.post(`/users/${userId}/verify`, body);
381
- return res.data;
382
- });
383
- // POST /users/:userId/verify-email
384
- /**
385
- * @deprecated
386
- */
387
- this.verifyEmail = (userId, body) => __async(this, null, function* () {
388
- const res = yield this.baseRequest.post(`/users/${userId}/verify-email`, body);
389
- return res;
390
- });
391
- /**
392
- * @deprecated
393
- */
394
- this.verifyPhone = (userId, body) => __async(this, null, function* () {
395
- const res = yield this.baseRequest.post(`/users/${userId}/verify-identifier`, body);
396
- return res;
397
- });
398
- this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
399
- const res = yield this.baseRequest.post(`/users/${userId}/external-wallets/verify/v2`, body);
400
- return res.data;
401
- });
402
- // POST /users/:userId/biometrics/key
403
- this.addSessionPublicKey = (userId, body) => __async(this, null, function* () {
404
- const res = yield this.baseRequest.post(`/users/${userId}/biometrics/key`, body);
405
- return res;
406
- });
407
- // GET /users/:userId/biometrics/keys
408
- this.getSessionPublicKeys = (userId) => __async(this, null, function* () {
409
- const res = yield this.baseRequest.get(`/users/${userId}/biometrics/keys`);
410
- return res;
411
- });
412
- // GET /biometrics/location-hints
413
- this.getBiometricLocationHints = (auth) => __async(this, null, function* () {
414
- const res = yield this.baseRequest.get(`/biometrics/location-hints`, {
415
- params: auth
416
- });
417
- return res.data.hints;
418
- });
419
- // GET /users/:userId/biometrics/:biometricId
420
- this.getSessionPublicKey = (userId, biometricId) => __async(this, null, function* () {
421
- const res = yield this.baseRequest.get(`/users/${userId}/biometrics/${biometricId}`);
422
- return res;
423
- });
424
- // PATCH /users/:userId/biometrics/:biometricId
425
- this.patchSessionPublicKey = (partnerId, userId, biometricId, body) => __async(this, null, function* () {
426
- const res = yield this.baseRequest.patch(`/users/${userId}/biometrics/${biometricId}`, body, {
427
- headers: {
428
- [PARTNER_ID_HEADER_NAME]: partnerId
429
- }
430
- });
431
- return res;
432
- });
433
- // GET /biometrics/challenge?email&publicKey
434
- this.getWebChallenge = (auth) => __async(this, null, function* () {
435
- const res = yield this.baseRequest.get("/biometrics/challenge", {
436
- params: __spreadValues({}, auth || {})
437
- });
438
- return res.data;
439
- });
440
- // POST /touch
441
- this.touchSession = (regenerate) => __async(this, null, function* () {
442
- const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
443
- return res.data;
444
- });
445
- // GET /session/origin
446
- this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
447
- const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
448
- return res.data;
449
- });
450
- // POST /biometrics/verify
451
- this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
452
- const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
453
- headers: {
454
- [PARTNER_ID_HEADER_NAME]: partnerId
455
- }
456
- });
457
- return res;
458
- });
459
- // GET /users/:userId/biometrics/challenge
460
- this.getSessionChallenge = (userId) => __async(this, null, function* () {
461
- const res = yield this.baseRequest.get(`/users/${userId}/biometrics/challenge`);
462
- return res;
463
- });
464
- // POST /users/:userId/biometrics/verify
465
- this.verifySessionChallenge = (userId, body) => __async(this, null, function* () {
466
- const res = yield this.baseRequest.post(`/users/${userId}/biometrics/verify`, body);
467
- return res;
468
- });
469
- // POST /users/:userId/wallets
470
- this.createWallet = (userId, body) => __async(this, null, function* () {
471
- const res = yield this.baseRequest.post(`/users/${userId}/wallets`, body);
472
- return res.data;
473
- });
474
- // POST /wallets/pregen
475
- this.createPregenWallet = (body) => __async(this, null, function* () {
476
- const res = yield this.baseRequest.post(`/wallets/pregen`, body);
477
- return res.data;
478
- });
479
- this.getPregenWallets = (pregenIds, isPortal = false, userId) => __async(this, null, function* () {
480
- const res = yield this.baseRequest.get("/wallets/pregen", {
481
- params: { ids: pregenIds, expand: isPortal, userId }
482
- });
483
- return res.data;
484
- });
485
- this.claimPregenWallets = (body) => __async(this, null, function* () {
486
- const res = yield this.baseRequest.post(`/wallets/pregen/claim`, body);
487
- return res.data;
488
- });
489
- // POST /users/:userId/wallets/:walletId/transactions/send
490
- this.sendTransaction = (userId, walletId, body) => __async(this, null, function* () {
491
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/transactions/send`, body);
492
- return res;
493
- });
494
- // functionality changed to only sign transactions and not send them
495
- // POST /users/:userId/wallets/:walletId/transactions/sign
496
- this.signTransaction = (userId, walletId, body) => __async(this, null, function* () {
497
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/transactions/sign`, body);
498
- return res;
499
- });
500
- // POST /users/:userId/wallets/:walletId/refresh
501
- this.refreshKeys = (userId, walletId, oldPartnerId, newPartnerId, keyShareProtocolId) => __async(this, null, function* () {
502
- const body = { oldPartnerId, newPartnerId, keyShareProtocolId };
503
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/refresh`, body);
504
- return res;
505
- });
506
- // PATCH /wallets/pregen/:walletId
507
- this.updatePregenWallet = (walletId, body) => __async(this, null, function* () {
508
- const res = yield this.baseRequest.patch(`/wallets/pregen/${walletId}`, body);
509
- return res.data;
510
- });
511
- // GET /users/:userId/wallets
512
- this.getWallets = (userId, includePartnerData) => __async(this, null, function* () {
513
- const res = yield this.baseRequest.get(
514
- `/users/${userId}/wallets${includePartnerData ? `?includePartnerData=${encodeURIComponent(includePartnerData)}` : ""}`
515
- );
516
- return res;
517
- });
518
- // GET /users/:userId/all-wallets
519
- this.getAllWallets = (userId) => __async(this, null, function* () {
520
- const res = yield this.baseRequest.get(`/users/${userId}/all-wallets`);
521
- return res;
522
- });
523
- // POST /users/:userId/wallets/set
524
- this.setCurrentWalletIds = (userId, walletIds, needsWallet = false, sessionLookupId, newDeviceSessionLookupId) => __async(this, null, function* () {
525
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/set`, {
526
- walletIds,
527
- needsWallet,
528
- sessionLookupId,
529
- newDeviceSessionLookupId
530
- });
531
- return res;
532
- });
533
- // POST /login
534
- this.login = (props) => __async(this, null, function* () {
535
- const body = props;
536
- const res = yield this.baseRequest.post("/login", body);
537
- return res;
538
- });
539
- // POST /login
540
- this.verifyLogin = (verificationCode) => __async(this, null, function* () {
541
- const body = { verificationCode };
542
- const res = yield this.baseRequest.post("/login/verify-email", body);
543
- return res;
544
- });
545
- // GET /logout
546
- this.logout = () => __async(this, null, function* () {
547
- const res = yield this.baseRequest.get("/logout");
548
- return res;
549
- });
550
- // POST /recovery/verification
551
- this.recoveryVerification = (email, verificationCode) => __async(this, null, function* () {
552
- const body = { email, verificationCode };
553
- const res = yield this.baseRequest.post("/recovery/verification", body);
554
- return res;
555
- });
556
- // POST /recovery
557
- this.recoveryInit = (email) => __async(this, null, function* () {
558
- const body = { email };
559
- const res = yield this.baseRequest.post("/recovery", body);
560
- return res;
561
- });
562
- this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc) => __async(this, null, function* () {
563
- const body = { message, scheme, cosmosSignDoc };
564
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/messages/sign`, body);
565
- return res.data;
566
- });
567
- //DELETE /users/:userId
568
- this.deleteSelf = (userId) => __async(this, null, function* () {
569
- const res = yield this.baseRequest.delete(`/users/${userId}`);
570
- return res;
571
- });
572
- // GET /users/:userId/wallets/:walletId/capsule-share
573
- this.getParaShare = (userId, walletId) => __async(this, null, function* () {
574
- const res = yield this.baseRequest.get(`/users/${userId}/wallets/${walletId}/capsule-share`);
575
- return res.data.share;
576
- });
577
- // GET /download-backup-kit/:userId
578
- this.getBackupKit = (userId) => __async(this, null, function* () {
579
- const res = yield this.baseRequest.get(`/download-backup-kit/${userId}`, { responseType: "blob" });
580
- return res;
581
- });
582
- // PATCH /users/:userId/biometrics/:biometricId
583
- this.patchSessionPassword = (partnerId, userId, passwordId, body) => __async(this, null, function* () {
584
- const res = yield this.baseRequest.patch(`/users/${userId}/passwords/${passwordId}`, body, {
585
- headers: {
586
- [PARTNER_ID_HEADER_NAME]: partnerId
587
- }
588
- });
589
- return res;
590
- });
591
- const headers = __spreadValues(__spreadValues({}, apiKey && { [API_KEY_HEADER_NAME]: apiKey }), partnerId && { [PARTNER_ID_HEADER_NAME]: partnerId });
592
- const axiosConfig = {
593
- baseURL: userManagementHost,
594
- withCredentials: true,
595
- headers
596
- };
597
- if (retrieveSessionCookie) {
598
- const defaultTransformRequest = Array.isArray(import_axios.default.defaults.transformRequest) ? import_axios.default.defaults.transformRequest : [import_axios.default.defaults.transformRequest];
599
- axiosConfig.transformRequest = [
600
- function(data, headers2) {
601
- const currentSessionCookie = retrieveSessionCookie();
602
- if (currentSessionCookie) {
603
- headers2[SESSION_COOKIE_HEADER_NAME] = currentSessionCookie;
604
- }
605
- if (version) {
606
- headers2[VERSION_HEADER_NAME] = version;
607
- }
608
- return data;
609
- },
610
- ...defaultTransformRequest
611
- ];
612
- }
613
- if (persistSessionCookie) {
614
- const defaultTransformResponse = Array.isArray(import_axios.default.defaults.transformResponse) ? import_axios.default.defaults.transformResponse : [import_axios.default.defaults.transformResponse];
615
- axiosConfig.transformResponse = [
616
- ...defaultTransformResponse,
617
- function(data, headers2, _status) {
618
- if (headers2 == null ? void 0 : headers2[SESSION_COOKIE_HEADER_NAME]) {
619
- persistSessionCookie(headers2[SESSION_COOKIE_HEADER_NAME]);
620
- }
621
- return data;
622
- }
623
- ];
624
- }
625
- this.baseRequest = import_axios.default.create(axiosConfig);
626
- if (opts == null ? void 0 : opts.useFetchAdapter) {
627
- import_axios.default.defaults.adapter = function(config) {
628
- return fetch(config.baseURL + config.url.substring(1), {
629
- method: config.method,
630
- headers: config.headers,
631
- body: config.data,
632
- credentials: config.withCredentials ? "include" : void 0
633
- }).then(
634
- (response) => response.text().then((text) => ({
635
- data: text,
636
- status: response.status,
637
- statusText: response.statusText,
638
- headers: response.headers,
639
- config,
640
- request: fetch
641
- }))
642
- ).catch(function(reason) {
643
- throw reason;
644
- });
645
- };
646
- }
647
- this.baseRequest.interceptors.response.use(handleResponseSuccess, handleResponseError);
648
- }
649
- // DEPRECATED: use uploadUserKeyShares instead
650
- // POST /users/:userId/wallets/:walletId/key-shares
651
- uploadKeyshares(userId, walletId, encryptedKeyshares) {
652
- return __async(this, null, function* () {
653
- const body = { keyShares: encryptedKeyshares };
654
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/key-shares`, body);
655
- return res;
656
- });
657
- }
658
- // POST /users/:userId/key-shares
659
- uploadUserKeyShares(userId, encryptedKeyshares) {
660
- return __async(this, null, function* () {
661
- const body = { keyShares: encryptedKeyshares };
662
- const res = yield this.baseRequest.post(`/users/${userId}/key-shares`, body);
663
- return res;
664
- });
665
- }
666
- // GET /users/:userId/wallets/:walletId/key-shares
667
- getKeyshare(userId, walletId, type, encryptor) {
668
- return __async(this, null, function* () {
669
- const res = yield this.baseRequest.get(
670
- `/users/${userId}/wallets/${walletId}/key-shares?type=${type}${encryptor ? `&encryptor=${encryptor}` : ""}`
671
- );
672
- return res;
673
- });
674
- }
675
- // GET /users/:userId/biometrics/key-shares
676
- getBiometricKeyshares(userId, biometricPublicKey, getAll) {
677
- return __async(this, null, function* () {
678
- const res = yield this.baseRequest.get(
679
- `/users/${userId}/biometrics/key-shares?publicKey=${biometricPublicKey}&all=${!!getAll}`
680
- );
681
- return res;
682
- });
683
- }
684
- // GET /users/:userId/key-shares
685
- getPasswordKeyshares(userId, passwordId, getAll) {
686
- return __async(this, null, function* () {
687
- const res = yield this.baseRequest.get(
688
- `/users/${userId}/passwords/key-shares?passwordId=${passwordId}&all=${!!getAll}`
689
- );
690
- return res;
691
- });
692
- }
693
- // POST '/users/:userId/temporary-shares',
694
- uploadTransmissionKeyshares(userId, shares) {
695
- return __async(this, null, function* () {
696
- const body = { shares };
697
- const res = yield this.baseRequest.post(`/users/${userId}/temporary-shares`, body);
698
- return res;
699
- });
700
- }
701
- // GET /users/:userId/temporary-shares returns { temporaryShares: { userId: string, walletId: string, encryptedShare: string, encryptedKey?: string }[] }
702
- getTransmissionKeyshares(userId, sessionLookupId) {
703
- return __async(this, null, function* () {
704
- const res = yield this.baseRequest.get(`/users/${userId}/temporary-shares?sessionLookupId=${sessionLookupId}`);
705
- return res;
706
- });
707
- }
708
- // POST '/users/:userId/resend-verification-code
709
- resendVerificationCode(_a) {
710
- return __async(this, null, function* () {
711
- var _b = _a, { userId } = _b, rest = __objRest(_b, ["userId"]);
712
- const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest);
713
- return res;
714
- });
715
- }
716
- // POST '/users/:userId/resend-verification-code-by-phone
717
- resendVerificationCodeByPhone(_c) {
718
- return __async(this, null, function* () {
719
- var _d = _c, { userId } = _d, rest = __objRest(_d, ["userId"]);
720
- const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code-by-phone`, rest);
721
- return res;
722
- });
723
- }
724
- // POST recovery/cancel
725
- cancelRecoveryAttempt(email) {
726
- return __async(this, null, function* () {
727
- const res = yield this.baseRequest.post(`/recovery/cancel`, { email });
728
- return res;
729
- });
730
- }
731
- // GET '/2fa/users/:userId/check-status'
732
- check2FAStatus(userId) {
733
- return __async(this, null, function* () {
734
- const res = yield this.baseRequest.get(`/2fa/users/${userId}/check-status`);
735
- return res;
736
- });
737
- }
738
- // POST '/2fa/users/:userId/enable'
739
- enable2FA(userId, verificationCode) {
740
- return __async(this, null, function* () {
741
- const res = yield this.baseRequest.post(`/2fa/users/${userId}/enable`, { verificationCode });
742
- return res;
743
- });
744
- }
745
- setup2FA(userId) {
746
- return __async(this, null, function* () {
747
- const res = yield this.baseRequest.post(`/2fa/users/${userId}/setup`);
748
- return res.data;
749
- });
750
- }
751
- // POST /recovery/init
752
- initializeRecovery(email) {
753
- return __async(this, null, function* () {
754
- const res = yield this.baseRequest.post(`/recovery/init`, { email });
755
- return res;
756
- });
757
- }
758
- // POST /auth/farcaster/init
759
- initializeFarcasterLogin() {
760
- return __async(this, null, function* () {
761
- const res = yield this.baseRequest.post(`/auth/farcaster/init`);
762
- return res;
763
- });
764
- }
765
- getFarcasterAuthStatus() {
766
- return __async(this, null, function* () {
767
- const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`);
768
- return res.data;
769
- });
770
- }
771
- // POST /recovery/init
772
- initializeRecoveryForPhone(phone, countryCode) {
773
- return __async(this, null, function* () {
774
- const res = yield this.baseRequest.post(`/recovery/init`, { phone, countryCode });
775
- return res;
776
- });
777
- }
778
- // POST /recovery/users/:userId/wallets/:walletId/finish
779
- finalizeRecovery(userId, walletId) {
780
- return __async(this, null, function* () {
781
- const res = yield this.baseRequest.post(`/recovery/users/${userId}/wallets/${walletId}/finish`);
782
- return res;
783
- });
784
- }
785
- // GET /recovery/users/:userId/wallets/:walletId/key-shares
786
- recoverUserShares(userId, walletId) {
787
- return __async(this, null, function* () {
788
- const res = yield this.baseRequest.get(`/recovery/users/${userId}/wallets/${walletId}/key-shares?type=USER&encryptor=RECOVERY`);
789
- return res;
790
- });
791
- }
792
- // POST /recovery/verify-email
793
- verifyEmailForRecovery(email, verificationCode) {
794
- return __async(this, null, function* () {
795
- const body = { email, verificationCode };
796
- const res = yield this.baseRequest.post(`/recovery/verify-email`, body);
797
- return res;
798
- });
799
- }
800
- // POST /recovery/verify-identifier
801
- verifyPhoneForRecovery(phone, countryCode, verificationCode) {
802
- return __async(this, null, function* () {
803
- const body = { phone, countryCode, verificationCode };
804
- const res = yield this.baseRequest.post(`/recovery/verify-identifier`, body);
805
- return res;
806
- });
807
- }
808
- verify2FA(auth, verificationCode) {
809
- return __async(this, null, function* () {
810
- const body = __spreadProps(__spreadValues({}, auth), { verificationCode });
811
- const res = yield this.baseRequest.post("/2fa/verify", body);
812
- return res.data;
813
- });
814
- }
815
- // POST /2fa/phone/verify
816
- /**
817
- * @deprecated
818
- */
819
- verify2FAForPhone(phone, verificationCode) {
820
- return __async(this, null, function* () {
821
- const body = { phone, verificationCode };
822
- const res = yield this.baseRequest.post("/2fa/verify", body);
823
- return res;
824
- });
825
- }
826
- tempTrasmissionInit(message, userId) {
827
- return __async(this, null, function* () {
828
- const body = { message, userId };
829
- const res = yield this.baseRequest.post("/temporary-transmissions", body);
830
- return res;
831
- });
832
- }
833
- tempTrasmission(id) {
834
- return __async(this, null, function* () {
835
- const res = yield this.baseRequest.get(`/temporary-transmissions/${id}`);
836
- return res;
837
- });
838
- }
839
- getPartner(partnerId) {
840
- return __async(this, null, function* () {
841
- const res = yield this.baseRequest.get(`/partners/${partnerId}`);
842
- return res;
843
- });
844
- }
845
- acceptScopes(userId, walletId, body) {
846
- return __async(this, null, function* () {
847
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/scopes/accept`, body);
848
- return res;
849
- });
850
- }
851
- getPendingTransaction(userId, pendingTransactionId) {
852
- return __async(this, null, function* () {
853
- const res = yield this.baseRequest.get(`/users/${userId}/pending-transactions/${pendingTransactionId}`);
854
- return res;
855
- });
856
- }
857
- acceptPendingTransaction(userId, pendingTransactionId) {
858
- return __async(this, null, function* () {
859
- const res = yield this.baseRequest.post(`/users/${userId}/pending-transactions/${pendingTransactionId}/accept`);
860
- return res;
861
- });
862
- }
863
- getOnRampConfig() {
864
- return __async(this, null, function* () {
865
- const res = yield this.baseRequest.get(`/on-ramp-config`);
866
- return res.data;
867
- });
868
- }
869
- createOnRampPurchase(_e) {
870
- return __async(this, null, function* () {
871
- var _f = _e, {
872
- userId,
873
- params: {
874
- type,
875
- walletType,
876
- address,
877
- provider,
878
- networks,
879
- assets,
880
- defaultNetwork,
881
- defaultAsset,
882
- fiat,
883
- fiatQuantity,
884
- testMode = false
885
- }
886
- } = _f, params = __objRest(_f, [
887
- "userId",
888
- "params"
889
- ]);
890
- const [key, identifier] = extractWalletRef(params);
891
- const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
892
- const res = yield this.baseRequest.post(`/users/${userId}/${walletString}/purchases`, {
893
- type,
894
- provider,
895
- walletType,
896
- address,
897
- networks,
898
- assets,
899
- defaultAsset,
900
- defaultNetwork,
901
- fiat,
902
- fiatQuantity,
903
- testMode
904
- });
905
- return res.data;
906
- });
907
- }
908
- updateOnRampPurchase(_g) {
909
- return __async(this, null, function* () {
910
- var _h = _g, {
911
- userId,
912
- purchaseId,
913
- updates
914
- } = _h, params = __objRest(_h, [
915
- "userId",
916
- "purchaseId",
917
- "updates"
918
- ]);
919
- const [key, identifier] = extractWalletRef(params);
920
- const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
921
- const res = yield this.baseRequest.patch(
922
- `/users/${userId}/${walletString}/purchases/${purchaseId}`,
923
- updates
924
- );
925
- return res.data;
926
- });
927
- }
928
- getOnRampPurchase(_i) {
929
- return __async(this, null, function* () {
930
- var _j = _i, {
931
- userId,
932
- purchaseId
933
- } = _j, params = __objRest(_j, [
934
- "userId",
935
- "purchaseId"
936
- ]);
937
- const [key, identifier] = extractWalletRef(params);
938
- const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
939
- const res = yield this.baseRequest.get(`/users/${userId}/${walletString}/purchases/${purchaseId}`);
940
- return res;
941
- });
942
- }
943
- signMoonPayUrl(_0, _1) {
944
- return __async(this, arguments, function* (userId, {
945
- url,
946
- type,
947
- cosmosPrefix,
948
- testMode,
949
- walletId,
950
- externalWalletAddress
951
- }) {
952
- const walletString = walletId ? `wallets/${walletId}` : `external-wallets/${externalWalletAddress}`;
953
- const res = yield this.baseRequest.post(`/users/${userId}/${walletString}/moonpay-sign`, {
954
- url,
955
- type,
956
- cosmosPrefix,
957
- testMode
958
- });
959
- return res;
960
- });
961
- }
962
- generateOffRampTx(_0, _1) {
963
- return __async(this, arguments, function* (userId, {
964
- provider,
965
- chainId,
966
- contractAddress,
967
- testMode,
968
- walletId,
969
- walletType,
970
- destinationAddress,
971
- sourceAddress,
972
- assetQuantity
973
- }) {
974
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/offramp-generate`, {
975
- provider,
976
- testMode,
977
- chainId,
978
- contractAddress,
979
- walletId,
980
- walletType,
981
- destinationAddress,
982
- sourceAddress,
983
- assetQuantity
984
- });
985
- return res.data;
986
- });
987
- }
988
- sendOffRampTx(_0, _1) {
989
- return __async(this, arguments, function* (userId, {
990
- tx,
991
- signature,
992
- network,
993
- walletId,
994
- walletType
995
- }) {
996
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/offramp-send`, {
997
- tx,
998
- signature,
999
- network,
1000
- walletType
1001
- });
1002
- return res.data;
1003
- });
1004
- }
1005
- distributeParaShare(_k) {
1006
- return __async(this, null, function* () {
1007
- var _l = _k, {
1008
- userId,
1009
- walletId
1010
- } = _l, rest = __objRest(_l, [
1011
- "userId",
1012
- "walletId"
1013
- ]);
1014
- const body = rest;
1015
- const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/capsule-share/distribute`, body);
1016
- return res;
1017
- });
1018
- }
1019
- keepSessionAlive(userId) {
1020
- return __async(this, null, function* () {
1021
- const res = yield this.baseRequest.post(`/users/${userId}/session/keep-alive`);
1022
- return res.data;
1023
- });
1024
- }
1025
- persistRecoveryPublicKeys(userId, publicKeys) {
1026
- return __async(this, null, function* () {
1027
- const res = yield this.baseRequest.post(`/users/${userId}/recovery-public-keys`, { publicKeys });
1028
- return res.data;
1029
- });
1030
- }
1031
- getRecoveryPublicKeys(userId) {
1032
- return __async(this, null, function* () {
1033
- const res = yield this.baseRequest.get(`/users/${userId}/recovery-public-keys`);
1034
- return res.data;
1035
- });
1036
- }
1037
- uploadEncryptedWalletPrivateKey(userId, encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey, passwordId) {
1038
- return __async(this, null, function* () {
1039
- const body = { encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey, passwordId };
1040
- const res = yield this.baseRequest.post(`/users/${userId}/encrypted-wallet-private-keys`, body);
1041
- return res.data;
1042
- });
1043
- }
1044
- getEncryptedWalletPrivateKeys(userId, encryptionKeyHash) {
1045
- return __async(this, null, function* () {
1046
- const res = yield this.baseRequest.get(`/users/${userId}/encrypted-wallet-private-keys/${encryptionKeyHash}`);
1047
- return res.data;
1048
- });
1049
- }
1050
- getConversionRate(chainId, symbol, currency) {
1051
- return __async(this, null, function* () {
1052
- const params = { symbol, currency };
1053
- const res = yield this.baseRequest.get(`/chains/${chainId}/conversion-rate`, { params });
1054
- return res.data;
1055
- });
1056
- }
1057
- getGasEstimate(chainId, totalGasPrice) {
1058
- return __async(this, null, function* () {
1059
- const params = { totalGasPrice };
1060
- const res = yield this.baseRequest.get(`/chains/${chainId}/gas-estimate`, { params });
1061
- return res.data;
1062
- });
1063
- }
1064
- getGasOracle(chainId) {
1065
- return __async(this, null, function* () {
1066
- const res = yield this.baseRequest.get(`/chains/${chainId}/gas-oracle`);
1067
- return res.data;
1068
- });
1069
- }
1070
- // GET /users/:userId/wallets/:walletId/refresh-done
1071
- isRefreshDone(userId, walletId, partnerId, protocolId) {
1072
- return __async(this, null, function* () {
1073
- const queryParams = {};
1074
- if (partnerId) queryParams["partnerId"] = partnerId;
1075
- if (protocolId) queryParams["protocolId"] = protocolId;
1076
- const query = import_qs.default.stringify(queryParams);
1077
- const res = yield this.baseRequest.get(`/users/${userId}/wallets/${walletId}/refresh-done?${query}`);
1078
- return res.data;
1079
- });
1080
- }
1081
- deletePendingTransaction(userId, pendingTransactionId) {
1082
- return __async(this, null, function* () {
1083
- const res = yield this.baseRequest.delete(`/users/${userId}/pending-transactions/${pendingTransactionId}`);
1084
- return res.data;
1085
- });
1086
- }
1087
- // POST /users/:userId/passwords/key
1088
- addSessionPasswordPublicKey(userId, body) {
1089
- return __async(this, null, function* () {
1090
- const res = yield this.baseRequest.post(`/users/${userId}/passwords/key`, body);
1091
- return res;
1092
- });
1093
- }
1094
- getSupportedAuthMethods(auth) {
1095
- return __async(this, null, function* () {
1096
- const res = yield this.baseRequest.get("/users/supported-auth-methods", {
1097
- params: __spreadValues({}, auth)
1098
- });
1099
- return res.data;
1100
- });
1101
- }
1102
- getPasswords(auth) {
1103
- return __async(this, null, function* () {
1104
- const res = yield this.baseRequest.get("/users/passwords", {
1105
- params: __spreadValues({}, auth)
1106
- });
1107
- return res.data.passwords;
1108
- });
1109
- }
1110
- // POST /passwords/verify
1111
- verifyPasswordChallenge(partnerId, body) {
1112
- return __async(this, null, function* () {
1113
- const res = yield this.baseRequest.post(`/passwords/verify`, body, {
1114
- headers: {
1115
- [PARTNER_ID_HEADER_NAME]: partnerId
1116
- }
1117
- });
1118
- return res;
1119
- });
1120
- }
1121
- getEncryptedWalletPrivateKey(passwordId) {
1122
- return __async(this, null, function* () {
1123
- const queryParams = {};
1124
- queryParams["passwordId"] = passwordId;
1125
- const query = import_qs.default.stringify(queryParams);
1126
- const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
1127
- return res;
1128
- });
1129
- }
1130
- // GET /users/:userId
1131
- getUser(userId) {
1132
- return __async(this, null, function* () {
1133
- const res = yield this.baseRequest.get(`/users/${userId}`);
1134
- return res.data;
1135
- });
1136
- }
1137
- };
1138
- var client_default = Client;
1139
-
1140
- // src/types/auth.ts
1141
- var AUTH_TYPES = [
1142
- "email",
1143
- "phone",
1144
- "phoneLegacy",
1145
- "farcaster",
1146
- "telegram",
1147
- "userId",
1148
- "externalWallet",
1149
- "discord",
1150
- "x",
1151
- "customId"
1152
- ];
1153
- var EncryptorType = /* @__PURE__ */ ((EncryptorType2) => {
1154
- EncryptorType2["USER"] = "USER";
1155
- EncryptorType2["RECOVERY"] = "RECOVERY";
1156
- EncryptorType2["BIOMETRICS"] = "BIOMETRICS";
1157
- EncryptorType2["PASSWORD"] = "PASSWORD";
1158
- return EncryptorType2;
1159
- })(EncryptorType || {});
1160
- var KeyShareType = /* @__PURE__ */ ((KeyShareType2) => {
1161
- KeyShareType2["USER"] = "USER";
1162
- KeyShareType2["RECOVERY"] = "RECOVERY";
1163
- return KeyShareType2;
1164
- })(KeyShareType || {});
1165
- var PasswordStatus = /* @__PURE__ */ ((PasswordStatus2) => {
1166
- PasswordStatus2["PENDING"] = "PENDING";
1167
- PasswordStatus2["COMPLETE"] = "COMPLETE";
1168
- return PasswordStatus2;
1169
- })(PasswordStatus || {});
1170
- var PublicKeyStatus = /* @__PURE__ */ ((PublicKeyStatus2) => {
1171
- PublicKeyStatus2["PENDING"] = "PENDING";
1172
- PublicKeyStatus2["COMPLETE"] = "COMPLETE";
1173
- return PublicKeyStatus2;
1174
- })(PublicKeyStatus || {});
1175
- var PublicKeyType = /* @__PURE__ */ ((PublicKeyType2) => {
1176
- PublicKeyType2["MOBILE"] = "MOBILE";
1177
- PublicKeyType2["WEB"] = "WEB";
1178
- return PublicKeyType2;
1179
- })(PublicKeyType || {});
1180
- var OAuthMethod = /* @__PURE__ */ ((OAuthMethod2) => {
1181
- OAuthMethod2["GOOGLE"] = "GOOGLE";
1182
- OAuthMethod2["TWITTER"] = "TWITTER";
1183
- OAuthMethod2["APPLE"] = "APPLE";
1184
- OAuthMethod2["DISCORD"] = "DISCORD";
1185
- OAuthMethod2["FACEBOOK"] = "FACEBOOK";
1186
- OAuthMethod2["FARCASTER"] = "FARCASTER";
1187
- OAuthMethod2["TELEGRAM"] = "TELEGRAM";
1188
- return OAuthMethod2;
1189
- })(OAuthMethod || {});
1190
- var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
1191
- AuthMethod2["PASSWORD"] = "PASSWORD";
1192
- AuthMethod2["PASSKEY"] = "PASSKEY";
1193
- return AuthMethod2;
1194
- })(AuthMethod || {});
1195
-
1196
- // src/types/email.ts
1197
- var EmailTheme = /* @__PURE__ */ ((EmailTheme2) => {
1198
- EmailTheme2["LIGHT"] = "light";
1199
- EmailTheme2["DARK"] = "dark";
1200
- return EmailTheme2;
1201
- })(EmailTheme || {});
1202
-
1203
- // src/types/onRamp.ts
1204
- var OnRampProvider = /* @__PURE__ */ ((OnRampProvider2) => {
1205
- OnRampProvider2["RAMP"] = "RAMP";
1206
- OnRampProvider2["STRIPE"] = "STRIPE";
1207
- OnRampProvider2["MOONPAY"] = "MOONPAY";
1208
- return OnRampProvider2;
1209
- })(OnRampProvider || {});
1210
- var OnRampAsset = /* @__PURE__ */ ((OnRampAsset2) => {
1211
- OnRampAsset2["ETHEREUM"] = "ETHEREUM";
1212
- OnRampAsset2["USDC"] = "USDC";
1213
- OnRampAsset2["TETHER"] = "TETHER";
1214
- OnRampAsset2["POLYGON"] = "POLYGON";
1215
- OnRampAsset2["SOLANA"] = "SOLANA";
1216
- OnRampAsset2["ATOM"] = "ATOM";
1217
- OnRampAsset2["CELO"] = "CELO";
1218
- OnRampAsset2["CUSD"] = "CUSD";
1219
- OnRampAsset2["CEUR"] = "CEUR";
1220
- OnRampAsset2["CREAL"] = "CREAL";
1221
- return OnRampAsset2;
1222
- })(OnRampAsset || {});
1223
- var OnRampPurchaseStatus = /* @__PURE__ */ ((OnRampPurchaseStatus2) => {
1224
- OnRampPurchaseStatus2["INITIATED"] = "INITIATED";
1225
- OnRampPurchaseStatus2["FINISHED"] = "FINISHED";
1226
- OnRampPurchaseStatus2["CANCELLED"] = "CANCELLED";
1227
- return OnRampPurchaseStatus2;
1228
- })(OnRampPurchaseStatus || {});
1229
- var OnRampPurchaseType = /* @__PURE__ */ ((OnRampPurchaseType2) => {
1230
- OnRampPurchaseType2["BUY"] = "BUY";
1231
- OnRampPurchaseType2["SELL"] = "SELL";
1232
- return OnRampPurchaseType2;
1233
- })(OnRampPurchaseType || {});
1234
-
1235
- // src/types/wallet.ts
1236
- var WalletScheme = /* @__PURE__ */ ((WalletScheme2) => {
1237
- WalletScheme2["DKLS"] = "DKLS";
1238
- WalletScheme2["CGGMP"] = "CGGMP";
1239
- WalletScheme2["ED25519"] = "ED25519";
1240
- return WalletScheme2;
1241
- })(WalletScheme || {});
1242
- var WalletType = /* @__PURE__ */ ((WalletType2) => {
1243
- WalletType2["EVM"] = "EVM";
1244
- WalletType2["SOLANA"] = "SOLANA";
1245
- WalletType2["COSMOS"] = "COSMOS";
1246
- return WalletType2;
1247
- })(WalletType || {});
1248
- var Chain = /* @__PURE__ */ ((Chain2) => {
1249
- Chain2["ETH"] = "ETH";
1250
- Chain2["CELO"] = "CELO";
1251
- Chain2["MATIC"] = "MATIC";
1252
- return Chain2;
1253
- })(Chain || {});
1254
- var Network = /* @__PURE__ */ ((Network2) => {
1255
- Network2["ETHEREUM"] = "ETHEREUM";
1256
- Network2["SEPOLIA"] = "SEPOLIA";
1257
- Network2["ARBITRUM"] = "ARBITRUM";
1258
- Network2["BASE"] = "BASE";
1259
- Network2["OPTIMISM"] = "OPTIMISM";
1260
- Network2["POLYGON"] = "POLYGON";
1261
- Network2["SOLANA"] = "SOLANA";
1262
- Network2["COSMOS"] = "COSMOS";
1263
- Network2["CELO"] = "CELO";
1264
- Network2["NOBLE"] = "NOBLE";
1265
- return Network2;
1266
- })(Network || {});
1267
- var PREGEN_IDENTIFIER_TYPES = [
1268
- "EMAIL",
1269
- "PHONE",
1270
- "CUSTOM_ID",
1271
- "DISCORD",
1272
- "TWITTER",
1273
- "TELEGRAM",
1274
- "FARCASTER"
1275
- ];
1276
- var NON_ED25519 = ["DKLS" /* DKLS */, "CGGMP" /* CGGMP */];
1277
-
1278
- // src/index.ts
1279
- var src_default = client_default;
34
+ __reExport(src_exports, require("./client.js"), module.exports);
35
+ __reExport(src_exports, require("./types/index.js"), module.exports);
36
+ __reExport(src_exports, require("./utils.js"), module.exports);
37
+ __reExport(src_exports, require("./error.js"), module.exports);
38
+ var import_client = __toESM(require("./client.js"));
39
+ var src_default = import_client.default;
1280
40
  // Annotate the CommonJS export names for ESM import in node:
1281
41
  0 && (module.exports = {
1282
- AUTH_TYPES,
1283
- AuthMethod,
1284
- Chain,
1285
- EmailTheme,
1286
- EncryptorType,
1287
- KeyShareType,
1288
- NON_ED25519,
1289
- Network,
1290
- OAuthMethod,
1291
- OnRampAsset,
1292
- OnRampProvider,
1293
- OnRampPurchaseStatus,
1294
- OnRampPurchaseType,
1295
- PREGEN_IDENTIFIER_TYPES,
1296
- ParaApiError,
1297
- PasswordStatus,
1298
- PublicKeyStatus,
1299
- PublicKeyType,
1300
- WalletScheme,
1301
- WalletType,
1302
- extractAuthInfo,
1303
- extractWalletRef,
1304
- handleResponseError,
1305
- handleResponseSuccess,
1306
- isCustomId,
1307
- isDiscord,
1308
- isEmail,
1309
- isExternalWallet,
1310
- isExternalWalletAddress,
1311
- isFarcaster,
1312
- isPhone,
1313
- isPhoneLegacy,
1314
- isPregenAuth,
1315
- isPrimary,
1316
- isTelegram,
1317
- isUserId,
1318
- isVerifiedAuth,
1319
- isWalletId,
1320
- isX,
1321
- toPregenIds,
1322
- toPregenTypeAndId
42
+ ...require("./client.js"),
43
+ ...require("./types/index.js"),
44
+ ...require("./utils.js"),
45
+ ...require("./error.js")
1323
46
  });