2021-09-21 09:29:20 +00:00
|
|
|
const TwoFactorAuthAPI = {
|
|
|
|
async setup(password: string) {
|
|
|
|
return fetch("/api/auth/two-factor/totp/setup", {
|
|
|
|
method: "POST",
|
|
|
|
body: JSON.stringify({ password }),
|
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
async enable(code: string) {
|
|
|
|
return fetch("/api/auth/two-factor/totp/enable", {
|
|
|
|
method: "POST",
|
|
|
|
body: JSON.stringify({ code }),
|
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2022-08-31 20:57:53 +00:00
|
|
|
async disable(password: string, code: string) {
|
2021-09-21 09:29:20 +00:00
|
|
|
return fetch("/api/auth/two-factor/totp/disable", {
|
|
|
|
method: "POST",
|
2022-08-31 20:57:53 +00:00
|
|
|
body: JSON.stringify({ password, code }),
|
2021-09-21 09:29:20 +00:00
|
|
|
headers: {
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export default TwoFactorAuthAPI;
|