fix: add missing passkey flags to make icloud passkeys work

This commit is contained in:
Elias Schneider
2024-08-13 23:19:36 +02:00
parent 5749d0532f
commit cc407e17d4
5 changed files with 13 additions and 0 deletions

View File

@@ -98,6 +98,8 @@ func verifyRegistrationHandler(c *gin.Context) {
PublicKey: credential.PublicKey, PublicKey: credential.PublicKey,
Transport: credential.Transport, Transport: credential.Transport,
UserID: user.ID, UserID: user.ID,
BackupEligible: credential.Flags.BackupEligible,
BackupState: credential.Flags.BackupState,
} }
if err := common.DB.Create(&credentialToStore).Error; err != nil { if err := common.DB.Create(&credentialToStore).Error; err != nil {
utils.UnknownHandlerError(c, err) utils.UnknownHandlerError(c, err)

View File

@@ -35,6 +35,10 @@ func (u User) WebAuthnCredentials() []webauthn.Credential {
AttestationType: credential.AttestationType, AttestationType: credential.AttestationType,
PublicKey: credential.PublicKey, PublicKey: credential.PublicKey,
Transport: credential.Transport, Transport: credential.Transport,
Flags: webauthn.CredentialFlags{
BackupState: credential.BackupState,
BackupEligible: credential.BackupEligible,
},
} }
} }

View File

@@ -25,6 +25,9 @@ type WebauthnCredential struct {
AttestationType string `json:"attestationType"` AttestationType string `json:"attestationType"`
Transport AuthenticatorTransportList `json:"-"` Transport AuthenticatorTransportList `json:"-"`
BackupEligible bool `json:"backupEligible"`
BackupState bool `json:"backupState"`
UserID string UserID string
} }

View File

@@ -0,0 +1,2 @@
ALTER TABLE webauthn_credentials ADD COLUMN backup_eligible BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE webauthn_credentials ADD COLUMN backup_state BOOLEAN NOT NULL DEFAULT FALSE;

View File

@@ -0,0 +1,2 @@
ALTER TABLE webauthn_credentials DROP COLUMN backup_eligible;
ALTER TABLE webauthn_credentials DROP COLUMN backup_state;