feat(core): Add MFA (#4767)
https://linear.app/n8n/issue/ADO-947/sync-branch-with-master-and-fix-fe-e2e-tets --------- Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
23
packages/editor-ui/src/api/mfa.ts
Normal file
23
packages/editor-ui/src/api/mfa.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import type { IRestApiContext } from '@/Interface';
|
||||
import { makeRestApiRequest } from '@/utils/apiUtils';
|
||||
|
||||
export async function getMfaQR(
|
||||
context: IRestApiContext,
|
||||
): Promise<{ qrCode: string; secret: string; recoveryCodes: string[] }> {
|
||||
return makeRestApiRequest(context, 'GET', '/mfa/qr');
|
||||
}
|
||||
|
||||
export async function enableMfa(context: IRestApiContext, data: { token: string }): Promise<void> {
|
||||
return makeRestApiRequest(context, 'POST', '/mfa/enable', data);
|
||||
}
|
||||
|
||||
export async function verifyMfaToken(
|
||||
context: IRestApiContext,
|
||||
data: { token: string },
|
||||
): Promise<void> {
|
||||
return makeRestApiRequest(context, 'POST', '/mfa/verify', data);
|
||||
}
|
||||
|
||||
export async function disableMfa(context: IRestApiContext): Promise<void> {
|
||||
return makeRestApiRequest(context, 'DELETE', '/mfa/disable');
|
||||
}
|
||||
Reference in New Issue
Block a user