@usecapsule/user-management-client
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -65,3 +65,3 @@ import axios, { AxiosInstance } from 'axios'; | ||
email: string | ||
sessionId?: string | ||
sessionLookupId?: string | ||
signature: WebSignature | ||
@@ -207,3 +207,3 @@ publicKey?: string | ||
touchSession = async (regenerate?: boolean): Promise<any> => { | ||
const res = await this.baseRequest.post<{ userId?: string, sessionId: string, biometricVerifiedAt?: number }>(`/touch?regenerate=${!!regenerate}`); | ||
const res = await this.baseRequest.post<{ userId?: string, sessionLookupId: string, biometricVerifiedAt?: number }>(`/touch?regenerate=${!!regenerate}`); | ||
return res; | ||
@@ -352,3 +352,3 @@ } | ||
// POST '/users/:userId/temporary-shares', | ||
async uploadTransmissionKeyshares(userId: string, shares: { walletId: string, encryptedShare: string, encryptedKey?: string }[]): Promise<any> { | ||
async uploadTransmissionKeyshares(userId: string, shares: { walletId: string, encryptedShare: string, encryptedKey?: string; sessionLookupId: string }[]): Promise<any> { | ||
const body = { shares } | ||
@@ -360,24 +360,9 @@ const res = await this.baseRequest.post<any>( | ||
} | ||
// POST '/users/:userId/wallets/:walletId/temporary-shares', | ||
async uploadTrasmissionKeyshare(userId: string, walletId: string, encryptedShare: string): Promise<any> { | ||
const body = { encryptedShare } | ||
const res = await this.baseRequest.post<any>( | ||
`/users/${userId}/wallets/${walletId}/temporary-shares`, | ||
body); | ||
return res; | ||
} | ||
// GET /users/:userId/temporary-shares returns { temporaryShares: { userId: string, walletId: string, encryptedShare: string, encryptedKey?: string }[] } | ||
async getTransmissionKeyshares(userId: string): Promise<any> { | ||
const res = await this.baseRequest.get<any>(`/users/${userId}/temporary-shares`) | ||
async getTransmissionKeyshares(userId: string, sessionLookupId: string): Promise<any> { | ||
const res = await this.baseRequest.get<any>(`/users/${userId}/temporary-shares?sessionLookupId=${sessionLookupId}`) | ||
return res; | ||
} | ||
// GET /temporary-shares/:id returns { encryptedShare: string } | ||
async getTrasmissionKeyshare(id: string): Promise<any> { | ||
const res = await this.baseRequest.get<any>(`/temporary-shares/${id}`) | ||
return res; | ||
} | ||
// get /users/:userId/wallets/:walletId/capsule-share | ||
@@ -384,0 +369,0 @@ async getCapsuleShare(userId: string, walletId: string) { |
@@ -50,3 +50,3 @@ export declare const USER_NOT_VERIFIED = "user must verify biometrics"; | ||
email: string; | ||
sessionId?: string; | ||
sessionLookupId?: string; | ||
signature: WebSignature; | ||
@@ -136,6 +136,5 @@ publicKey?: string; | ||
encryptedKey?: string; | ||
sessionLookupId: string; | ||
}[]): Promise<any>; | ||
uploadTrasmissionKeyshare(userId: string, walletId: string, encryptedShare: string): Promise<any>; | ||
getTransmissionKeyshares(userId: string): Promise<any>; | ||
getTrasmissionKeyshare(id: string): Promise<any>; | ||
getTransmissionKeyshares(userId: string, sessionLookupId: string): Promise<any>; | ||
getCapsuleShare(userId: string, walletId: string): Promise<import("axios").AxiosResponse<any, any>>; | ||
@@ -142,0 +141,0 @@ resendVerificationCode(userId: string): Promise<import("axios").AxiosResponse<any, any>>; |
@@ -469,20 +469,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
// POST '/users/:userId/wallets/:walletId/temporary-shares', | ||
Client.prototype.uploadTrasmissionKeyshare = function (userId, walletId, encryptedShare) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var body, res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
body = { encryptedShare: encryptedShare }; | ||
return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/wallets/").concat(walletId, "/temporary-shares"), body)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res]; | ||
} | ||
}); | ||
}); | ||
}; | ||
// GET /users/:userId/temporary-shares returns { temporaryShares: { userId: string, walletId: string, encryptedShare: string, encryptedKey?: string }[] } | ||
Client.prototype.getTransmissionKeyshares = function (userId) { | ||
Client.prototype.getTransmissionKeyshares = function (userId, sessionLookupId) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -492,3 +476,3 @@ var res; | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/".concat(userId, "/temporary-shares"))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/".concat(userId, "/temporary-shares?sessionLookupId=").concat(sessionLookupId))]; | ||
case 1: | ||
@@ -501,16 +485,2 @@ res = _a.sent(); | ||
}; | ||
// GET /temporary-shares/:id returns { encryptedShare: string } | ||
Client.prototype.getTrasmissionKeyshare = function (id) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var res; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/temporary-shares/".concat(id))]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res]; | ||
} | ||
}); | ||
}); | ||
}; | ||
// get /users/:userId/wallets/:walletId/capsule-share | ||
@@ -517,0 +487,0 @@ Client.prototype.getCapsuleShare = function (userId, walletId) { |
{ | ||
"name": "@usecapsule/user-management-client", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"main": "dist/client.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/client.d.ts", |
Sorry, the diff of this file is not supported yet
60341
1173