diff --git a/src/models/src/credential.ts b/src/models/src/credential.ts index 8a8ad7e..ef092a9 100644 --- a/src/models/src/credential.ts +++ b/src/models/src/credential.ts @@ -1,4 +1,4 @@ -import { ToJson } from '@/types.ts' +import type { Base64String, ToJson, UUID } from '@/types.ts' import { Ressource } from '@models/ressource.ts' export class Credential extends Ressource { @@ -77,29 +77,38 @@ export interface Credential extends Ressource { type CredentialCategory = T extends 'password' ? { store: { - hash: string //hex or b64 of Uint8Array + hash: Base64String alg: string - salt: string //hex or b64 of Uint8Array + salt: Base64String } } : T extends 'ssh' ? { store: { - publicKey: string + publicKey: Base64String } } : T extends 'passkey' ? { - store: Record + store: Passkey } : never -/* -PassKey store: -{ - publicKey: Uint8Array - keyId: string - transport: string - counter: number +/** Passkey store */ +type Passkey = { + /** User UUID */ + user: UUID + /** WebAuthn registration key id */ + webAuthnUserID: string + /** Passkey credential unique id */ + id: string + /** Passkey user public key */ + publicKey: Base64String + /** Number of times the authenticator has been used */ + counter: number + /** Whether the passkey is single-device or multi-device */ + deviceType: 'singleDevice' | 'multiDevice' + /** Whether the passkey has been backed up in some way */ + backedUp: boolean + /** Passkey physical transport layer */ + transports?: + ('ble' | 'cable' | 'hybrid' | 'internal' | 'nfc' | 'smart-card' | 'usb')[] } -*/ - -//new Uint8Array(Object.values(JSON.parse(JSON.stringify(new Uint8Array([1, 2, 3]))))) diff --git a/types.ts b/types.ts index 0b6a87d..b90965d 100644 --- a/types.ts +++ b/types.ts @@ -26,3 +26,5 @@ export type Posix = { home: string shell: string } + +export type Base64String = string