From ff9a65e8faa46a101d3ed3dc8915dd1f269ef556 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 8 Sep 2023 14:05:03 +0900 Subject: feat: passkey support (#11804) https://github.com/MisskeyIO/misskey/pull/149 --- .../backend/src/models/entities/UserSecurityKey.ts | 37 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'packages/backend/src/models/entities/UserSecurityKey.ts') diff --git a/packages/backend/src/models/entities/UserSecurityKey.ts b/packages/backend/src/models/entities/UserSecurityKey.ts index ce1c270d46..96dd27d083 100644 --- a/packages/backend/src/models/entities/UserSecurityKey.ts +++ b/packages/backend/src/models/entities/UserSecurityKey.ts @@ -24,24 +24,47 @@ export class MiUserSecurityKey { @JoinColumn() public user: MiUser | null; + @Column('varchar', { + comment: 'User-defined name for this key', + length: 30, + }) + public name: string; + @Index() @Column('varchar', { - comment: - 'Variable-length public key used to verify attestations (hex-encoded).', + comment: 'The public key of the UserSecurityKey, hex-encoded.', }) public publicKey: string; + @Column('bigint', { + comment: 'The number of times the UserSecurityKey was validated.', + default: 0, + }) + public counter: number; + @Column('timestamp with time zone', { - comment: - 'The date of the last time the UserSecurityKey was successfully validated.', + comment: 'Timestamp of the last time the UserSecurityKey was used.', + default: () => 'now()', }) public lastUsed: Date; @Column('varchar', { - comment: 'User-defined name for this key', - length: 30, + comment: 'The type of Backup Eligibility in authenticator data', + length: 32, nullable: true, }) - public name: string; + public credentialDeviceType: string | null; + + @Column('boolean', { + comment: 'Whether or not the credential has been backed up', + nullable: true, + }) + public credentialBackedUp: boolean | null; + + @Column('varchar', { + comment: 'The type of the credential returned by the browser', + length: 32, array: true, nullable: true, + }) + public transports: string[] | null; constructor(data: Partial) { if (data == null) return; -- cgit v1.2.3-freya