@usecapsule/user-management-client
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -58,3 +58,3 @@ import axios, { AxiosInstance } from 'axios'; | ||
email: string | ||
sessionId: string | ||
sessionId?: string | ||
signature: WebSignature | ||
@@ -99,2 +99,7 @@ publicKey?: string | ||
interface AcceptScopesBody { | ||
scopeIds: string[] | ||
partnerId: string | ||
} | ||
export interface encryptedKeyshare { | ||
@@ -366,2 +371,26 @@ encryptedShare: string, | ||
async getPartner(partnerId: string) { | ||
const res = await this.baseRequest.get<any>(`/partners/${partnerId}`); | ||
return res; | ||
} | ||
async acceptScopes(userId: string, body: AcceptScopesBody) { | ||
const res = await this.baseRequest.post<any>(`/users/${userId}/scopes/accept`, body); | ||
return res; | ||
} | ||
async getPendingTransaction(userId: string, pendingTransactionid: string) { | ||
const res = await this.baseRequest.get<any>(`/users/${userId}/pending-transactions/${pendingTransactionid}`); | ||
return res; | ||
} | ||
async acceptPendingTransaction(userId: string, pendingTransactionId: string) { | ||
const res = await this.baseRequest.post<any>(`/users/${userId}/pending-transactions/${pendingTransactionId}/accept`); | ||
return res; | ||
} | ||
async getPolicyPermissions(userId: string, policyId: string) { | ||
const res = await this.baseRequest.get<any>(`/users/${userId}/policies/${policyId}/permissions`); | ||
return res; | ||
} | ||
} | ||
@@ -368,0 +397,0 @@ |
@@ -16,3 +16,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
@@ -70,4 +70,4 @@ if (y = 0, t) op = [op[0] & 2, t.value]; | ||
function Client(_a) { | ||
var _this = this; | ||
var userManagementHost = _a.userManagementHost, apiKey = _a.apiKey; | ||
var _this = this; | ||
this.createUser = function (body) { return __awaiter(_this, void 0, void 0, function () { | ||
@@ -88,3 +88,3 @@ var res; | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/exists?email=".concat(encodeURIComponent(email)))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/exists?email=" + encodeURIComponent(email))]; | ||
case 1: | ||
@@ -101,3 +101,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/verify-email"), body)]; | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/verify-email", body)]; | ||
case 1: | ||
@@ -114,3 +114,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/biometrics/key"), body)]; | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/biometrics/key", body)]; | ||
case 1: | ||
@@ -127,3 +127,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/".concat(userId, "/biometrics/keys"))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/" + userId + "/biometrics/keys")]; | ||
case 1: | ||
@@ -140,3 +140,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/".concat(userId, "/biometrics/").concat(biometricId))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/" + userId + "/biometrics/" + biometricId)]; | ||
case 1: | ||
@@ -153,3 +153,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.patch("/users/".concat(userId, "/biometrics/").concat(biometricId), body)]; | ||
case 0: return [4 /*yield*/, this.baseRequest.patch("/users/" + userId + "/biometrics/" + biometricId, body)]; | ||
case 1: | ||
@@ -166,3 +166,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/biometrics/challenge?email=".concat(email).concat(publicKey ? "&publicKey=".concat(publicKey) : ''))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/biometrics/challenge?email=" + email + (publicKey ? "&publicKey=" + publicKey : ''))]; | ||
case 1: | ||
@@ -179,3 +179,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/touch?regenerate=".concat(!!regenerate))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/touch?regenerate=" + !!regenerate)]; | ||
case 1: | ||
@@ -204,3 +204,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/".concat(userId, "/biometrics/challenge"))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/" + userId + "/biometrics/challenge")]; | ||
case 1: | ||
@@ -217,3 +217,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/biometrics/verify"), body)]; | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/biometrics/verify", body)]; | ||
case 1: | ||
@@ -230,3 +230,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/wallets"), body)]; | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/wallets", body)]; | ||
case 1: | ||
@@ -243,3 +243,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/wallets/").concat(walletId, "/transactions/send"), body)]; | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/wallets/" + walletId + "/transactions/send", body)]; | ||
case 1: | ||
@@ -257,3 +257,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/wallets/").concat(walletId, "/sign"), body)]; | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/wallets/" + walletId + "/sign", body)]; | ||
case 1: | ||
@@ -270,3 +270,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/wallets/").concat(walletId, "/refresh"))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/wallets/" + walletId + "/refresh")]; | ||
case 1: | ||
@@ -283,3 +283,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/wallets/").concat(walletId))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/wallets/" + walletId)]; | ||
case 1: | ||
@@ -296,3 +296,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/".concat(userId, "/wallets"))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/" + userId + "/wallets")]; | ||
case 1: | ||
@@ -378,3 +378,3 @@ res = _a.sent(); | ||
body = { message: tx }; | ||
return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/wallets/").concat(walletId, "/messages/sign"), body)]; | ||
return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/wallets/" + walletId + "/messages/sign", body)]; | ||
case 1: | ||
@@ -399,3 +399,3 @@ res = _a.sent(); | ||
body = { keyShares: encryptedKeyshares }; | ||
return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/wallets/").concat(walletId, "/key-shares"), body)]; | ||
return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/wallets/" + walletId + "/key-shares", body)]; | ||
case 1: | ||
@@ -416,3 +416,3 @@ res = _a.sent(); | ||
body = { keyShares: encryptedKeyshares }; | ||
return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/key-shares"), body)]; | ||
return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/key-shares", body)]; | ||
case 1: | ||
@@ -431,3 +431,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/".concat(userId, "/wallets/").concat(walletId, "/key-shares?type=").concat(type).concat(encryptor ? "&encryptor=".concat(encryptor) : ''))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/" + userId + "/wallets/" + walletId + "/key-shares?type=" + type + (encryptor ? "&encryptor=" + encryptor : ''))]; | ||
case 1: | ||
@@ -446,3 +446,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/".concat(userId, "/biometrics/key-shares?publicKey=").concat(biometricPublicKey))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/" + userId + "/biometrics/key-shares?publicKey=" + biometricPublicKey)]; | ||
case 1: | ||
@@ -463,3 +463,3 @@ res = _a.sent(); | ||
body = { shares: shares }; | ||
return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/temporary-shares"), body)]; | ||
return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/temporary-shares", body)]; | ||
case 1: | ||
@@ -480,3 +480,3 @@ res = _a.sent(); | ||
body = { encryptedShare: encryptedShare }; | ||
return [4 /*yield*/, this.baseRequest.post("/users/".concat(userId, "/wallets/").concat(walletId, "/temporary-shares"), body)]; | ||
return [4 /*yield*/, this.baseRequest.post("/users/" + userId + "/wallets/" + walletId + "/temporary-shares", body)]; | ||
case 1: | ||
@@ -495,3 +495,3 @@ res = _a.sent(); | ||
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/" + userId + "/temporary-shares")]; | ||
case 1: | ||
@@ -510,3 +510,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/temporary-shares/".concat(id))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/temporary-shares/" + id)]; | ||
case 1: | ||
@@ -525,3 +525,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/".concat(userId, "/wallets/").concat(walletId, "/capsule-share"))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/users/" + userId + "/wallets/" + walletId + "/capsule-share")]; | ||
case 1: | ||
@@ -554,3 +554,3 @@ res = _a.sent(); | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/temporary-transmissions/".concat(id))]; | ||
case 0: return [4 /*yield*/, this.baseRequest.get("/temporary-transmissions/" + id)]; | ||
case 1: | ||
@@ -563,2 +563,67 @@ res = _a.sent(); | ||
}; | ||
Client.prototype.getPartner = function (partnerId) { | ||
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("/partners/" + partnerId)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Client.prototype.acceptScopes = function (userId, body) { | ||
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.post("/users/" + userId + "/scopes/accept", body)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Client.prototype.getPendingTransaction = function (userId, pendingTransactionid) { | ||
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("/users/" + userId + "/pending-transactions/" + pendingTransactionid)]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Client.prototype.acceptPendingTransaction = function (userId, pendingTransactionId) { | ||
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.post("/users/" + userId + "/pending-transactions/" + pendingTransactionId + "/accept")]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Client.prototype.getPolicyPermissions = function (userId, policyId) { | ||
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("/users/" + userId + "/policies/" + policyId + "/permissions")]; | ||
case 1: | ||
res = _a.sent(); | ||
return [2 /*return*/, res]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return Client; | ||
@@ -565,0 +630,0 @@ }()); |
{ | ||
"name": "@usecapsule/user-management-client", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "dist/client.js", | ||
@@ -9,3 +9,3 @@ "types": "dist/client.d.ts", | ||
"build": "tsc --outDir dist --noEmit false --skipLibCheck", | ||
"publish": "yarn build && npm publish" | ||
"build-publish": "yarn build && npm publish" | ||
}, | ||
@@ -12,0 +12,0 @@ "dependencies": { |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
57330
7
1125
0