@getpara/user-management-client 1.7.1 → 2.0.0-alpha.3
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 +196 -75
- package/dist/cjs/index.js.br +0 -0
- package/dist/cjs/index.js.gz +0 -0
- package/dist/esm/index.js +184 -74
- package/dist/esm/index.js.br +0 -0
- package/dist/esm/index.js.gz +0 -0
- package/dist/types/client.d.ts +38 -49
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types/auth.d.ts +123 -15
- package/dist/types/types/partner.d.ts +7 -0
- package/dist/types/types/wallet.d.ts +7 -4
- package/dist/types/utils.d.ts +39 -9
- package/package.json +2 -2
- package/dist/cjs/package.json +0 -3
- package/dist/esm/package.json +0 -4
package/dist/cjs/index.js
CHANGED
|
@@ -78,6 +78,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
78
78
|
// src/index.ts
|
|
79
79
|
var src_exports = {};
|
|
80
80
|
__export(src_exports, {
|
|
81
|
+
AUTH_TYPES: () => AUTH_TYPES,
|
|
81
82
|
AuthMethod: () => AuthMethod,
|
|
82
83
|
Chain: () => Chain,
|
|
83
84
|
EmailTheme: () => EmailTheme,
|
|
@@ -91,6 +92,7 @@ __export(src_exports, {
|
|
|
91
92
|
OnRampPurchaseStatus: () => OnRampPurchaseStatus,
|
|
92
93
|
OnRampPurchaseType: () => OnRampPurchaseType,
|
|
93
94
|
PREGEN_IDENTIFIER_TYPES: () => PREGEN_IDENTIFIER_TYPES,
|
|
95
|
+
ParaApiError: () => ParaApiError,
|
|
94
96
|
PasswordStatus: () => PasswordStatus,
|
|
95
97
|
PublicKeyStatus: () => PublicKeyStatus,
|
|
96
98
|
PublicKeyType: () => PublicKeyType,
|
|
@@ -101,14 +103,23 @@ __export(src_exports, {
|
|
|
101
103
|
extractWalletRef: () => extractWalletRef,
|
|
102
104
|
handleResponseError: () => handleResponseError,
|
|
103
105
|
handleResponseSuccess: () => handleResponseSuccess,
|
|
106
|
+
isCustomId: () => isCustomId,
|
|
107
|
+
isDiscord: () => isDiscord,
|
|
104
108
|
isEmail: () => isEmail,
|
|
105
109
|
isExternalWallet: () => isExternalWallet,
|
|
106
110
|
isExternalWalletAddress: () => isExternalWalletAddress,
|
|
107
111
|
isFarcaster: () => isFarcaster,
|
|
108
112
|
isPhone: () => isPhone,
|
|
113
|
+
isPhoneLegacy: () => isPhoneLegacy,
|
|
114
|
+
isPregenAuth: () => isPregenAuth,
|
|
115
|
+
isPrimary: () => isPrimary,
|
|
109
116
|
isTelegram: () => isTelegram,
|
|
110
117
|
isUserId: () => isUserId,
|
|
111
|
-
|
|
118
|
+
isVerifiedAuth: () => isVerifiedAuth,
|
|
119
|
+
isWalletId: () => isWalletId,
|
|
120
|
+
isX: () => isX,
|
|
121
|
+
toPregenIds: () => toPregenIds,
|
|
122
|
+
toPregenTypeAndId: () => toPregenTypeAndId
|
|
112
123
|
});
|
|
113
124
|
module.exports = __toCommonJS(src_exports);
|
|
114
125
|
|
|
@@ -117,6 +128,7 @@ var import_axios = __toESM(require("axios"));
|
|
|
117
128
|
var import_qs = __toESM(require("qs"));
|
|
118
129
|
|
|
119
130
|
// src/utils.ts
|
|
131
|
+
var import_libphonenumber_js = __toESM(require("libphonenumber-js"));
|
|
120
132
|
function isWalletId(params) {
|
|
121
133
|
return !!params.walletId && !params.externalWalletAddress;
|
|
122
134
|
}
|
|
@@ -135,63 +147,143 @@ function isValid(s) {
|
|
|
135
147
|
return !!s && s !== "null" && s !== "undefined" && s !== "";
|
|
136
148
|
}
|
|
137
149
|
function isEmail(params) {
|
|
138
|
-
return isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(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);
|
|
139
151
|
}
|
|
140
152
|
function isPhone(params) {
|
|
141
|
-
return isValid(params.phone) && isValid(params.countryCode) && !isValid(params.email) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(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);
|
|
142
157
|
}
|
|
143
158
|
function isFarcaster(params) {
|
|
144
|
-
return isValid(params.farcasterUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.telegramUserId) && !isValid(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);
|
|
145
160
|
}
|
|
146
161
|
function isTelegram(params) {
|
|
147
|
-
return isValid(params.telegramUserId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(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);
|
|
148
175
|
}
|
|
149
176
|
function isUserId(params) {
|
|
150
|
-
return isValid(params.userId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(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);
|
|
151
178
|
}
|
|
152
|
-
function
|
|
153
|
-
return
|
|
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);
|
|
154
184
|
}
|
|
155
|
-
function
|
|
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;
|
|
156
193
|
switch (true) {
|
|
157
194
|
case isEmail(obj):
|
|
158
|
-
return {
|
|
195
|
+
return {
|
|
196
|
+
auth: { email: obj.email },
|
|
197
|
+
authType: "email",
|
|
198
|
+
identifier: obj.email
|
|
199
|
+
};
|
|
159
200
|
case isPhone(obj):
|
|
201
|
+
if (!(0, import_libphonenumber_js.default)(obj.phone)) {
|
|
202
|
+
error = "invalid phone number";
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
160
205
|
return {
|
|
161
|
-
auth: { phone: obj.phone
|
|
206
|
+
auth: { phone: obj.phone },
|
|
162
207
|
authType: "phone",
|
|
163
|
-
identifier:
|
|
164
|
-
|
|
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
|
|
165
220
|
};
|
|
166
221
|
case isFarcaster(obj):
|
|
167
222
|
return {
|
|
168
223
|
auth: { farcasterUsername: obj.farcasterUsername },
|
|
169
224
|
authType: "farcaster",
|
|
170
|
-
identifier: obj.farcasterUsername
|
|
171
|
-
publicKeyIdentifier: `${obj.farcasterUsername}-farcaster`
|
|
225
|
+
identifier: obj.farcasterUsername
|
|
172
226
|
};
|
|
173
227
|
case isTelegram(obj):
|
|
174
228
|
return {
|
|
175
229
|
auth: { telegramUserId: obj.telegramUserId },
|
|
176
230
|
authType: "telegram",
|
|
177
|
-
identifier: obj.telegramUserId
|
|
178
|
-
publicKeyIdentifier: `${obj.telegramUserId}-telegram`
|
|
231
|
+
identifier: obj.telegramUserId
|
|
179
232
|
};
|
|
180
233
|
case isExternalWallet(obj):
|
|
181
234
|
return {
|
|
182
235
|
auth: { externalWalletAddress: obj.externalWalletAddress },
|
|
183
236
|
authType: "externalWallet",
|
|
184
|
-
identifier: obj.externalWalletAddress
|
|
185
|
-
|
|
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
|
|
186
256
|
};
|
|
187
257
|
case (isUserId(obj) && allowUserId):
|
|
188
|
-
return {
|
|
258
|
+
return {
|
|
259
|
+
auth: { userId: obj.userId },
|
|
260
|
+
authType: "userId",
|
|
261
|
+
identifier: obj.userId
|
|
262
|
+
};
|
|
189
263
|
default:
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
if (isRequired) {
|
|
267
|
+
throw new Error(error != null ? error : "invalid auth object");
|
|
194
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] };
|
|
195
287
|
}
|
|
196
288
|
|
|
197
289
|
// src/consts.ts
|
|
@@ -248,6 +340,13 @@ var Client = class {
|
|
|
248
340
|
retrieveSessionCookie,
|
|
249
341
|
persistSessionCookie
|
|
250
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
|
+
*/
|
|
251
350
|
this.createUser = (body) => __async(this, null, function* () {
|
|
252
351
|
const res = yield this.baseRequest.post(`/users`, body);
|
|
253
352
|
return res.data;
|
|
@@ -259,26 +358,46 @@ var Client = class {
|
|
|
259
358
|
return res;
|
|
260
359
|
});
|
|
261
360
|
this.verifyTelegram = (authObject) => __async(this, null, function* () {
|
|
262
|
-
return (yield this.baseRequest.post("/users/telegram", {
|
|
361
|
+
return (yield this.baseRequest.post("/users/telegram/v2", {
|
|
263
362
|
authObject
|
|
264
363
|
})).data;
|
|
265
364
|
});
|
|
266
|
-
this.
|
|
267
|
-
const res = yield this.baseRequest.post(
|
|
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);
|
|
268
381
|
return res.data;
|
|
269
382
|
});
|
|
270
383
|
// POST /users/:userId/verify-email
|
|
384
|
+
/**
|
|
385
|
+
* @deprecated
|
|
386
|
+
*/
|
|
271
387
|
this.verifyEmail = (userId, body) => __async(this, null, function* () {
|
|
272
388
|
const res = yield this.baseRequest.post(`/users/${userId}/verify-email`, body);
|
|
273
389
|
return res;
|
|
274
390
|
});
|
|
391
|
+
/**
|
|
392
|
+
* @deprecated
|
|
393
|
+
*/
|
|
275
394
|
this.verifyPhone = (userId, body) => __async(this, null, function* () {
|
|
276
395
|
const res = yield this.baseRequest.post(`/users/${userId}/verify-identifier`, body);
|
|
277
396
|
return res;
|
|
278
397
|
});
|
|
279
398
|
this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
|
|
280
|
-
const res = yield this.baseRequest.post(`/users/${userId}/external-wallets/verify`, body);
|
|
281
|
-
return res;
|
|
399
|
+
const res = yield this.baseRequest.post(`/users/${userId}/external-wallets/verify/v2`, body);
|
|
400
|
+
return res.data;
|
|
282
401
|
});
|
|
283
402
|
// POST /users/:userId/biometrics/key
|
|
284
403
|
this.addSessionPublicKey = (userId, body) => __async(this, null, function* () {
|
|
@@ -291,8 +410,10 @@ var Client = class {
|
|
|
291
410
|
return res;
|
|
292
411
|
});
|
|
293
412
|
// GET /biometrics/location-hints
|
|
294
|
-
this.getBiometricLocationHints = (
|
|
295
|
-
const res = yield this.baseRequest.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
|
+
});
|
|
296
417
|
return res.data.hints;
|
|
297
418
|
});
|
|
298
419
|
// GET /users/:userId/biometrics/:biometricId
|
|
@@ -318,10 +439,8 @@ var Client = class {
|
|
|
318
439
|
});
|
|
319
440
|
// POST /touch
|
|
320
441
|
this.touchSession = (regenerate) => __async(this, null, function* () {
|
|
321
|
-
const res = yield this.baseRequest.post(
|
|
322
|
-
|
|
323
|
-
);
|
|
324
|
-
return res;
|
|
442
|
+
const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
|
|
443
|
+
return res.data;
|
|
325
444
|
});
|
|
326
445
|
// GET /session/origin
|
|
327
446
|
this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
|
|
@@ -357,14 +476,12 @@ var Client = class {
|
|
|
357
476
|
const res = yield this.baseRequest.post(`/wallets/pregen`, body);
|
|
358
477
|
return res.data;
|
|
359
478
|
});
|
|
360
|
-
// GET /wallets/pregen?pregenIdentifier={pregenIdentifier}&pregenIdentifierType={pregenIdentifierType}
|
|
361
479
|
this.getPregenWallets = (pregenIds, isPortal = false, userId) => __async(this, null, function* () {
|
|
362
480
|
const res = yield this.baseRequest.get("/wallets/pregen", {
|
|
363
481
|
params: { ids: pregenIds, expand: isPortal, userId }
|
|
364
482
|
});
|
|
365
483
|
return res.data;
|
|
366
484
|
});
|
|
367
|
-
// POST /wallets/pregen/claim
|
|
368
485
|
this.claimPregenWallets = (body) => __async(this, null, function* () {
|
|
369
486
|
const res = yield this.baseRequest.post(`/wallets/pregen/claim`, body);
|
|
370
487
|
return res.data;
|
|
@@ -457,11 +574,9 @@ var Client = class {
|
|
|
457
574
|
const res = yield this.baseRequest.get(`/users/${userId}/wallets/${walletId}/capsule-share`);
|
|
458
575
|
return res.data.share;
|
|
459
576
|
});
|
|
460
|
-
// GET /
|
|
461
|
-
this.getBackupKit = (userId
|
|
462
|
-
const res = yield this.baseRequest.get(`/
|
|
463
|
-
responseType: "blob"
|
|
464
|
-
});
|
|
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" });
|
|
465
580
|
return res;
|
|
466
581
|
});
|
|
467
582
|
// PATCH /users/:userId/biometrics/:biometricId
|
|
@@ -627,11 +742,10 @@ var Client = class {
|
|
|
627
742
|
return res;
|
|
628
743
|
});
|
|
629
744
|
}
|
|
630
|
-
// POST '/2fa/users/:userId/setup'
|
|
631
745
|
setup2FA(userId) {
|
|
632
746
|
return __async(this, null, function* () {
|
|
633
747
|
const res = yield this.baseRequest.post(`/2fa/users/${userId}/setup`);
|
|
634
|
-
return res;
|
|
748
|
+
return res.data;
|
|
635
749
|
});
|
|
636
750
|
}
|
|
637
751
|
// POST /recovery/init
|
|
@@ -648,11 +762,10 @@ var Client = class {
|
|
|
648
762
|
return res;
|
|
649
763
|
});
|
|
650
764
|
}
|
|
651
|
-
// POST /auth/farcaster/status
|
|
652
765
|
getFarcasterAuthStatus() {
|
|
653
766
|
return __async(this, null, function* () {
|
|
654
|
-
const res = yield this.baseRequest.post(`/auth/farcaster/status`);
|
|
655
|
-
return res;
|
|
767
|
+
const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`);
|
|
768
|
+
return res.data;
|
|
656
769
|
});
|
|
657
770
|
}
|
|
658
771
|
// POST /recovery/init
|
|
@@ -692,18 +805,20 @@ var Client = class {
|
|
|
692
805
|
return res;
|
|
693
806
|
});
|
|
694
807
|
}
|
|
695
|
-
|
|
696
|
-
verify2FA(email, verificationCode) {
|
|
808
|
+
verify2FA(auth, verificationCode) {
|
|
697
809
|
return __async(this, null, function* () {
|
|
698
|
-
const body = {
|
|
810
|
+
const body = __spreadProps(__spreadValues({}, auth), { verificationCode });
|
|
699
811
|
const res = yield this.baseRequest.post("/2fa/verify", body);
|
|
700
|
-
return res;
|
|
812
|
+
return res.data;
|
|
701
813
|
});
|
|
702
814
|
}
|
|
703
815
|
// POST /2fa/phone/verify
|
|
704
|
-
|
|
816
|
+
/**
|
|
817
|
+
* @deprecated
|
|
818
|
+
*/
|
|
819
|
+
verify2FAForPhone(phone, verificationCode) {
|
|
705
820
|
return __async(this, null, function* () {
|
|
706
|
-
const body = { phone,
|
|
821
|
+
const body = { phone, verificationCode };
|
|
707
822
|
const res = yield this.baseRequest.post("/2fa/verify", body);
|
|
708
823
|
return res;
|
|
709
824
|
});
|
|
@@ -1019,28 +1134,22 @@ var Client = class {
|
|
|
1019
1134
|
return res.data;
|
|
1020
1135
|
});
|
|
1021
1136
|
}
|
|
1022
|
-
// GET /users/:userId/accounts
|
|
1023
|
-
getAccountMetadata(userId, partnerId) {
|
|
1024
|
-
return __async(this, null, function* () {
|
|
1025
|
-
const res = yield this.baseRequest.get(`/users/${userId}/oauth/accounts`, {
|
|
1026
|
-
params: { partnerId }
|
|
1027
|
-
});
|
|
1028
|
-
return {
|
|
1029
|
-
accountMetadata: Object.entries(res.data.accountMetadata || {}).reduce(
|
|
1030
|
-
(acc, [method, obj]) => __spreadProps(__spreadValues({}, acc), {
|
|
1031
|
-
[method]: __spreadProps(__spreadValues({}, obj), {
|
|
1032
|
-
date: new Date(obj.date)
|
|
1033
|
-
})
|
|
1034
|
-
}),
|
|
1035
|
-
{}
|
|
1036
|
-
)
|
|
1037
|
-
};
|
|
1038
|
-
});
|
|
1039
|
-
}
|
|
1040
1137
|
};
|
|
1041
1138
|
var client_default = Client;
|
|
1042
1139
|
|
|
1043
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
|
+
];
|
|
1044
1153
|
var EncryptorType = /* @__PURE__ */ ((EncryptorType2) => {
|
|
1045
1154
|
EncryptorType2["USER"] = "USER";
|
|
1046
1155
|
EncryptorType2["RECOVERY"] = "RECOVERY";
|
|
@@ -1159,9 +1268,10 @@ var PREGEN_IDENTIFIER_TYPES = [
|
|
|
1159
1268
|
"EMAIL",
|
|
1160
1269
|
"PHONE",
|
|
1161
1270
|
"CUSTOM_ID",
|
|
1162
|
-
"DISCORD"
|
|
1163
|
-
"TWITTER"
|
|
1164
|
-
"TELEGRAM"
|
|
1271
|
+
"DISCORD",
|
|
1272
|
+
"TWITTER",
|
|
1273
|
+
"TELEGRAM",
|
|
1274
|
+
"FARCASTER"
|
|
1165
1275
|
];
|
|
1166
1276
|
var NON_ED25519 = ["DKLS" /* DKLS */, "CGGMP" /* CGGMP */];
|
|
1167
1277
|
|
|
@@ -1169,6 +1279,7 @@ var NON_ED25519 = ["DKLS" /* DKLS */, "CGGMP" /* CGGMP */];
|
|
|
1169
1279
|
var src_default = client_default;
|
|
1170
1280
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1171
1281
|
0 && (module.exports = {
|
|
1282
|
+
AUTH_TYPES,
|
|
1172
1283
|
AuthMethod,
|
|
1173
1284
|
Chain,
|
|
1174
1285
|
EmailTheme,
|
|
@@ -1182,6 +1293,7 @@ var src_default = client_default;
|
|
|
1182
1293
|
OnRampPurchaseStatus,
|
|
1183
1294
|
OnRampPurchaseType,
|
|
1184
1295
|
PREGEN_IDENTIFIER_TYPES,
|
|
1296
|
+
ParaApiError,
|
|
1185
1297
|
PasswordStatus,
|
|
1186
1298
|
PublicKeyStatus,
|
|
1187
1299
|
PublicKeyType,
|
|
@@ -1191,12 +1303,21 @@ var src_default = client_default;
|
|
|
1191
1303
|
extractWalletRef,
|
|
1192
1304
|
handleResponseError,
|
|
1193
1305
|
handleResponseSuccess,
|
|
1306
|
+
isCustomId,
|
|
1307
|
+
isDiscord,
|
|
1194
1308
|
isEmail,
|
|
1195
1309
|
isExternalWallet,
|
|
1196
1310
|
isExternalWalletAddress,
|
|
1197
1311
|
isFarcaster,
|
|
1198
1312
|
isPhone,
|
|
1313
|
+
isPhoneLegacy,
|
|
1314
|
+
isPregenAuth,
|
|
1315
|
+
isPrimary,
|
|
1199
1316
|
isTelegram,
|
|
1200
1317
|
isUserId,
|
|
1201
|
-
|
|
1318
|
+
isVerifiedAuth,
|
|
1319
|
+
isWalletId,
|
|
1320
|
+
isX,
|
|
1321
|
+
toPregenIds,
|
|
1322
|
+
toPregenTypeAndId
|
|
1202
1323
|
});
|
package/dist/cjs/index.js.br
CHANGED
|
Binary file
|
package/dist/cjs/index.js.gz
CHANGED
|
Binary file
|