()
| 31 | |
| 32 | export class MultiFactorAuthModel { |
| 33 | static generateMethodId(): string { |
| 34 | const bytes = new Uint8Array(16); |
| 35 | crypto.getRandomValues(bytes); |
| 36 | |
| 37 | return Array.from(bytes) |
| 38 | .map((byte) => byte.toString(16).padStart(2, '0')) |
| 39 | .join(''); |
| 40 | } |
| 41 | |
| 42 | static enableMethodForUser( |
| 43 | user: { extra: Pick<User['extra'], 'multi_factor_auth_methods'> }, |