refactor(model): ♻️ rename type string
to Base64String
where is meaningful
This commit is contained in:
parent
dda72bf67d
commit
3c773bca6b
|
@ -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' | 'ssh' | 'passkey'> = 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<string, unknown>
|
||||
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])))))
|
||||
|
|
Loading…
Reference in a new issue