feat(app): add MFA and tsdocker release

This commit is contained in:
2026-05-19 06:20:38 +00:00
parent ddf4861e95
commit 1e563115d0
23 changed files with 1939 additions and 211 deletions
+36
View File
@@ -0,0 +1,36 @@
import * as plugins from '../plugins.js';
import type { MfaManager } from './classes.mfamanager.js';
@plugins.smartdata.Manager()
export class WebAuthnChallenge extends plugins.smartdata.SmartDataDbDoc<WebAuthnChallenge, any, MfaManager> {
@plugins.smartdata.unI()
public id: string;
@plugins.smartdata.svDb()
public data = {
userId: null as string | null,
username: null as string | null,
mfaChallengeId: null as string | null,
type: 'login' as 'registration' | 'login' | 'mfa',
challenge: '',
status: 'pending' as 'pending' | 'completed' | 'expired',
createdAt: 0,
expiresAt: 0,
completedAt: null as number | null,
};
public isExpired(nowArg = Date.now()) {
return this.data.expiresAt < nowArg;
}
public async markCompleted() {
this.data.status = 'completed';
this.data.completedAt = Date.now();
await this.save();
}
public async markExpired() {
this.data.status = 'expired';
await this.save();
}
}