@oxyhq/services
Version:
Reusable OxyHQ module to handle authentication, user management, karma system, device-based session management and more 🚀
49 lines (47 loc) • 1.11 kB
JavaScript
;
/**
* TOTP Enrollment Methods Mixin
*/
export function OxyServicesTotpMixin(Base) {
return class extends Base {
constructor(...args) {
super(...args);
}
async startTotpEnrollment(sessionId) {
try {
return await this.makeRequest('POST', '/api/auth/totp/enroll/start', {
sessionId
}, {
cache: false
});
} catch (error) {
throw this.handleError(error);
}
}
async verifyTotpEnrollment(sessionId, code) {
try {
return await this.makeRequest('POST', '/api/auth/totp/enroll/verify', {
sessionId,
code
}, {
cache: false
});
} catch (error) {
throw this.handleError(error);
}
}
async disableTotp(sessionId, code) {
try {
return await this.makeRequest('POST', '/api/auth/totp/disable', {
sessionId,
code
}, {
cache: false
});
} catch (error) {
throw this.handleError(error);
}
}
};
}
//# sourceMappingURL=OxyServices.totp.js.map