@usecapsule/user-management-client
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -28,2 +28,3 @@ "use strict"; | ||
const axios_1 = __importDefault(require("axios")); | ||
const query_string_1 = __importDefault(require("query-string")); | ||
exports.USER_NOT_VERIFIED = 'user must verify biometrics'; | ||
@@ -106,4 +107,12 @@ exports.USER_NOT_AUTHENTICATED_ERROR = 'user must be authenticated'; | ||
this.getWebChallenge = (email, publicKey) => __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.get(`/biometrics/challenge?email=${email}${publicKey ? `&publicKey=${publicKey}` : ''}`); | ||
return res; | ||
const queryParams = {}; | ||
if (email) { | ||
queryParams['email'] = email; | ||
} | ||
if (publicKey) { | ||
queryParams['publicKey'] = publicKey; | ||
} | ||
const query = query_string_1.default.stringify(queryParams); | ||
const res = yield this.baseRequest.get(`/biometrics/challenge${query === '' ? '' : `?${query}`}`); | ||
return res.data; | ||
}); | ||
@@ -110,0 +119,0 @@ // POST /touch |
@@ -22,2 +22,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import axios from 'axios'; | ||
import queryString from 'query-string'; | ||
export const USER_NOT_VERIFIED = 'user must verify biometrics'; | ||
@@ -100,4 +101,12 @@ export const USER_NOT_AUTHENTICATED_ERROR = 'user must be authenticated'; | ||
this.getWebChallenge = (email, publicKey) => __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.get(`/biometrics/challenge?email=${email}${publicKey ? `&publicKey=${publicKey}` : ''}`); | ||
return res; | ||
const queryParams = {}; | ||
if (email) { | ||
queryParams['email'] = email; | ||
} | ||
if (publicKey) { | ||
queryParams['publicKey'] = publicKey; | ||
} | ||
const query = queryString.stringify(queryParams); | ||
const res = yield this.baseRequest.get(`/biometrics/challenge${query === '' ? '' : `?${query}`}`); | ||
return res.data; | ||
}); | ||
@@ -104,0 +113,0 @@ // POST /touch |
@@ -46,2 +46,6 @@ export declare const USER_NOT_VERIFIED = "user must verify biometrics"; | ||
} | ||
export interface getWebChallengeRes { | ||
challenge: string; | ||
allowedPublicKeys?: string[]; | ||
} | ||
export declare enum PublicKeyStatus { | ||
@@ -74,3 +78,3 @@ PENDING = "PENDING", | ||
interface verifyWebChallengeBody { | ||
email: string; | ||
email?: string; | ||
sessionLookupId?: string; | ||
@@ -161,3 +165,3 @@ signature: WebSignature; | ||
patchSessionPublicKey: (userId: string, biometricId: string, body: sessionPublicKeyBody) => Promise<any>; | ||
getWebChallenge: (email: string, publicKey?: string) => Promise<any>; | ||
getWebChallenge: (email?: string, publicKey?: string) => Promise<getWebChallengeRes>; | ||
touchSession: (regenerate?: boolean) => Promise<any>; | ||
@@ -164,0 +168,0 @@ verifyWebChallenge: (body: verifyWebChallengeBody) => Promise<any>; |
{ | ||
"name": "@usecapsule/user-management-client", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"main": "dist/cjs/index.js", | ||
@@ -16,3 +16,4 @@ "module": "dist/esm/index.js", | ||
"dependencies": { | ||
"axios": "^1.6.3" | ||
"axios": "^1.6.3", | ||
"query-string": "^9.0.0" | ||
}, | ||
@@ -33,3 +34,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "283a16867bac0f5e1711b28a644d27145bb8b730" | ||
"gitHead": "9bea780673093cac8a9ba5b40cf9ca4165f06611" | ||
} |
54314
1185
2
+ Addedquery-string@^9.0.0
+ Addeddecode-uri-component@0.4.1(transitive)
+ Addedfilter-obj@5.1.0(transitive)
+ Addedquery-string@9.1.1(transitive)
+ Addedsplit-on-first@3.0.0(transitive)