@getpara/user-management-client 2.0.0-dev.3 → 2.0.0-dev.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/client.js +84 -10
- package/dist/cjs/types/auth.js +9 -0
- package/dist/esm/client.js +84 -10
- package/dist/esm/types/auth.js +8 -0
- package/dist/types/client.d.ts +64 -7
- package/dist/types/types/auth.d.ts +26 -5
- package/package.json +2 -2
package/dist/cjs/client.js
CHANGED
|
@@ -132,9 +132,13 @@ class Client {
|
|
|
132
132
|
});
|
|
133
133
|
return res.data;
|
|
134
134
|
});
|
|
135
|
-
this.verifyTelegram = (
|
|
135
|
+
this.verifyTelegram = (_0) => __async(this, [_0], function* ({
|
|
136
|
+
authObject,
|
|
137
|
+
sessionLookupId
|
|
138
|
+
}) {
|
|
136
139
|
return (yield this.baseRequest.post("/users/telegram/v2", {
|
|
137
|
-
authObject
|
|
140
|
+
authObject,
|
|
141
|
+
sessionLookupId
|
|
138
142
|
})).data;
|
|
139
143
|
});
|
|
140
144
|
this.verifyOAuth = () => __async(this, null, function* () {
|
|
@@ -151,8 +155,16 @@ class Client {
|
|
|
151
155
|
});
|
|
152
156
|
return res.data;
|
|
153
157
|
});
|
|
154
|
-
this.
|
|
155
|
-
const res = yield this.baseRequest.post(
|
|
158
|
+
this.verifyAccount = (userId, body) => __async(this, null, function* () {
|
|
159
|
+
const res = yield this.baseRequest.post(
|
|
160
|
+
`/users/${userId}/verify`,
|
|
161
|
+
body
|
|
162
|
+
);
|
|
163
|
+
return res.data;
|
|
164
|
+
});
|
|
165
|
+
// POST /users/send-login-code
|
|
166
|
+
this.sendLoginVerificationCode = (auth, isRecovery) => __async(this, null, function* () {
|
|
167
|
+
const res = yield this.baseRequest.post(`/users/send-login-code`, __spreadProps(__spreadValues({}, auth), { isRecovery }));
|
|
156
168
|
return res.data;
|
|
157
169
|
});
|
|
158
170
|
this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
|
|
@@ -212,7 +224,10 @@ class Client {
|
|
|
212
224
|
return res;
|
|
213
225
|
});
|
|
214
226
|
this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
|
|
215
|
-
const res = yield this.baseRequest.post(
|
|
227
|
+
const res = yield this.baseRequest.post(
|
|
228
|
+
`/users/${userId}/external-wallets/verify/v2`,
|
|
229
|
+
body
|
|
230
|
+
);
|
|
216
231
|
return res.data;
|
|
217
232
|
});
|
|
218
233
|
// POST /users/:userId/biometrics/key
|
|
@@ -258,11 +273,26 @@ class Client {
|
|
|
258
273
|
const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
|
|
259
274
|
return res.data;
|
|
260
275
|
});
|
|
261
|
-
// GET /
|
|
276
|
+
// GET /sessions/:sessionLookupId/origin
|
|
262
277
|
this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
|
|
263
278
|
const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
|
|
264
279
|
return res.data;
|
|
265
280
|
});
|
|
281
|
+
// GET /sessions/:sessionLookupId/login-method
|
|
282
|
+
this.sessionLoginMethod = (sessionLookupId) => __async(this, null, function* () {
|
|
283
|
+
const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/login-method`);
|
|
284
|
+
return res.data;
|
|
285
|
+
});
|
|
286
|
+
// GET /sessions/:sessionLookupId/auth-verified
|
|
287
|
+
this.sessionAuthVerified = (sessionLookupId) => __async(this, null, function* () {
|
|
288
|
+
const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth-verified`);
|
|
289
|
+
return res.data;
|
|
290
|
+
});
|
|
291
|
+
// GET /sessions/:sessionLookupId/auth
|
|
292
|
+
this.sessionAuth = (sessionLookupId) => __async(this, null, function* () {
|
|
293
|
+
const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth`);
|
|
294
|
+
return res.data;
|
|
295
|
+
});
|
|
266
296
|
// POST /biometrics/verify
|
|
267
297
|
this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
|
|
268
298
|
const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
|
|
@@ -425,6 +455,39 @@ class Client {
|
|
|
425
455
|
this.trackReactSdkAnalytics = (opts) => __async(this, null, function* () {
|
|
426
456
|
yield this.baseRequest.post("/partners/analytics/react-sdk", opts);
|
|
427
457
|
});
|
|
458
|
+
// ENCLAVE METHODS
|
|
459
|
+
/**
|
|
460
|
+
* Get the enclave's public key for encryption
|
|
461
|
+
*/
|
|
462
|
+
this.getEnclavePublicKey = () => __async(this, null, function* () {
|
|
463
|
+
const res = yield this.baseRequest.get(
|
|
464
|
+
"/enclave/public-key"
|
|
465
|
+
);
|
|
466
|
+
return res.data;
|
|
467
|
+
});
|
|
468
|
+
/**
|
|
469
|
+
* Persist encrypted key shares to the enclave
|
|
470
|
+
* @param encryptedPayload JSON string containing the encrypted ECIES payload
|
|
471
|
+
*/
|
|
472
|
+
this.persistEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
|
|
473
|
+
const body = { encryptedPayload };
|
|
474
|
+
const res = yield this.baseRequest.post("/enclave/key-shares", body);
|
|
475
|
+
return res.data;
|
|
476
|
+
});
|
|
477
|
+
/**
|
|
478
|
+
* Retrieve encrypted key shares from the enclave
|
|
479
|
+
* @param encryptedPayload JSON string containing the encrypted ECIES query
|
|
480
|
+
*/
|
|
481
|
+
this.retrieveEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
|
|
482
|
+
const res = yield this.baseRequest.get(
|
|
483
|
+
`/enclave/key-shares?encryptedPayload=${encodeURIComponent(encryptedPayload)}`
|
|
484
|
+
);
|
|
485
|
+
return res.data;
|
|
486
|
+
});
|
|
487
|
+
this.refreshEnclaveJwt = (encryptedPayload) => __async(this, null, function* () {
|
|
488
|
+
const res = yield this.baseRequest.post(`/enclave/jwt/refresh`, { encryptedPayload });
|
|
489
|
+
return res.data;
|
|
490
|
+
});
|
|
428
491
|
const headers = __spreadValues(__spreadValues({}, apiKey && { [import_consts.API_KEY_HEADER_NAME]: apiKey }), partnerId && { [import_consts.PARTNER_ID_HEADER_NAME]: partnerId });
|
|
429
492
|
const axiosConfig = {
|
|
430
493
|
baseURL: userManagementHost,
|
|
@@ -600,8 +663,8 @@ class Client {
|
|
|
600
663
|
});
|
|
601
664
|
}
|
|
602
665
|
getFarcasterAuthStatus() {
|
|
603
|
-
return __async(this,
|
|
604
|
-
const res = yield this.baseRequest.post(`/auth/farcaster/status/v2
|
|
666
|
+
return __async(this, arguments, function* ({ sessionLookupId } = {}) {
|
|
667
|
+
const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`, { sessionLookupId });
|
|
605
668
|
return res.data;
|
|
606
669
|
});
|
|
607
670
|
}
|
|
@@ -911,6 +974,17 @@ class Client {
|
|
|
911
974
|
return res.data;
|
|
912
975
|
});
|
|
913
976
|
}
|
|
977
|
+
getSupportedAuthMethodsV2(auth) {
|
|
978
|
+
return __async(this, null, function* () {
|
|
979
|
+
const res = yield this.baseRequest.get(
|
|
980
|
+
"/users/supported-auth-methods/v2",
|
|
981
|
+
{
|
|
982
|
+
params: __spreadValues({}, auth)
|
|
983
|
+
}
|
|
984
|
+
);
|
|
985
|
+
return res.data;
|
|
986
|
+
});
|
|
987
|
+
}
|
|
914
988
|
getPasswords(auth) {
|
|
915
989
|
return __async(this, null, function* () {
|
|
916
990
|
const res = yield this.baseRequest.get("/users/passwords", {
|
|
@@ -930,9 +1004,9 @@ class Client {
|
|
|
930
1004
|
return res;
|
|
931
1005
|
});
|
|
932
1006
|
}
|
|
933
|
-
getEncryptedWalletPrivateKey(passwordId) {
|
|
1007
|
+
getEncryptedWalletPrivateKey(passwordId, sessionLookupId) {
|
|
934
1008
|
return __async(this, null, function* () {
|
|
935
|
-
const query = new URLSearchParams({ passwordId }).toString();
|
|
1009
|
+
const query = new URLSearchParams({ passwordId, sessionLookupId }).toString();
|
|
936
1010
|
const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
|
|
937
1011
|
return res;
|
|
938
1012
|
});
|
package/dist/cjs/types/auth.js
CHANGED
|
@@ -22,6 +22,7 @@ __export(auth_exports, {
|
|
|
22
22
|
EncryptorType: () => EncryptorType,
|
|
23
23
|
KeyShareType: () => KeyShareType,
|
|
24
24
|
LINKED_ACCOUNT_TYPES: () => LINKED_ACCOUNT_TYPES,
|
|
25
|
+
LegacyAuthMethod: () => LegacyAuthMethod,
|
|
25
26
|
OAUTH_METHODS: () => OAUTH_METHODS,
|
|
26
27
|
OAuthMethod: () => OAuthMethod,
|
|
27
28
|
PasswordStatus: () => PasswordStatus,
|
|
@@ -95,8 +96,15 @@ const LINKED_ACCOUNT_TYPES = [
|
|
|
95
96
|
var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
|
|
96
97
|
AuthMethod2["PASSWORD"] = "PASSWORD";
|
|
97
98
|
AuthMethod2["PASSKEY"] = "PASSKEY";
|
|
99
|
+
AuthMethod2["PIN"] = "PIN";
|
|
100
|
+
AuthMethod2["SLO"] = "SLO";
|
|
98
101
|
return AuthMethod2;
|
|
99
102
|
})(AuthMethod || {});
|
|
103
|
+
var LegacyAuthMethod = /* @__PURE__ */ ((LegacyAuthMethod2) => {
|
|
104
|
+
LegacyAuthMethod2["PASSWORD"] = "PASSWORD";
|
|
105
|
+
LegacyAuthMethod2["BIOMETRIC"] = "BIOMETRIC";
|
|
106
|
+
return LegacyAuthMethod2;
|
|
107
|
+
})(LegacyAuthMethod || {});
|
|
100
108
|
// Annotate the CommonJS export names for ESM import in node:
|
|
101
109
|
0 && (module.exports = {
|
|
102
110
|
AUTH_TYPES,
|
|
@@ -104,6 +112,7 @@ var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
|
|
|
104
112
|
EncryptorType,
|
|
105
113
|
KeyShareType,
|
|
106
114
|
LINKED_ACCOUNT_TYPES,
|
|
115
|
+
LegacyAuthMethod,
|
|
107
116
|
OAUTH_METHODS,
|
|
108
117
|
OAuthMethod,
|
|
109
118
|
PasswordStatus,
|
package/dist/esm/client.js
CHANGED
|
@@ -55,9 +55,13 @@ class Client {
|
|
|
55
55
|
});
|
|
56
56
|
return res.data;
|
|
57
57
|
});
|
|
58
|
-
this.verifyTelegram = (
|
|
58
|
+
this.verifyTelegram = (_0) => __async(this, [_0], function* ({
|
|
59
|
+
authObject,
|
|
60
|
+
sessionLookupId
|
|
61
|
+
}) {
|
|
59
62
|
return (yield this.baseRequest.post("/users/telegram/v2", {
|
|
60
|
-
authObject
|
|
63
|
+
authObject,
|
|
64
|
+
sessionLookupId
|
|
61
65
|
})).data;
|
|
62
66
|
});
|
|
63
67
|
this.verifyOAuth = () => __async(this, null, function* () {
|
|
@@ -74,8 +78,16 @@ class Client {
|
|
|
74
78
|
});
|
|
75
79
|
return res.data;
|
|
76
80
|
});
|
|
77
|
-
this.
|
|
78
|
-
const res = yield this.baseRequest.post(
|
|
81
|
+
this.verifyAccount = (userId, body) => __async(this, null, function* () {
|
|
82
|
+
const res = yield this.baseRequest.post(
|
|
83
|
+
`/users/${userId}/verify`,
|
|
84
|
+
body
|
|
85
|
+
);
|
|
86
|
+
return res.data;
|
|
87
|
+
});
|
|
88
|
+
// POST /users/send-login-code
|
|
89
|
+
this.sendLoginVerificationCode = (auth, isRecovery) => __async(this, null, function* () {
|
|
90
|
+
const res = yield this.baseRequest.post(`/users/send-login-code`, __spreadProps(__spreadValues({}, auth), { isRecovery }));
|
|
79
91
|
return res.data;
|
|
80
92
|
});
|
|
81
93
|
this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
|
|
@@ -135,7 +147,10 @@ class Client {
|
|
|
135
147
|
return res;
|
|
136
148
|
});
|
|
137
149
|
this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
|
|
138
|
-
const res = yield this.baseRequest.post(
|
|
150
|
+
const res = yield this.baseRequest.post(
|
|
151
|
+
`/users/${userId}/external-wallets/verify/v2`,
|
|
152
|
+
body
|
|
153
|
+
);
|
|
139
154
|
return res.data;
|
|
140
155
|
});
|
|
141
156
|
// POST /users/:userId/biometrics/key
|
|
@@ -181,11 +196,26 @@ class Client {
|
|
|
181
196
|
const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
|
|
182
197
|
return res.data;
|
|
183
198
|
});
|
|
184
|
-
// GET /
|
|
199
|
+
// GET /sessions/:sessionLookupId/origin
|
|
185
200
|
this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
|
|
186
201
|
const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
|
|
187
202
|
return res.data;
|
|
188
203
|
});
|
|
204
|
+
// GET /sessions/:sessionLookupId/login-method
|
|
205
|
+
this.sessionLoginMethod = (sessionLookupId) => __async(this, null, function* () {
|
|
206
|
+
const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/login-method`);
|
|
207
|
+
return res.data;
|
|
208
|
+
});
|
|
209
|
+
// GET /sessions/:sessionLookupId/auth-verified
|
|
210
|
+
this.sessionAuthVerified = (sessionLookupId) => __async(this, null, function* () {
|
|
211
|
+
const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth-verified`);
|
|
212
|
+
return res.data;
|
|
213
|
+
});
|
|
214
|
+
// GET /sessions/:sessionLookupId/auth
|
|
215
|
+
this.sessionAuth = (sessionLookupId) => __async(this, null, function* () {
|
|
216
|
+
const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/auth`);
|
|
217
|
+
return res.data;
|
|
218
|
+
});
|
|
189
219
|
// POST /biometrics/verify
|
|
190
220
|
this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
|
|
191
221
|
const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
|
|
@@ -348,6 +378,39 @@ class Client {
|
|
|
348
378
|
this.trackReactSdkAnalytics = (opts) => __async(this, null, function* () {
|
|
349
379
|
yield this.baseRequest.post("/partners/analytics/react-sdk", opts);
|
|
350
380
|
});
|
|
381
|
+
// ENCLAVE METHODS
|
|
382
|
+
/**
|
|
383
|
+
* Get the enclave's public key for encryption
|
|
384
|
+
*/
|
|
385
|
+
this.getEnclavePublicKey = () => __async(this, null, function* () {
|
|
386
|
+
const res = yield this.baseRequest.get(
|
|
387
|
+
"/enclave/public-key"
|
|
388
|
+
);
|
|
389
|
+
return res.data;
|
|
390
|
+
});
|
|
391
|
+
/**
|
|
392
|
+
* Persist encrypted key shares to the enclave
|
|
393
|
+
* @param encryptedPayload JSON string containing the encrypted ECIES payload
|
|
394
|
+
*/
|
|
395
|
+
this.persistEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
|
|
396
|
+
const body = { encryptedPayload };
|
|
397
|
+
const res = yield this.baseRequest.post("/enclave/key-shares", body);
|
|
398
|
+
return res.data;
|
|
399
|
+
});
|
|
400
|
+
/**
|
|
401
|
+
* Retrieve encrypted key shares from the enclave
|
|
402
|
+
* @param encryptedPayload JSON string containing the encrypted ECIES query
|
|
403
|
+
*/
|
|
404
|
+
this.retrieveEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
|
|
405
|
+
const res = yield this.baseRequest.get(
|
|
406
|
+
`/enclave/key-shares?encryptedPayload=${encodeURIComponent(encryptedPayload)}`
|
|
407
|
+
);
|
|
408
|
+
return res.data;
|
|
409
|
+
});
|
|
410
|
+
this.refreshEnclaveJwt = (encryptedPayload) => __async(this, null, function* () {
|
|
411
|
+
const res = yield this.baseRequest.post(`/enclave/jwt/refresh`, { encryptedPayload });
|
|
412
|
+
return res.data;
|
|
413
|
+
});
|
|
351
414
|
const headers = __spreadValues(__spreadValues({}, apiKey && { [API_KEY_HEADER_NAME]: apiKey }), partnerId && { [PARTNER_ID_HEADER_NAME]: partnerId });
|
|
352
415
|
const axiosConfig = {
|
|
353
416
|
baseURL: userManagementHost,
|
|
@@ -523,8 +586,8 @@ class Client {
|
|
|
523
586
|
});
|
|
524
587
|
}
|
|
525
588
|
getFarcasterAuthStatus() {
|
|
526
|
-
return __async(this,
|
|
527
|
-
const res = yield this.baseRequest.post(`/auth/farcaster/status/v2
|
|
589
|
+
return __async(this, arguments, function* ({ sessionLookupId } = {}) {
|
|
590
|
+
const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`, { sessionLookupId });
|
|
528
591
|
return res.data;
|
|
529
592
|
});
|
|
530
593
|
}
|
|
@@ -834,6 +897,17 @@ class Client {
|
|
|
834
897
|
return res.data;
|
|
835
898
|
});
|
|
836
899
|
}
|
|
900
|
+
getSupportedAuthMethodsV2(auth) {
|
|
901
|
+
return __async(this, null, function* () {
|
|
902
|
+
const res = yield this.baseRequest.get(
|
|
903
|
+
"/users/supported-auth-methods/v2",
|
|
904
|
+
{
|
|
905
|
+
params: __spreadValues({}, auth)
|
|
906
|
+
}
|
|
907
|
+
);
|
|
908
|
+
return res.data;
|
|
909
|
+
});
|
|
910
|
+
}
|
|
837
911
|
getPasswords(auth) {
|
|
838
912
|
return __async(this, null, function* () {
|
|
839
913
|
const res = yield this.baseRequest.get("/users/passwords", {
|
|
@@ -853,9 +927,9 @@ class Client {
|
|
|
853
927
|
return res;
|
|
854
928
|
});
|
|
855
929
|
}
|
|
856
|
-
getEncryptedWalletPrivateKey(passwordId) {
|
|
930
|
+
getEncryptedWalletPrivateKey(passwordId, sessionLookupId) {
|
|
857
931
|
return __async(this, null, function* () {
|
|
858
|
-
const query = new URLSearchParams({ passwordId }).toString();
|
|
932
|
+
const query = new URLSearchParams({ passwordId, sessionLookupId }).toString();
|
|
859
933
|
const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
|
|
860
934
|
return res;
|
|
861
935
|
});
|
package/dist/esm/types/auth.js
CHANGED
|
@@ -65,14 +65,22 @@ const LINKED_ACCOUNT_TYPES = [
|
|
|
65
65
|
var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
|
|
66
66
|
AuthMethod2["PASSWORD"] = "PASSWORD";
|
|
67
67
|
AuthMethod2["PASSKEY"] = "PASSKEY";
|
|
68
|
+
AuthMethod2["PIN"] = "PIN";
|
|
69
|
+
AuthMethod2["SLO"] = "SLO";
|
|
68
70
|
return AuthMethod2;
|
|
69
71
|
})(AuthMethod || {});
|
|
72
|
+
var LegacyAuthMethod = /* @__PURE__ */ ((LegacyAuthMethod2) => {
|
|
73
|
+
LegacyAuthMethod2["PASSWORD"] = "PASSWORD";
|
|
74
|
+
LegacyAuthMethod2["BIOMETRIC"] = "BIOMETRIC";
|
|
75
|
+
return LegacyAuthMethod2;
|
|
76
|
+
})(LegacyAuthMethod || {});
|
|
70
77
|
export {
|
|
71
78
|
AUTH_TYPES,
|
|
72
79
|
AuthMethod,
|
|
73
80
|
EncryptorType,
|
|
74
81
|
KeyShareType,
|
|
75
82
|
LINKED_ACCOUNT_TYPES,
|
|
83
|
+
LegacyAuthMethod,
|
|
76
84
|
OAUTH_METHODS,
|
|
77
85
|
OAuthMethod,
|
|
78
86
|
PasswordStatus,
|
package/dist/types/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
|
-
import { AccountMetadata, Auth, AuthIdentifier, AuthMethod, BackupKitEmailProps, BiometricLocationHint, Chain, CurrentWalletIds, EncryptedKeyShare, EncryptorType, ExternalWalletInfo, LoginExternalWalletResponse, KeyShareType, Network, OnRampAsset, OnRampConfig, OnRampProvider, OnRampPurchase, OnRampPurchaseCreateParams, OnRampPurchaseUpdateParams, PasswordStatus, PregenIds, PrimaryAuth, PublicKeyStatus, PublicKeyType, ServerAuthStateSignup, SessionInfo, Setup2faResponse, SignUpOrLogInResponse, TelegramAuthResponse, TPregenIdentifierType, VerificationEmailProps, VerifiedAuth, VerifyFarcasterResponse, VerifyTelegramResponse, VerifyThirdPartyAuth, WalletEntity, WalletParams, TWalletScheme, TWalletType, VerifyExternalWalletParams, IssueJwtParams, IssueJwtResponse, LinkAccountParams, LinkedAccounts, ResendVerificationCodeParams } from './types/index.js';
|
|
2
|
+
import { AccountMetadata, Auth, AuthIdentifier, AuthMethod, BackupKitEmailProps, BiometricLocationHint, Chain, CurrentWalletIds, EncryptedKeyShare, EncryptorType, ExternalWalletInfo, LoginExternalWalletResponse, KeyShareType, Network, OnRampAsset, OnRampConfig, OnRampProvider, OnRampPurchase, OnRampPurchaseCreateParams, OnRampPurchaseUpdateParams, PasswordStatus, PregenIds, PrimaryAuth, PublicKeyStatus, PublicKeyType, ServerAuthStateSignup, SessionInfo, Setup2faResponse, SignUpOrLogInResponse, TelegramAuthResponse, TPregenIdentifierType, VerificationEmailProps, VerifiedAuth, VerifyFarcasterResponse, VerifyTelegramResponse, VerifyThirdPartyAuth, WalletEntity, WalletParams, TWalletScheme, TWalletType, VerifyExternalWalletParams, IssueJwtParams, IssueJwtResponse, LinkAccountParams, LinkedAccounts, ResendVerificationCodeParams, LegacyAuthMethod, PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateDone } from './types/index.js';
|
|
3
3
|
interface ConfigOpts {
|
|
4
4
|
useFetchAdapter?: boolean;
|
|
5
5
|
}
|
|
@@ -18,6 +18,7 @@ interface createUserIdRes {
|
|
|
18
18
|
}
|
|
19
19
|
interface verifyBody {
|
|
20
20
|
verificationCode: string;
|
|
21
|
+
sessionLookupId?: string;
|
|
21
22
|
}
|
|
22
23
|
interface getWebChallengeRes {
|
|
23
24
|
challenge: string;
|
|
@@ -67,6 +68,7 @@ interface PasswordEntity {
|
|
|
67
68
|
status: PasswordStatus;
|
|
68
69
|
sigDerivedPublicKey: string;
|
|
69
70
|
salt: string;
|
|
71
|
+
isPIN?: boolean;
|
|
70
72
|
}
|
|
71
73
|
interface createWalletBody {
|
|
72
74
|
useTwoSigners?: boolean;
|
|
@@ -117,6 +119,7 @@ interface sessionPasswordBody {
|
|
|
117
119
|
salt?: string;
|
|
118
120
|
encryptedWalletPrivateKey?: string;
|
|
119
121
|
encryptionKeyHash?: string;
|
|
122
|
+
isPIN?: boolean;
|
|
120
123
|
}
|
|
121
124
|
interface EncryptedWalletPrivateKey {
|
|
122
125
|
id: string;
|
|
@@ -148,13 +151,19 @@ declare class Client {
|
|
|
148
151
|
*/
|
|
149
152
|
createUser: (body: VerifiedAuth & VerificationEmailProps) => Promise<createUserIdRes>;
|
|
150
153
|
checkUserExists: (auth: VerifiedAuth) => Promise<any>;
|
|
151
|
-
verifyTelegram: (authObject
|
|
154
|
+
verifyTelegram: ({ authObject, sessionLookupId, }: {
|
|
155
|
+
authObject: TelegramAuthResponse;
|
|
156
|
+
sessionLookupId?: string;
|
|
157
|
+
}) => Promise<VerifyTelegramResponse>;
|
|
152
158
|
verifyOAuth: () => Promise<VerifyThirdPartyAuth | null>;
|
|
153
159
|
loginExternalWallet: ({ externalWallet, shouldTrackUser, }: {
|
|
154
160
|
externalWallet: ExternalWalletInfo;
|
|
155
161
|
shouldTrackUser?: boolean;
|
|
156
162
|
}) => Promise<LoginExternalWalletResponse>;
|
|
157
|
-
|
|
163
|
+
verifyAccount: (userId: string, body: verifyBody) => Promise<ServerAuthStateSignup | ServerAuthStateLogin | ServerAuthStateDone>;
|
|
164
|
+
sendLoginVerificationCode: (auth: PrimaryAuthInfo, isRecovery?: boolean) => Promise<{
|
|
165
|
+
userId: string;
|
|
166
|
+
}>;
|
|
158
167
|
getLinkedAccounts: ({ userId, withMetadata, }: {
|
|
159
168
|
userId: string;
|
|
160
169
|
withMetadata?: boolean;
|
|
@@ -191,7 +200,7 @@ declare class Client {
|
|
|
191
200
|
* @deprecated
|
|
192
201
|
*/
|
|
193
202
|
verifyPhone: (userId: string, body: verifyBody) => Promise<any>;
|
|
194
|
-
verifyExternalWallet: (userId: string, body: VerifyExternalWalletParams) => Promise<ServerAuthStateSignup>;
|
|
203
|
+
verifyExternalWallet: (userId: string, body: VerifyExternalWalletParams) => Promise<ServerAuthStateSignup | ServerAuthStateLogin>;
|
|
195
204
|
addSessionPublicKey: (userId: string, body: sessionPublicKeyBody) => Promise<any>;
|
|
196
205
|
getSessionPublicKeys: (userId: string) => Promise<any>;
|
|
197
206
|
getBiometricLocationHints: (auth: PrimaryAuth) => Promise<BiometricLocationHint[]>;
|
|
@@ -202,6 +211,21 @@ declare class Client {
|
|
|
202
211
|
sessionOrigin: (sessionLookupId: string) => Promise<{
|
|
203
212
|
origin?: string;
|
|
204
213
|
}>;
|
|
214
|
+
sessionLoginMethod: (sessionLookupId: string) => Promise<{
|
|
215
|
+
loginMethod?: string;
|
|
216
|
+
}>;
|
|
217
|
+
sessionAuthVerified: (sessionLookupId: string) => Promise<{
|
|
218
|
+
authVerified?: boolean;
|
|
219
|
+
}>;
|
|
220
|
+
sessionAuth: (sessionLookupId: string) => Promise<{
|
|
221
|
+
userId: string;
|
|
222
|
+
authVerified?: boolean;
|
|
223
|
+
loginAuthMethods: {
|
|
224
|
+
methods: AuthMethod[];
|
|
225
|
+
};
|
|
226
|
+
auth: PrimaryAuth;
|
|
227
|
+
isNewUser: boolean;
|
|
228
|
+
}>;
|
|
205
229
|
verifyWebChallenge: (partnerId: string, body: verifyWebChallengeBody) => Promise<any>;
|
|
206
230
|
getSessionChallenge: (userId: string) => Promise<any>;
|
|
207
231
|
verifySessionChallenge: (userId: string, body: verifySessionChallengeBody) => Promise<any>;
|
|
@@ -257,7 +281,9 @@ declare class Client {
|
|
|
257
281
|
initializeFarcasterLogin({ appScheme }?: {
|
|
258
282
|
appScheme?: string;
|
|
259
283
|
}): Promise<any>;
|
|
260
|
-
getFarcasterAuthStatus(
|
|
284
|
+
getFarcasterAuthStatus({ sessionLookupId }?: {
|
|
285
|
+
sessionLookupId?: string;
|
|
286
|
+
}): Promise<VerifyFarcasterResponse>;
|
|
261
287
|
initializeRecoveryForPhone(phone: string, countryCode: string): Promise<AxiosResponse<any, any>>;
|
|
262
288
|
finalizeRecovery(userId: string, walletId: string): Promise<AxiosResponse<any, any>>;
|
|
263
289
|
recoverUserShares(userId: string, walletId: string): Promise<AxiosResponse<{
|
|
@@ -370,10 +396,16 @@ declare class Client {
|
|
|
370
396
|
deletePendingTransaction(userId: string, pendingTransactionId: string): Promise<any>;
|
|
371
397
|
addSessionPasswordPublicKey(userId: string, body: sessionPasswordBody): Promise<any>;
|
|
372
398
|
patchSessionPassword: (partnerId: string, userId: string, passwordId: string, body: sessionPasswordBody) => Promise<any>;
|
|
373
|
-
getSupportedAuthMethods(auth: Auth): Promise<
|
|
399
|
+
getSupportedAuthMethods(auth: Auth): Promise<{
|
|
400
|
+
supportedAuthMethods: LegacyAuthMethod[];
|
|
401
|
+
}>;
|
|
402
|
+
getSupportedAuthMethodsV2(auth: Auth): Promise<{
|
|
403
|
+
supportedAuthMethods: AuthMethod[];
|
|
404
|
+
hasPasswordWithoutPIN: boolean;
|
|
405
|
+
}>;
|
|
374
406
|
getPasswords(auth: Auth): Promise<PasswordEntity[]>;
|
|
375
407
|
verifyPasswordChallenge(partnerId: string, body: verifyPasswordChallengeBody): Promise<any>;
|
|
376
|
-
getEncryptedWalletPrivateKey(passwordId: string): Promise<{
|
|
408
|
+
getEncryptedWalletPrivateKey(passwordId: string, sessionLookupId: string): Promise<{
|
|
377
409
|
data: {
|
|
378
410
|
encryptedWalletPrivateKey: EncryptedWalletPrivateKey;
|
|
379
411
|
};
|
|
@@ -400,5 +432,30 @@ declare class Client {
|
|
|
400
432
|
props: object;
|
|
401
433
|
reactSdkVersion: string;
|
|
402
434
|
}) => Promise<void>;
|
|
435
|
+
/**
|
|
436
|
+
* Get the enclave's public key for encryption
|
|
437
|
+
*/
|
|
438
|
+
getEnclavePublicKey: () => Promise<{
|
|
439
|
+
publicKey: string;
|
|
440
|
+
keyFingerprint: string;
|
|
441
|
+
generatedAt: string;
|
|
442
|
+
}>;
|
|
443
|
+
/**
|
|
444
|
+
* Persist encrypted key shares to the enclave
|
|
445
|
+
* @param encryptedPayload JSON string containing the encrypted ECIES payload
|
|
446
|
+
*/
|
|
447
|
+
persistEnclaveShares: (encryptedPayload: string) => Promise<{
|
|
448
|
+
payload: any;
|
|
449
|
+
}>;
|
|
450
|
+
/**
|
|
451
|
+
* Retrieve encrypted key shares from the enclave
|
|
452
|
+
* @param encryptedPayload JSON string containing the encrypted ECIES query
|
|
453
|
+
*/
|
|
454
|
+
retrieveEnclaveShares: (encryptedPayload: string) => Promise<{
|
|
455
|
+
payload: any;
|
|
456
|
+
}>;
|
|
457
|
+
refreshEnclaveJwt: (encryptedPayload: string) => Promise<{
|
|
458
|
+
payload: string;
|
|
459
|
+
}>;
|
|
403
460
|
}
|
|
404
461
|
export default Client;
|
|
@@ -117,7 +117,13 @@ export type TLinkedAccountType = (typeof LINKED_ACCOUNT_TYPES)[number] | 'EXTERN
|
|
|
117
117
|
export type SupportedAccountLinks = (TLinkedAccountType | TExternalWallet)[];
|
|
118
118
|
export declare enum AuthMethod {
|
|
119
119
|
PASSWORD = "PASSWORD",
|
|
120
|
-
PASSKEY = "PASSKEY"
|
|
120
|
+
PASSKEY = "PASSKEY",
|
|
121
|
+
PIN = "PIN",
|
|
122
|
+
SLO = "SLO"
|
|
123
|
+
}
|
|
124
|
+
export declare enum LegacyAuthMethod {
|
|
125
|
+
PASSWORD = "PASSWORD",
|
|
126
|
+
BIOMETRIC = "BIOMETRIC"
|
|
121
127
|
}
|
|
122
128
|
export type BiometricLocationHint = {
|
|
123
129
|
useragent?: string;
|
|
@@ -154,7 +160,13 @@ export type ServerAuthStateBase = AuthExtras & {
|
|
|
154
160
|
export type ServerAuthStateVerify = ServerAuthStateBase & {
|
|
155
161
|
stage: 'verify';
|
|
156
162
|
signatureVerificationMessage?: string;
|
|
157
|
-
}
|
|
163
|
+
} & ({
|
|
164
|
+
nextStage: 'login';
|
|
165
|
+
loginAuthMethods: AuthMethod[];
|
|
166
|
+
} | {
|
|
167
|
+
nextStage: 'signup';
|
|
168
|
+
signupAuthMethods: AuthMethod[];
|
|
169
|
+
});
|
|
158
170
|
export type ServerAuthStateSignup = ServerAuthStateBase & {
|
|
159
171
|
stage: 'signup';
|
|
160
172
|
signupAuthMethods: AuthMethod[];
|
|
@@ -164,13 +176,22 @@ export type ServerAuthStateLogin = ServerAuthStateBase & {
|
|
|
164
176
|
biometricHints?: BiometricLocationHint[];
|
|
165
177
|
loginAuthMethods: AuthMethod[];
|
|
166
178
|
isWalletSelectionNeeded?: boolean;
|
|
179
|
+
hasPasswordWithoutPIN?: boolean;
|
|
180
|
+
signatureVerificationMessage?: string;
|
|
167
181
|
};
|
|
168
|
-
export type
|
|
182
|
+
export type ServerAuthStateDone = ServerAuthStateBase & {
|
|
183
|
+
stage: 'done';
|
|
184
|
+
authMethods: AuthMethod[];
|
|
185
|
+
isWalletSelectionNeeded?: boolean;
|
|
186
|
+
isNewUser: boolean;
|
|
187
|
+
};
|
|
188
|
+
export type VerifyThirdPartyAuth = ServerAuthStateSignup | ServerAuthStateLogin | ServerAuthStateDone;
|
|
169
189
|
export type ExternalWalletInfo = {
|
|
190
|
+
partnerId: string;
|
|
170
191
|
address: string;
|
|
171
192
|
type: ExternalWalletType;
|
|
172
193
|
provider?: string;
|
|
173
|
-
providerId?:
|
|
194
|
+
providerId?: string;
|
|
174
195
|
addressBech32?: string;
|
|
175
196
|
withFullParaAuth?: boolean;
|
|
176
197
|
ensName?: string | null;
|
|
@@ -201,7 +222,7 @@ export type LoginExternalWalletResponse = ServerAuthStateLogin | (ServerAuthStat
|
|
|
201
222
|
});
|
|
202
223
|
export type VerifyTelegramResponse = VerifyThirdPartyAuth;
|
|
203
224
|
export type VerifyFarcasterResponse = VerifyThirdPartyAuth | Record<string, never>;
|
|
204
|
-
export type ServerAuthState = ServerAuthStateVerify | ServerAuthStateSignup | ServerAuthStateLogin;
|
|
225
|
+
export type ServerAuthState = ServerAuthStateVerify | ServerAuthStateSignup | ServerAuthStateLogin | ServerAuthStateDone;
|
|
205
226
|
export type SignUpOrLogInResponse = ServerAuthStateVerify | ServerAuthStateLogin;
|
|
206
227
|
export type Setup2faResponse = {
|
|
207
228
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/user-management-client",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.6",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"axios": "^1.8.4",
|
|
6
6
|
"libphonenumber-js": "^1.11.7"
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dist",
|
|
20
20
|
"package.json"
|
|
21
21
|
],
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "c2125e37c73a19f11978031f5aa2eab39b978c56",
|
|
23
23
|
"main": "dist/cjs/index.js",
|
|
24
24
|
"module": "dist/esm/index.js",
|
|
25
25
|
"scripts": {
|