feat(interfaces): add MFA and passkey contracts

This commit is contained in:
2026-05-19 06:24:06 +00:00
parent 8e2f9a6d12
commit 8746bc083e
7 changed files with 318 additions and 1 deletions
+45
View File
@@ -0,0 +1,45 @@
export type TMfaMethod = 'totp' | 'backupCode' | 'passkey';
export type TMfaChallengeStatus = 'pending' | 'completed' | 'expired';
export type TTotpCredentialStatus = 'pending' | 'active' | 'disabled';
export interface ITotpBackupCode {
id: string;
codeHash: string;
usedAt?: number | null;
createdAt: number;
}
export interface ITotpCredential {
id: string;
data: {
userId: string;
status: TTotpCredentialStatus;
secretCiphertext: string;
secretIv: string;
secretAuthTag: string;
algorithm: 'sha1' | 'sha256' | 'sha512';
digits: 6 | 7 | 8;
period: number;
backupCodes: ITotpBackupCode[];
createdAt: number;
verifiedAt?: number | null;
disabledAt?: number | null;
lastUsedAt?: number | null;
};
}
export interface IMfaChallenge {
id: string;
data: {
userId: string;
tokenHash: string;
status: TMfaChallengeStatus;
availableMethods: TMfaMethod[];
primaryAuthMethod: 'password' | 'email';
createdAt: number;
expiresAt: number;
completedAt?: number | null;
};
}