@getpara/user-management-client 2.0.0-alpha.6 → 2.0.0-alpha.61
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 +174 -32
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/utils.js +12 -0
- package/dist/esm/client.js +175 -33
- package/dist/esm/index.js +1 -1
- package/dist/esm/utils.js +11 -0
- package/dist/types/client.d.ts +135 -18
- package/dist/types/index.d.ts +1 -1
- package/dist/types/utils.d.ts +2 -3
- package/package.json +22 -21
- package/dist/cjs/types/auth.js +0 -98
- package/dist/cjs/types/email.js +0 -31
- package/dist/cjs/types/index.js +0 -29
- package/dist/cjs/types/onRamp.js +0 -62
- package/dist/cjs/types/partner.js +0 -15
- package/dist/cjs/types/wallet.js +0 -85
- package/dist/esm/types/auth.js +0 -68
- package/dist/esm/types/email.js +0 -9
- package/dist/esm/types/index.js +0 -5
- package/dist/esm/types/onRamp.js +0 -37
- package/dist/esm/types/partner.js +0 -0
- package/dist/esm/types/wallet.js +0 -56
- package/dist/types/types/auth.d.ts +0 -215
- package/dist/types/types/email.d.ts +0 -22
- package/dist/types/types/index.d.ts +0 -5
- package/dist/types/types/onRamp.d.ts +0 -68
- package/dist/types/types/partner.d.ts +0 -20
- package/dist/types/types/wallet.d.ts +0 -73
package/dist/esm/client.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__spreadValues
|
|
6
6
|
} from "./chunk-BBZEL7EG.js";
|
|
7
7
|
import axios from "axios";
|
|
8
|
-
import { extractWalletRef, fromAccountMetadata } from "./utils.js";
|
|
8
|
+
import { extractWalletRef, fromAccountMetadata, fromLinkedAccounts } from "./utils.js";
|
|
9
9
|
import { SESSION_COOKIE_HEADER_NAME, VERSION_HEADER_NAME, PARTNER_ID_HEADER_NAME, API_KEY_HEADER_NAME } from "./consts.js";
|
|
10
10
|
import { ParaApiError } from "./error.js";
|
|
11
11
|
const handleResponseSuccess = (response) => {
|
|
@@ -53,11 +53,15 @@ class Client {
|
|
|
53
53
|
const res = yield this.baseRequest.get("/users/exists", {
|
|
54
54
|
params: __spreadValues({}, auth)
|
|
55
55
|
});
|
|
56
|
-
return res;
|
|
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,57 @@ 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 }));
|
|
91
|
+
return res.data;
|
|
92
|
+
});
|
|
93
|
+
this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
|
|
94
|
+
userId,
|
|
95
|
+
withMetadata = false
|
|
96
|
+
}) {
|
|
97
|
+
const res = yield this.baseRequest.get(
|
|
98
|
+
`/users/${userId}/linked-accounts`,
|
|
99
|
+
...withMetadata ? [
|
|
100
|
+
{
|
|
101
|
+
params: { withMetadata }
|
|
102
|
+
}
|
|
103
|
+
] : []
|
|
104
|
+
);
|
|
105
|
+
return { accounts: fromLinkedAccounts(res.data.accounts) };
|
|
106
|
+
});
|
|
107
|
+
this.linkAccount = (_a) => __async(this, null, function* () {
|
|
108
|
+
var _b = _a, { userId } = _b, opts = __objRest(_b, ["userId"]);
|
|
109
|
+
const res = yield this.baseRequest.post(`/users/${userId}/linked-accounts`, opts);
|
|
110
|
+
return res.data;
|
|
111
|
+
});
|
|
112
|
+
this.verifyLink = (_c) => __async(this, null, function* () {
|
|
113
|
+
var _d = _c, {
|
|
114
|
+
linkedAccountId,
|
|
115
|
+
userId
|
|
116
|
+
} = _d, opts = __objRest(_d, [
|
|
117
|
+
"linkedAccountId",
|
|
118
|
+
"userId"
|
|
119
|
+
]);
|
|
120
|
+
const res = yield this.baseRequest.post(
|
|
121
|
+
`/users/${userId}/linked-accounts/${linkedAccountId}/verify`,
|
|
122
|
+
opts
|
|
123
|
+
);
|
|
124
|
+
if ("isConflict" in res.data) {
|
|
125
|
+
return res.data;
|
|
126
|
+
}
|
|
127
|
+
const { accounts } = res.data;
|
|
128
|
+
return { accounts: fromLinkedAccounts(accounts) };
|
|
129
|
+
});
|
|
130
|
+
this.unlinkAccount = (_0) => __async(this, [_0], function* ({ linkedAccountId, userId }) {
|
|
131
|
+
const res = yield this.baseRequest.delete(`/users/${userId}/linked-accounts/${linkedAccountId}`);
|
|
79
132
|
return res.data;
|
|
80
133
|
});
|
|
81
134
|
// POST /users/:userId/verify-email
|
|
@@ -94,7 +147,10 @@ class Client {
|
|
|
94
147
|
return res;
|
|
95
148
|
});
|
|
96
149
|
this.verifyExternalWallet = (userId, body) => __async(this, null, function* () {
|
|
97
|
-
const res = yield this.baseRequest.post(
|
|
150
|
+
const res = yield this.baseRequest.post(
|
|
151
|
+
`/users/${userId}/external-wallets/verify/v2`,
|
|
152
|
+
body
|
|
153
|
+
);
|
|
98
154
|
return res.data;
|
|
99
155
|
});
|
|
100
156
|
// POST /users/:userId/biometrics/key
|
|
@@ -140,11 +196,26 @@ class Client {
|
|
|
140
196
|
const res = yield this.baseRequest.post(`/touch?regenerate=${!!regenerate}`);
|
|
141
197
|
return res.data;
|
|
142
198
|
});
|
|
143
|
-
// GET /
|
|
199
|
+
// GET /sessions/:sessionLookupId/origin
|
|
144
200
|
this.sessionOrigin = (sessionLookupId) => __async(this, null, function* () {
|
|
145
201
|
const res = yield this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
|
|
146
202
|
return res.data;
|
|
147
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
|
+
});
|
|
148
219
|
// POST /biometrics/verify
|
|
149
220
|
this.verifyWebChallenge = (partnerId, body) => __async(this, null, function* () {
|
|
150
221
|
const res = yield this.baseRequest.post(`/biometrics/verify`, body, {
|
|
@@ -257,8 +328,8 @@ class Client {
|
|
|
257
328
|
const res = yield this.baseRequest.post("/recovery", body);
|
|
258
329
|
return res;
|
|
259
330
|
});
|
|
260
|
-
this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc) => __async(this, null, function* () {
|
|
261
|
-
const body = { message, scheme, cosmosSignDoc };
|
|
331
|
+
this.preSignMessage = (userId, walletId, message, scheme, cosmosSignDoc, protocolId) => __async(this, null, function* () {
|
|
332
|
+
const body = { message, scheme, cosmosSignDoc, protocolId };
|
|
262
333
|
const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/messages/sign`, body);
|
|
263
334
|
return res.data;
|
|
264
335
|
});
|
|
@@ -297,9 +368,69 @@ class Client {
|
|
|
297
368
|
});
|
|
298
369
|
return res.data;
|
|
299
370
|
});
|
|
371
|
+
this.issueJwt = (..._0) => __async(this, [..._0], function* ({ keyIndex = 0 } = {}) {
|
|
372
|
+
const res = yield this.baseRequest.post(`/auth/jwt`, { keyIndex });
|
|
373
|
+
return res.data;
|
|
374
|
+
});
|
|
375
|
+
this.getProfileBalance = (_0) => __async(this, [_0], function* ({
|
|
376
|
+
config,
|
|
377
|
+
wallets,
|
|
378
|
+
refetch
|
|
379
|
+
}) {
|
|
380
|
+
const res = yield this.baseRequest.post(`/assets/balances`, {
|
|
381
|
+
config,
|
|
382
|
+
wallets,
|
|
383
|
+
refetch
|
|
384
|
+
});
|
|
385
|
+
return res.data;
|
|
386
|
+
});
|
|
387
|
+
this.getAssetInfo = () => __async(this, null, function* () {
|
|
388
|
+
const res = yield this.baseRequest.get(`/assets`);
|
|
389
|
+
return res.data;
|
|
390
|
+
});
|
|
300
391
|
this.trackError = (opts) => __async(this, null, function* () {
|
|
301
392
|
yield this.baseRequest.post("/errors/sdk", opts);
|
|
302
393
|
});
|
|
394
|
+
this.trackReactSdkAnalytics = (opts) => __async(this, null, function* () {
|
|
395
|
+
yield this.baseRequest.post("/partners/analytics/react-sdk", opts);
|
|
396
|
+
});
|
|
397
|
+
// ENCLAVE METHODS
|
|
398
|
+
/**
|
|
399
|
+
* Get the enclave's public key for encryption
|
|
400
|
+
*/
|
|
401
|
+
this.getEnclavePublicKey = () => __async(this, null, function* () {
|
|
402
|
+
const res = yield this.baseRequest.get(
|
|
403
|
+
"/enclave/public-key"
|
|
404
|
+
);
|
|
405
|
+
return res.data;
|
|
406
|
+
});
|
|
407
|
+
/**
|
|
408
|
+
* Persist encrypted key shares to the enclave
|
|
409
|
+
* @param encryptedPayload JSON string containing the encrypted ECIES payload
|
|
410
|
+
*/
|
|
411
|
+
this.persistEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
|
|
412
|
+
const body = { encryptedPayload };
|
|
413
|
+
const res = yield this.baseRequest.post("/enclave/key-shares", body);
|
|
414
|
+
return res.data;
|
|
415
|
+
});
|
|
416
|
+
/**
|
|
417
|
+
* Retrieve encrypted key shares from the enclave
|
|
418
|
+
* @param encryptedPayload JSON string containing the encrypted ECIES query
|
|
419
|
+
*/
|
|
420
|
+
this.retrieveEnclaveShares = (encryptedPayload) => __async(this, null, function* () {
|
|
421
|
+
const res = yield this.baseRequest.get(
|
|
422
|
+
`/enclave/key-shares?encryptedPayload=${encodeURIComponent(encryptedPayload)}`
|
|
423
|
+
);
|
|
424
|
+
return res.data;
|
|
425
|
+
});
|
|
426
|
+
this.issueEnclaveJwt = (encryptedPayload) => __async(this, null, function* () {
|
|
427
|
+
const res = yield this.baseRequest.post(`/enclave/jwt/issue`, { encryptedPayload });
|
|
428
|
+
return res.data;
|
|
429
|
+
});
|
|
430
|
+
this.refreshEnclaveJwt = (encryptedPayload) => __async(this, null, function* () {
|
|
431
|
+
const res = yield this.baseRequest.post(`/enclave/jwt/refresh`, { encryptedPayload });
|
|
432
|
+
return res.data;
|
|
433
|
+
});
|
|
303
434
|
const headers = __spreadValues(__spreadValues({}, apiKey && { [API_KEY_HEADER_NAME]: apiKey }), partnerId && { [PARTNER_ID_HEADER_NAME]: partnerId });
|
|
304
435
|
const axiosConfig = {
|
|
305
436
|
baseURL: userManagementHost,
|
|
@@ -418,17 +549,17 @@ class Client {
|
|
|
418
549
|
});
|
|
419
550
|
}
|
|
420
551
|
// POST '/users/:userId/resend-verification-code
|
|
421
|
-
resendVerificationCode(
|
|
552
|
+
resendVerificationCode(_e) {
|
|
422
553
|
return __async(this, null, function* () {
|
|
423
|
-
var
|
|
554
|
+
var _f = _e, { userId } = _f, rest = __objRest(_f, ["userId"]);
|
|
424
555
|
const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest);
|
|
425
556
|
return res;
|
|
426
557
|
});
|
|
427
558
|
}
|
|
428
559
|
// POST '/users/:userId/resend-verification-code-by-phone
|
|
429
|
-
resendVerificationCodeByPhone(
|
|
560
|
+
resendVerificationCodeByPhone(_g) {
|
|
430
561
|
return __async(this, null, function* () {
|
|
431
|
-
var
|
|
562
|
+
var _h = _g, { userId } = _h, rest = __objRest(_h, ["userId"]);
|
|
432
563
|
const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code-by-phone`, rest);
|
|
433
564
|
return res;
|
|
434
565
|
});
|
|
@@ -469,14 +600,14 @@ class Client {
|
|
|
469
600
|
}
|
|
470
601
|
// POST /auth/farcaster/init
|
|
471
602
|
initializeFarcasterLogin() {
|
|
472
|
-
return __async(this,
|
|
473
|
-
const res = yield this.baseRequest.post(`/auth/farcaster/init
|
|
474
|
-
return res;
|
|
603
|
+
return __async(this, arguments, function* ({ appScheme } = {}) {
|
|
604
|
+
const res = yield this.baseRequest.post(`/auth/farcaster/init`, { appScheme });
|
|
605
|
+
return res.data;
|
|
475
606
|
});
|
|
476
607
|
}
|
|
477
608
|
getFarcasterAuthStatus() {
|
|
478
|
-
return __async(this,
|
|
479
|
-
const res = yield this.baseRequest.post(`/auth/farcaster/status/v2
|
|
609
|
+
return __async(this, arguments, function* ({ sessionLookupId } = {}) {
|
|
610
|
+
const res = yield this.baseRequest.post(`/auth/farcaster/status/v2`, { sessionLookupId });
|
|
480
611
|
return res.data;
|
|
481
612
|
});
|
|
482
613
|
}
|
|
@@ -578,12 +709,12 @@ class Client {
|
|
|
578
709
|
return res.data;
|
|
579
710
|
});
|
|
580
711
|
}
|
|
581
|
-
createOnRampPurchase(
|
|
712
|
+
createOnRampPurchase(_i) {
|
|
582
713
|
return __async(this, null, function* () {
|
|
583
|
-
var
|
|
714
|
+
var _j = _i, {
|
|
584
715
|
userId,
|
|
585
716
|
params
|
|
586
|
-
} =
|
|
717
|
+
} = _j, walletParams = __objRest(_j, [
|
|
587
718
|
"userId",
|
|
588
719
|
"params"
|
|
589
720
|
]);
|
|
@@ -593,13 +724,13 @@ class Client {
|
|
|
593
724
|
return res.data;
|
|
594
725
|
});
|
|
595
726
|
}
|
|
596
|
-
updateOnRampPurchase(
|
|
727
|
+
updateOnRampPurchase(_k) {
|
|
597
728
|
return __async(this, null, function* () {
|
|
598
|
-
var
|
|
729
|
+
var _l = _k, {
|
|
599
730
|
userId,
|
|
600
731
|
purchaseId,
|
|
601
732
|
updates
|
|
602
|
-
} =
|
|
733
|
+
} = _l, params = __objRest(_l, [
|
|
603
734
|
"userId",
|
|
604
735
|
"purchaseId",
|
|
605
736
|
"updates"
|
|
@@ -613,12 +744,12 @@ class Client {
|
|
|
613
744
|
return res.data;
|
|
614
745
|
});
|
|
615
746
|
}
|
|
616
|
-
getOnRampPurchase(
|
|
747
|
+
getOnRampPurchase(_m) {
|
|
617
748
|
return __async(this, null, function* () {
|
|
618
|
-
var
|
|
749
|
+
var _n = _m, {
|
|
619
750
|
userId,
|
|
620
751
|
purchaseId
|
|
621
|
-
} =
|
|
752
|
+
} = _n, params = __objRest(_n, [
|
|
622
753
|
"userId",
|
|
623
754
|
"purchaseId"
|
|
624
755
|
]);
|
|
@@ -692,12 +823,12 @@ class Client {
|
|
|
692
823
|
return res.data;
|
|
693
824
|
});
|
|
694
825
|
}
|
|
695
|
-
distributeParaShare(
|
|
826
|
+
distributeParaShare(_o) {
|
|
696
827
|
return __async(this, null, function* () {
|
|
697
|
-
var
|
|
828
|
+
var _p = _o, {
|
|
698
829
|
userId,
|
|
699
830
|
walletId
|
|
700
|
-
} =
|
|
831
|
+
} = _p, rest = __objRest(_p, [
|
|
701
832
|
"userId",
|
|
702
833
|
"walletId"
|
|
703
834
|
]);
|
|
@@ -786,6 +917,17 @@ class Client {
|
|
|
786
917
|
return res.data;
|
|
787
918
|
});
|
|
788
919
|
}
|
|
920
|
+
getSupportedAuthMethodsV2(auth) {
|
|
921
|
+
return __async(this, null, function* () {
|
|
922
|
+
const res = yield this.baseRequest.get(
|
|
923
|
+
"/users/supported-auth-methods/v2",
|
|
924
|
+
{
|
|
925
|
+
params: __spreadValues({}, auth)
|
|
926
|
+
}
|
|
927
|
+
);
|
|
928
|
+
return res.data;
|
|
929
|
+
});
|
|
930
|
+
}
|
|
789
931
|
getPasswords(auth) {
|
|
790
932
|
return __async(this, null, function* () {
|
|
791
933
|
const res = yield this.baseRequest.get("/users/passwords", {
|
|
@@ -805,9 +947,9 @@ class Client {
|
|
|
805
947
|
return res;
|
|
806
948
|
});
|
|
807
949
|
}
|
|
808
|
-
getEncryptedWalletPrivateKey(passwordId) {
|
|
950
|
+
getEncryptedWalletPrivateKey(passwordId, sessionLookupId) {
|
|
809
951
|
return __async(this, null, function* () {
|
|
810
|
-
const query = new URLSearchParams({ passwordId }).toString();
|
|
952
|
+
const query = new URLSearchParams({ passwordId, sessionLookupId }).toString();
|
|
811
953
|
const res = yield this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
|
|
812
954
|
return res;
|
|
813
955
|
});
|
package/dist/esm/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./chunk-BBZEL7EG.js";
|
|
2
2
|
export * from "./client.js";
|
|
3
|
-
export * from "./types/index.js";
|
|
4
3
|
export * from "./utils.js";
|
|
5
4
|
export * from "./error.js";
|
|
5
|
+
export * from "@getpara/shared";
|
|
6
6
|
import Client from "./client.js";
|
|
7
7
|
var src_default = Client;
|
|
8
8
|
export {
|
package/dist/esm/utils.js
CHANGED
|
@@ -179,10 +179,21 @@ function fromAccountMetadata(obj) {
|
|
|
179
179
|
{}
|
|
180
180
|
);
|
|
181
181
|
}
|
|
182
|
+
function fromLinkedAccounts({ primary, linked }) {
|
|
183
|
+
return {
|
|
184
|
+
primary: primary.map((account) => __spreadProps(__spreadValues({}, account), {
|
|
185
|
+
date: new Date(account.date)
|
|
186
|
+
})),
|
|
187
|
+
linked: linked.map((account) => __spreadProps(__spreadValues({}, account), {
|
|
188
|
+
date: new Date(account.date)
|
|
189
|
+
}))
|
|
190
|
+
};
|
|
191
|
+
}
|
|
182
192
|
export {
|
|
183
193
|
extractAuthInfo,
|
|
184
194
|
extractWalletRef,
|
|
185
195
|
fromAccountMetadata,
|
|
196
|
+
fromLinkedAccounts,
|
|
186
197
|
isCustomId,
|
|
187
198
|
isDiscord,
|
|
188
199
|
isEmail,
|
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,
|
|
2
|
+
import { AccountMetadata, Auth, AuthIdentifier, AuthMethod, BackupKitEmailProps, BiometricLocationHint, Chain, CurrentWalletIds, EncryptedKeyShare, EncryptorType, ExternalWalletInfo, LoginExternalWalletResponse, KeyShareType, Network, OnRampAsset, OnRampConfig, OnRampProvider, OnRampPurchase, OnRampPurchaseCreateParams, OnRampPurchaseUpdateParams, AuthMethodStatus, PregenIds, PrimaryAuth, PublicKeyType, ServerAuthStateSignup, SessionInfo, Setup2faResponse, SignUpOrLogInResponse, TelegramAuthResponse, TPregenIdentifierType, VerificationEmailProps, VerifiedAuth, VerifyFarcasterResponse, VerifyTelegramResponse, VerifyThirdPartyAuth, WalletEntity, WalletParams, TWalletScheme, TWalletType, VerifyExternalWalletParams, IssueJwtParams, IssueJwtResponse, LinkAccountParams, LinkedAccounts, ResendVerificationCodeParams, AssetMetadataIndexed, GetProfileBalanceParams, ProfileBalance, LegacyAuthMethod, PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateDone } from '@getpara/shared';
|
|
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;
|
|
@@ -26,7 +27,7 @@ interface getWebChallengeRes {
|
|
|
26
27
|
interface sessionPublicKeyBody {
|
|
27
28
|
publicKey?: string;
|
|
28
29
|
sigDerivedPublicKey?: string;
|
|
29
|
-
status?:
|
|
30
|
+
status?: AuthMethodStatus;
|
|
30
31
|
type?: PublicKeyType;
|
|
31
32
|
cosePublicKey?: string;
|
|
32
33
|
clientDataJSON?: string;
|
|
@@ -64,9 +65,10 @@ interface GetWalletsRes {
|
|
|
64
65
|
interface PasswordEntity {
|
|
65
66
|
id: string;
|
|
66
67
|
userId: string;
|
|
67
|
-
status:
|
|
68
|
+
status: AuthMethodStatus;
|
|
68
69
|
sigDerivedPublicKey: string;
|
|
69
70
|
salt: string;
|
|
71
|
+
isPIN?: boolean;
|
|
70
72
|
}
|
|
71
73
|
interface createWalletBody {
|
|
72
74
|
useTwoSigners?: boolean;
|
|
@@ -99,22 +101,33 @@ interface claimPreGenWalletsBody {
|
|
|
99
101
|
interface signTransactionBody {
|
|
100
102
|
transaction: string;
|
|
101
103
|
chainId: string;
|
|
104
|
+
protocolId?: string;
|
|
102
105
|
}
|
|
103
106
|
interface sendTransactionBody {
|
|
104
107
|
transaction: string;
|
|
105
108
|
chain?: Chain;
|
|
106
109
|
chainId?: string;
|
|
110
|
+
protocolId?: string;
|
|
107
111
|
}
|
|
108
112
|
interface AcceptScopesBody {
|
|
109
113
|
scopeIds: string[];
|
|
110
114
|
partnerId: string;
|
|
111
115
|
}
|
|
112
116
|
interface sessionPasswordBody {
|
|
113
|
-
status?:
|
|
117
|
+
status?: AuthMethodStatus;
|
|
114
118
|
sigDerivedPublicKey?: string;
|
|
115
119
|
salt?: string;
|
|
116
120
|
encryptedWalletPrivateKey?: string;
|
|
117
121
|
encryptionKeyHash?: string;
|
|
122
|
+
isPIN?: boolean;
|
|
123
|
+
}
|
|
124
|
+
interface EncryptedWalletPrivateKey {
|
|
125
|
+
id: string;
|
|
126
|
+
userId: string;
|
|
127
|
+
encryptedPrivateKey: string;
|
|
128
|
+
encryptionKeyHash: string;
|
|
129
|
+
biometricPublicKey?: string;
|
|
130
|
+
passwordId?: string;
|
|
118
131
|
}
|
|
119
132
|
export type SDKType = 'WEB' | 'SERVER' | 'BRIDGE' | 'REACT_NATIVE';
|
|
120
133
|
export type VerifyTelegramRes = {
|
|
@@ -138,13 +151,47 @@ declare class Client {
|
|
|
138
151
|
*/
|
|
139
152
|
createUser: (body: VerifiedAuth & VerificationEmailProps) => Promise<createUserIdRes>;
|
|
140
153
|
checkUserExists: (auth: VerifiedAuth) => Promise<any>;
|
|
141
|
-
verifyTelegram: (authObject
|
|
154
|
+
verifyTelegram: ({ authObject, sessionLookupId, }: {
|
|
155
|
+
authObject: TelegramAuthResponse;
|
|
156
|
+
sessionLookupId?: string;
|
|
157
|
+
}) => Promise<VerifyTelegramResponse>;
|
|
142
158
|
verifyOAuth: () => Promise<VerifyThirdPartyAuth | null>;
|
|
143
159
|
loginExternalWallet: ({ externalWallet, shouldTrackUser, }: {
|
|
144
160
|
externalWallet: ExternalWalletInfo;
|
|
145
161
|
shouldTrackUser?: boolean;
|
|
146
162
|
}) => Promise<LoginExternalWalletResponse>;
|
|
147
|
-
|
|
163
|
+
verifyAccount: (userId: string, body: verifyBody) => Promise<ServerAuthStateSignup | ServerAuthStateLogin | ServerAuthStateDone>;
|
|
164
|
+
sendLoginVerificationCode: (auth: PrimaryAuthInfo, isRecovery?: boolean) => Promise<{
|
|
165
|
+
userId: string;
|
|
166
|
+
}>;
|
|
167
|
+
getLinkedAccounts: ({ userId, withMetadata, }: {
|
|
168
|
+
userId: string;
|
|
169
|
+
withMetadata?: boolean;
|
|
170
|
+
}) => Promise<{
|
|
171
|
+
accounts: LinkedAccounts;
|
|
172
|
+
}>;
|
|
173
|
+
linkAccount: ({ userId, ...opts }: LinkAccountParams & {
|
|
174
|
+
userId: string;
|
|
175
|
+
}) => Promise<{
|
|
176
|
+
linkedAccountId: string;
|
|
177
|
+
signatureVerificationMessage?: string;
|
|
178
|
+
} | {
|
|
179
|
+
isConflict: true;
|
|
180
|
+
}>;
|
|
181
|
+
verifyLink: ({ linkedAccountId, userId, ...opts }: {
|
|
182
|
+
linkedAccountId: string;
|
|
183
|
+
userId: string;
|
|
184
|
+
telegramAuthResponse?: TelegramAuthResponse;
|
|
185
|
+
verificationCode?: string;
|
|
186
|
+
} & Partial<VerifyExternalWalletParams>) => Promise<{
|
|
187
|
+
accounts: LinkedAccounts;
|
|
188
|
+
} | {
|
|
189
|
+
isConflict: true;
|
|
190
|
+
}>;
|
|
191
|
+
unlinkAccount: ({ linkedAccountId, userId }: {
|
|
192
|
+
linkedAccountId: string;
|
|
193
|
+
userId: string;
|
|
194
|
+
}) => Promise<LinkedAccounts>;
|
|
148
195
|
/**
|
|
149
196
|
* @deprecated
|
|
150
197
|
*/
|
|
@@ -153,7 +200,7 @@ declare class Client {
|
|
|
153
200
|
* @deprecated
|
|
154
201
|
*/
|
|
155
202
|
verifyPhone: (userId: string, body: verifyBody) => Promise<any>;
|
|
156
|
-
verifyExternalWallet: (userId: string, body: VerifyExternalWalletParams) => Promise<ServerAuthStateSignup>;
|
|
203
|
+
verifyExternalWallet: (userId: string, body: VerifyExternalWalletParams) => Promise<ServerAuthStateSignup | ServerAuthStateLogin>;
|
|
157
204
|
addSessionPublicKey: (userId: string, body: sessionPublicKeyBody) => Promise<any>;
|
|
158
205
|
getSessionPublicKeys: (userId: string) => Promise<any>;
|
|
159
206
|
getBiometricLocationHints: (auth: PrimaryAuth) => Promise<BiometricLocationHint[]>;
|
|
@@ -164,6 +211,21 @@ declare class Client {
|
|
|
164
211
|
sessionOrigin: (sessionLookupId: string) => Promise<{
|
|
165
212
|
origin?: string;
|
|
166
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
|
+
}>;
|
|
167
229
|
verifyWebChallenge: (partnerId: string, body: verifyWebChallengeBody) => Promise<any>;
|
|
168
230
|
getSessionChallenge: (userId: string) => Promise<any>;
|
|
169
231
|
verifySessionChallenge: (userId: string, body: verifySessionChallengeBody) => Promise<any>;
|
|
@@ -189,7 +251,7 @@ declare class Client {
|
|
|
189
251
|
logout: () => Promise<any>;
|
|
190
252
|
recoveryVerification: (email: string, verificationCode: string) => Promise<any>;
|
|
191
253
|
recoveryInit: (email: string) => Promise<any>;
|
|
192
|
-
preSignMessage: (userId: string, walletId: string, message: string, scheme?: TWalletScheme, cosmosSignDoc?: string) => Promise<any>;
|
|
254
|
+
preSignMessage: (userId: string, walletId: string, message: string, scheme?: TWalletScheme, cosmosSignDoc?: string, protocolId?: string) => Promise<any>;
|
|
193
255
|
deleteSelf: (userId: string) => Promise<any>;
|
|
194
256
|
uploadKeyshares(userId: string, walletId: string, encryptedKeyshares: EncryptedKeyShare[]): Promise<any>;
|
|
195
257
|
uploadUserKeyShares(userId: string, encryptedKeyshares: (EncryptedKeyShare & {
|
|
@@ -207,9 +269,7 @@ declare class Client {
|
|
|
207
269
|
getTransmissionKeyshares(userId: string, sessionLookupId: string): Promise<any>;
|
|
208
270
|
getParaShare: (userId: string, walletId: string) => Promise<string>;
|
|
209
271
|
getBackupKit: (userId: string, walletId: string) => Promise<any>;
|
|
210
|
-
resendVerificationCode({ userId, ...rest }:
|
|
211
|
-
userId: string;
|
|
212
|
-
} & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
|
|
272
|
+
resendVerificationCode({ userId, ...rest }: ResendVerificationCodeParams): Promise<AxiosResponse<any, any>>;
|
|
213
273
|
resendVerificationCodeByPhone({ userId, ...rest }: {
|
|
214
274
|
userId: string;
|
|
215
275
|
} & VerificationEmailProps): Promise<AxiosResponse<any, any>>;
|
|
@@ -218,8 +278,12 @@ declare class Client {
|
|
|
218
278
|
enable2FA(userId: string, verificationCode: string): Promise<AxiosResponse<any, any>>;
|
|
219
279
|
setup2FA(userId: string): Promise<Setup2faResponse>;
|
|
220
280
|
initializeRecovery(email: string): Promise<AxiosResponse<any, any>>;
|
|
221
|
-
initializeFarcasterLogin(
|
|
222
|
-
|
|
281
|
+
initializeFarcasterLogin({ appScheme }?: {
|
|
282
|
+
appScheme?: string;
|
|
283
|
+
}): Promise<any>;
|
|
284
|
+
getFarcasterAuthStatus({ sessionLookupId }?: {
|
|
285
|
+
sessionLookupId?: string;
|
|
286
|
+
}): Promise<VerifyFarcasterResponse>;
|
|
223
287
|
initializeRecoveryForPhone(phone: string, countryCode: string): Promise<AxiosResponse<any, any>>;
|
|
224
288
|
finalizeRecovery(userId: string, walletId: string): Promise<AxiosResponse<any, any>>;
|
|
225
289
|
recoverUserShares(userId: string, walletId: string): Promise<AxiosResponse<{
|
|
@@ -262,7 +326,7 @@ declare class Client {
|
|
|
262
326
|
getOnRampPurchase({ userId, purchaseId, ...params }: {
|
|
263
327
|
userId: string;
|
|
264
328
|
purchaseId: string;
|
|
265
|
-
} & WalletParams): Promise<AxiosResponse<
|
|
329
|
+
} & WalletParams): Promise<AxiosResponse<import("@getpara/shared").IOnRampPurchase, any>>;
|
|
266
330
|
signMoonPayUrl(userId: string, { url, type, cosmosPrefix, testMode, walletId, externalWalletAddress, }: {
|
|
267
331
|
url: string;
|
|
268
332
|
type: TWalletType;
|
|
@@ -317,8 +381,12 @@ declare class Client {
|
|
|
317
381
|
publicKey: string;
|
|
318
382
|
}[];
|
|
319
383
|
}>;
|
|
320
|
-
uploadEncryptedWalletPrivateKey(userId: string, encryptedWalletPrivateKey: string, encryptionKeyHash: string, biometricPublicKey?: string, passwordId?: string): Promise<
|
|
321
|
-
|
|
384
|
+
uploadEncryptedWalletPrivateKey(userId: string, encryptedWalletPrivateKey: string, encryptionKeyHash: string, biometricPublicKey?: string, passwordId?: string): Promise<{
|
|
385
|
+
encryptedWalletPrivateKey: EncryptedWalletPrivateKey;
|
|
386
|
+
}>;
|
|
387
|
+
getEncryptedWalletPrivateKeys(userId: string, encryptionKeyHash: string): Promise<{
|
|
388
|
+
encryptedPrivateKeys: EncryptedWalletPrivateKey[];
|
|
389
|
+
}>;
|
|
322
390
|
getConversionRate(chainId: string, symbol: string, currency: string): Promise<any>;
|
|
323
391
|
getGasEstimate(chainId: string, totalGasPrice: string): Promise<any>;
|
|
324
392
|
getGasOracle(chainId: string): Promise<any>;
|
|
@@ -328,10 +396,20 @@ declare class Client {
|
|
|
328
396
|
deletePendingTransaction(userId: string, pendingTransactionId: string): Promise<any>;
|
|
329
397
|
addSessionPasswordPublicKey(userId: string, body: sessionPasswordBody): Promise<any>;
|
|
330
398
|
patchSessionPassword: (partnerId: string, userId: string, passwordId: string, body: sessionPasswordBody) => Promise<any>;
|
|
331
|
-
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
|
+
}>;
|
|
332
406
|
getPasswords(auth: Auth): Promise<PasswordEntity[]>;
|
|
333
407
|
verifyPasswordChallenge(partnerId: string, body: verifyPasswordChallengeBody): Promise<any>;
|
|
334
|
-
getEncryptedWalletPrivateKey(passwordId: string): Promise<
|
|
408
|
+
getEncryptedWalletPrivateKey(passwordId: string, sessionLookupId: string): Promise<{
|
|
409
|
+
data: {
|
|
410
|
+
encryptedWalletPrivateKey: EncryptedWalletPrivateKey;
|
|
411
|
+
};
|
|
412
|
+
}>;
|
|
335
413
|
getUser(userId: string): Promise<any>;
|
|
336
414
|
getAccountMetadata(userId: string, partnerId: string): Promise<{
|
|
337
415
|
accountMetadata: AccountMetadata;
|
|
@@ -340,6 +418,13 @@ declare class Client {
|
|
|
340
418
|
walletId: string;
|
|
341
419
|
rpcUrl?: string;
|
|
342
420
|
}) => Promise<GetWalletBalanceRes>;
|
|
421
|
+
issueJwt: ({ keyIndex }?: IssueJwtParams) => Promise<IssueJwtResponse>;
|
|
422
|
+
getProfileBalance: ({ config, wallets, refetch, }: GetProfileBalanceParams) => Promise<{
|
|
423
|
+
balance: ProfileBalance;
|
|
424
|
+
}>;
|
|
425
|
+
getAssetInfo: () => Promise<{
|
|
426
|
+
assets: AssetMetadataIndexed;
|
|
427
|
+
}>;
|
|
343
428
|
trackError: (opts: {
|
|
344
429
|
methodName: string;
|
|
345
430
|
error: {
|
|
@@ -349,5 +434,37 @@ declare class Client {
|
|
|
349
434
|
sdkType: SDKType;
|
|
350
435
|
userId: string;
|
|
351
436
|
}) => Promise<void>;
|
|
437
|
+
trackReactSdkAnalytics: (opts: {
|
|
438
|
+
props: object;
|
|
439
|
+
reactSdkVersion: string;
|
|
440
|
+
}) => Promise<void>;
|
|
441
|
+
/**
|
|
442
|
+
* Get the enclave's public key for encryption
|
|
443
|
+
*/
|
|
444
|
+
getEnclavePublicKey: () => Promise<{
|
|
445
|
+
publicKey: string;
|
|
446
|
+
keyFingerprint: string;
|
|
447
|
+
generatedAt: string;
|
|
448
|
+
}>;
|
|
449
|
+
/**
|
|
450
|
+
* Persist encrypted key shares to the enclave
|
|
451
|
+
* @param encryptedPayload JSON string containing the encrypted ECIES payload
|
|
452
|
+
*/
|
|
453
|
+
persistEnclaveShares: (encryptedPayload: string) => Promise<{
|
|
454
|
+
payload: any;
|
|
455
|
+
}>;
|
|
456
|
+
/**
|
|
457
|
+
* Retrieve encrypted key shares from the enclave
|
|
458
|
+
* @param encryptedPayload JSON string containing the encrypted ECIES query
|
|
459
|
+
*/
|
|
460
|
+
retrieveEnclaveShares: (encryptedPayload: string) => Promise<{
|
|
461
|
+
payload: any;
|
|
462
|
+
}>;
|
|
463
|
+
issueEnclaveJwt: (encryptedPayload: string) => Promise<{
|
|
464
|
+
payload: string;
|
|
465
|
+
}>;
|
|
466
|
+
refreshEnclaveJwt: (encryptedPayload: string) => Promise<{
|
|
467
|
+
payload: string;
|
|
468
|
+
}>;
|
|
352
469
|
}
|
|
353
470
|
export default Client;
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { Auth, AuthInfo, AuthParams, PrimaryAuth, PrimaryAuthInfo, VerifiedAuth, WalletParams, WalletRef } from '
|
|
2
|
-
import { AccountMetadata, AccountMetadataKey, PregenAuth, PregenAuthInfo, PregenOrGuestAuth } from './types/auth.js';
|
|
3
|
-
import { PregenIds, TPregenIdentifierType } from './types/wallet.js';
|
|
1
|
+
import { Auth, AuthInfo, AuthParams, PrimaryAuth, PrimaryAuthInfo, VerifiedAuth, WalletParams, WalletRef, AccountMetadata, AccountMetadataKey, LinkedAccounts, PregenAuth, PregenAuthInfo, PregenOrGuestAuth, PregenIds, TPregenIdentifierType } from '@getpara/shared';
|
|
4
2
|
export declare function isWalletId(params: WalletParams): params is {
|
|
5
3
|
walletId: string;
|
|
6
4
|
};
|
|
@@ -55,4 +53,5 @@ export declare function fromAccountMetadata(obj: Partial<Record<AccountMetadataK
|
|
|
55
53
|
date: string;
|
|
56
54
|
metadata: object;
|
|
57
55
|
}>> | undefined): AccountMetadata;
|
|
56
|
+
export declare function fromLinkedAccounts({ primary, linked }: LinkedAccounts<string>): LinkedAccounts<Date>;
|
|
58
57
|
export {};
|