Skip to main content

Quickstart

@quik/mfa registers default email, SMS, and WhatsApp delivery factors and exposes QMFAService through ServicesStore.

import { ServicesStore } from '@quik/services';
import { QMFAService } from '@quik/mfa';

const mfa = ServicesStore.get(QMFAService);
mfa.assertEnabled();

const challenge = await mfa.requestChallenge({
method: 'email',
userId: 'u1',
metadata: { email: 'user@example.com' }
});

const result = await mfa.verifyChallenge({
challengeId: challenge.id,
code: '123456'
});

Notes

  • Set mfa.enabled (MFA_ENABLED) to true before calling into QMFAServiceassertEnabled() throws otherwise.
  • Challenge state defaults to in-memory storage; see Store Extensibility to back it with a repository.