@usecapsule/user-management-client
Advanced tools
Comparing version 0.23.0 to 0.24.0
@@ -20,4 +20,29 @@ import axios, { AxiosInstance, AxiosRequestHeaders, AxiosResponseHeaders, InternalAxiosRequestConfig } from 'axios'; | ||
export enum EmailTheme { | ||
LIGHT = 'light', | ||
DARK = 'dark', | ||
} | ||
export interface VerificationEmailProps { | ||
theme?: EmailTheme; | ||
homepageUrl?: string; | ||
xUrl?: string; | ||
linkedinUrl?: string; | ||
githubUrl?: string; | ||
supportUrl?: string; | ||
brandColor?: string; | ||
} | ||
export interface BackupKitEmailProps { | ||
theme?: EmailTheme; | ||
homepageUrl?: string; | ||
xUrl?: string; | ||
linkedinUrl?: string; | ||
githubUrl?: string; | ||
supportUrl?: string; | ||
brandColor?: string; | ||
} | ||
export interface createUserBody { | ||
email: string | ||
email: string; | ||
} | ||
@@ -212,3 +237,3 @@ | ||
createUser = async (body: createUserBody): Promise<createUserIdRes> => { | ||
createUser = async (body: createUserBody & VerificationEmailProps): Promise<createUserIdRes> => { | ||
const res = await this.baseRequest.post<createUserIdRes>(`/users`, body); | ||
@@ -321,4 +346,4 @@ return res.data; | ||
// POST /login | ||
login = async (email: string): Promise<any> => { | ||
const body = { email } | ||
login = async (props: {email: string} & VerificationEmailProps): Promise<any> => { | ||
const body = props | ||
@@ -434,5 +459,5 @@ const res = await this.baseRequest.post<any>('/login', body); | ||
// POST '/users/:userId/resend-verification-code | ||
async resendVerificationCode(userId: string) { | ||
async resendVerificationCode({userId, ...rest}: {userId: string} & VerificationEmailProps) { | ||
const res = await this.baseRequest.post<any>( | ||
`/users/${userId}/resend-verification-code` | ||
`/users/${userId}/resend-verification-code`, rest | ||
); | ||
@@ -557,12 +582,7 @@ return res; | ||
async distributeCapsuleShare(userId: string, walletId: string, useDKLS: boolean) { | ||
const body = { useDKLS }; | ||
async distributeCapsuleShare({userId, walletId, ...rest}: {userId: string, walletId: string, useDKLS: boolean} & BackupKitEmailProps) { | ||
const body = rest | ||
const res = await this.baseRequest.post<any>(`/users/${userId}/wallets/${walletId}/capsule-share/distribute`, body); | ||
return res; | ||
} | ||
async keepSessionAlive(userId: string) { | ||
const res = await this.baseRequest.post<any>(`/users/${userId}/session/keep-alive`); | ||
return res.data; | ||
} | ||
} | ||
@@ -569,0 +589,0 @@ |
@@ -11,2 +11,13 @@ "use strict"; | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -16,3 +27,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.KeyType = exports.EncryptorType = exports.Chain = exports.SignatureScheme = exports.PublicKeyType = exports.PublicKeyStatus = exports.USER_NOT_MATCHING_ERROR = exports.USER_NOT_AUTHENTICATED_ERROR = exports.USER_NOT_VERIFIED = void 0; | ||
exports.KeyType = exports.EncryptorType = exports.Chain = exports.SignatureScheme = exports.PublicKeyType = exports.PublicKeyStatus = exports.EmailTheme = exports.USER_NOT_MATCHING_ERROR = exports.USER_NOT_AUTHENTICATED_ERROR = exports.USER_NOT_VERIFIED = void 0; | ||
const axios_1 = __importDefault(require("axios")); | ||
@@ -22,2 +33,7 @@ exports.USER_NOT_VERIFIED = 'user must verify biometrics'; | ||
exports.USER_NOT_MATCHING_ERROR = 'route param userId must match session userId'; | ||
var EmailTheme; | ||
(function (EmailTheme) { | ||
EmailTheme["LIGHT"] = "light"; | ||
EmailTheme["DARK"] = "dark"; | ||
})(EmailTheme = exports.EmailTheme || (exports.EmailTheme = {})); | ||
var PublicKeyStatus; | ||
@@ -147,4 +163,4 @@ (function (PublicKeyStatus) { | ||
// POST /login | ||
this.login = (email) => __awaiter(this, void 0, void 0, function* () { | ||
const body = { email }; | ||
this.login = (props) => __awaiter(this, void 0, void 0, function* () { | ||
const body = props; | ||
const res = yield this.baseRequest.post('/login', body); | ||
@@ -297,5 +313,6 @@ return res; | ||
// POST '/users/:userId/resend-verification-code | ||
resendVerificationCode(userId) { | ||
resendVerificationCode(_a) { | ||
var { userId } = _a, rest = __rest(_a, ["userId"]); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`); | ||
const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest); | ||
return res; | ||
@@ -412,5 +429,6 @@ }); | ||
} | ||
distributeCapsuleShare(userId, walletId, useDKLS) { | ||
distributeCapsuleShare(_a) { | ||
var { userId, walletId } = _a, rest = __rest(_a, ["userId", "walletId"]); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const body = { useDKLS }; | ||
const body = rest; | ||
const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/capsule-share/distribute`, body); | ||
@@ -420,8 +438,2 @@ return res; | ||
} | ||
keepSessionAlive(userId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.post(`/users/${userId}/session/keep-alive`); | ||
return res.data; | ||
}); | ||
} | ||
} | ||
@@ -428,0 +440,0 @@ exports.default = Client; |
@@ -10,2 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
var __rest = (this && this.__rest) || function (s, e) { | ||
var t = {}; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) | ||
t[p] = s[p]; | ||
if (s != null && typeof Object.getOwnPropertySymbols === "function") | ||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { | ||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) | ||
t[p[i]] = s[p[i]]; | ||
} | ||
return t; | ||
}; | ||
import axios from 'axios'; | ||
@@ -15,2 +26,7 @@ export const USER_NOT_VERIFIED = 'user must verify biometrics'; | ||
export const USER_NOT_MATCHING_ERROR = 'route param userId must match session userId'; | ||
export var EmailTheme; | ||
(function (EmailTheme) { | ||
EmailTheme["LIGHT"] = "light"; | ||
EmailTheme["DARK"] = "dark"; | ||
})(EmailTheme || (EmailTheme = {})); | ||
export var PublicKeyStatus; | ||
@@ -140,4 +156,4 @@ (function (PublicKeyStatus) { | ||
// POST /login | ||
this.login = (email) => __awaiter(this, void 0, void 0, function* () { | ||
const body = { email }; | ||
this.login = (props) => __awaiter(this, void 0, void 0, function* () { | ||
const body = props; | ||
const res = yield this.baseRequest.post('/login', body); | ||
@@ -290,5 +306,6 @@ return res; | ||
// POST '/users/:userId/resend-verification-code | ||
resendVerificationCode(userId) { | ||
resendVerificationCode(_a) { | ||
var { userId } = _a, rest = __rest(_a, ["userId"]); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`); | ||
const res = yield this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest); | ||
return res; | ||
@@ -405,5 +422,6 @@ }); | ||
} | ||
distributeCapsuleShare(userId, walletId, useDKLS) { | ||
distributeCapsuleShare(_a) { | ||
var { userId, walletId } = _a, rest = __rest(_a, ["userId", "walletId"]); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const body = { useDKLS }; | ||
const body = rest; | ||
const res = yield this.baseRequest.post(`/users/${userId}/wallets/${walletId}/capsule-share/distribute`, body); | ||
@@ -413,8 +431,2 @@ return res; | ||
} | ||
keepSessionAlive(userId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const res = yield this.baseRequest.post(`/users/${userId}/session/keep-alive`); | ||
return res.data; | ||
}); | ||
} | ||
} | ||
@@ -421,0 +433,0 @@ export default Client; |
@@ -14,2 +14,24 @@ export declare const USER_NOT_VERIFIED = "user must verify biometrics"; | ||
}; | ||
export declare enum EmailTheme { | ||
LIGHT = "light", | ||
DARK = "dark" | ||
} | ||
export interface VerificationEmailProps { | ||
theme?: EmailTheme; | ||
homepageUrl?: string; | ||
xUrl?: string; | ||
linkedinUrl?: string; | ||
githubUrl?: string; | ||
supportUrl?: string; | ||
brandColor?: string; | ||
} | ||
export interface BackupKitEmailProps { | ||
theme?: EmailTheme; | ||
homepageUrl?: string; | ||
xUrl?: string; | ||
linkedinUrl?: string; | ||
githubUrl?: string; | ||
supportUrl?: string; | ||
brandColor?: string; | ||
} | ||
export interface createUserBody { | ||
@@ -111,3 +133,3 @@ email: string; | ||
constructor({ userManagementHost, apiKey, opts, retrieveSessionCookie, persistSessionCookie }: ClientConfig); | ||
createUser: (body: createUserBody) => Promise<createUserIdRes>; | ||
createUser: (body: createUserBody & VerificationEmailProps) => Promise<createUserIdRes>; | ||
checkUserExists: (email: string) => Promise<any>; | ||
@@ -130,3 +152,5 @@ verifyEmail: (userId: string, body: verifyEmailBody) => Promise<any>; | ||
getWallets: (userId: string) => Promise<any>; | ||
login: (email: string) => Promise<any>; | ||
login: (props: { | ||
email: string; | ||
} & VerificationEmailProps) => Promise<any>; | ||
verifyLogin: (verificationCode: string) => Promise<any>; | ||
@@ -152,3 +176,5 @@ logout: () => Promise<any>; | ||
getCapsuleShare(userId: string, walletId: string): Promise<import("axios").AxiosResponse<any, any>>; | ||
resendVerificationCode(userId: string): Promise<import("axios").AxiosResponse<any, any>>; | ||
resendVerificationCode({ userId, ...rest }: { | ||
userId: string; | ||
} & VerificationEmailProps): Promise<import("axios").AxiosResponse<any, any>>; | ||
cancelRecoveryAttempt(email: string): Promise<import("axios").AxiosResponse<any, any>>; | ||
@@ -170,5 +196,8 @@ check2FAStatus(userId: string): Promise<import("axios").AxiosResponse<any, any>>; | ||
getPolicyPermissions(userId: string, policyId: string): Promise<import("axios").AxiosResponse<any, any>>; | ||
distributeCapsuleShare(userId: string, walletId: string, useDKLS: boolean): Promise<import("axios").AxiosResponse<any, any>>; | ||
keepSessionAlive(userId: string): Promise<any>; | ||
distributeCapsuleShare({ userId, walletId, ...rest }: { | ||
userId: string; | ||
walletId: string; | ||
useDKLS: boolean; | ||
} & BackupKitEmailProps): Promise<import("axios").AxiosResponse<any, any>>; | ||
} | ||
export default Client; |
{ | ||
"name": "@usecapsule/user-management-client", | ||
"version": "0.23.0", | ||
"version": "0.24.0", | ||
"main": "dist/cjs/client.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/esm/client.js", |
69235
1616