mirror of
https://github.com/warmbly/warmbly.git
synced 2026-09-06 08:01:24 +00:00
Add passkey enrollment and login wiring, including a Safari-safe explicit login path that prefetches the WebAuthn challenge before the click and calls the credential ceremony immediately from the user gesture.
33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// WebAuthnCredential is a stored passkey (FIDO2/WebAuthn credential).
|
|
//
|
|
// Sensitive material (credential ID, public key, AAGUID, counters) is kept
|
|
// off the JSON wire by default — the passkey manager renders from a purpose
|
|
// built view DTO instead of serializing this model directly.
|
|
type WebAuthnCredential struct {
|
|
ID uuid.UUID `json:"id"`
|
|
UserID uuid.UUID `json:"-"`
|
|
CredentialID []byte `json:"-"`
|
|
PublicKey []byte `json:"-"`
|
|
AttestationType string `json:"-"`
|
|
AttestationFormat string `json:"-"`
|
|
Transports []string `json:"transports"`
|
|
AAGUID []byte `json:"-"`
|
|
SignCount uint32 `json:"-"`
|
|
CloneWarning bool `json:"-"`
|
|
BackupEligible bool `json:"backup_eligible"`
|
|
BackupState bool `json:"backup_state"`
|
|
UserPresent bool `json:"-"`
|
|
UserVerified bool `json:"-"`
|
|
Name string `json:"name"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
LastUsedAt *time.Time `json:"last_used_at"`
|
|
}
|