feat: add passkey creation functionality

This commit is contained in:
Prad Nukala
2024-12-08 22:53:04 -05:00
parent 5c3966a9d6
commit e0ebe92361
15 changed files with 189 additions and 118 deletions
+47
View File
@@ -0,0 +1,47 @@
package passkeys
import (
"github.com/go-webauthn/webauthn/protocol"
"github.com/go-webauthn/webauthn/protocol/webauthncose"
)
func defaultPrimaryAttestationFormats() []protocol.AttestationFormat {
return []protocol.AttestationFormat{
protocol.AttestationFormatApple,
protocol.AttestationFormatAndroidKey,
protocol.AttestationFormatAndroidSafetyNet,
protocol.AttestationFormatFIDOUniversalSecondFactor,
}
}
func defaultSecondaryAttestationFormats() []protocol.AttestationFormat {
return []protocol.AttestationFormat{
protocol.AttestationFormatPacked,
protocol.AttestationFormatTPM,
}
}
func defaultAuthenticatorSelection() protocol.AuthenticatorSelection {
return protocol.AuthenticatorSelection{
AuthenticatorAttachment: protocol.Platform,
ResidentKey: protocol.ResidentKeyRequirementRequired,
UserVerification: protocol.VerificationRequired,
}
}
func buildCredentialParameters() []protocol.CredentialParameter {
return []protocol.CredentialParameter{
{
Type: "public-key",
Algorithm: webauthncose.AlgES256,
},
{
Type: "public-key",
Algorithm: webauthncose.AlgES256K,
},
{
Type: "public-key",
Algorithm: webauthncose.AlgEdDSA,
},
}
}