29 lines
766 B
TypeScript
29 lines
766 B
TypeScript
import * as plugins from '../plugins.js';
|
|
import type { MfaManager } from './classes.mfamanager.js';
|
|
|
|
@plugins.smartdata.Manager()
|
|
export class PasskeyCredential extends plugins.smartdata.SmartDataDbDoc<PasskeyCredential, any, MfaManager> {
|
|
@plugins.smartdata.unI()
|
|
public id: string;
|
|
|
|
@plugins.smartdata.svDb()
|
|
public data = {
|
|
userId: '',
|
|
label: '',
|
|
credentialId: '',
|
|
publicKeyBase64: '',
|
|
counter: 0,
|
|
deviceType: 'singleDevice' as 'singleDevice' | 'multiDevice',
|
|
backedUp: false,
|
|
transports: [] as string[],
|
|
status: 'active' as 'active' | 'revoked',
|
|
createdAt: 0,
|
|
lastUsedAt: null as number | null,
|
|
revokedAt: null as number | null,
|
|
};
|
|
|
|
public isActive() {
|
|
return this.data.status === 'active';
|
|
}
|
|
}
|