modules/auth/passkey/passkeytest
Package passkeytest is a software passkey authenticator for tests. It answers registration and sign-in options with real, signed responses (P-256 keys, attestation none), so tests exercise the same verification browsers and devices go through.
Stability: pre-1.0 (ADR-0015).
Types#
type Authenticator#
type Authenticator struct {
// UserVerified sets the user-verification flag (default true). Set it
// false to test a passkey used without verifying the person.
UserVerified bool
// Synced makes it behave like a synced passkey: backup flags set and a
// signature counter that stays 0.
Synced bool
// contains filtered or unexported fields
}Authenticator holds one passkey and answers ceremonies with it.
func New#
func New(origin string) *AuthenticatorNew returns an authenticator that reports origin, such as http://localhost:8080 or an android:apk-key-hash: origin.
func (*Authenticator) Create#
func (a *Authenticator) Create(options []byte) ([]byte, error)Create answers registration options ({"publicKey": ...}) with a new passkey, returning the JSON a browser would send.
func (*Authenticator) CredentialID#
func (a *Authenticator) CredentialID() []byteCredentialID returns the passkey's credential ID, after Create.
func (*Authenticator) Get#
func (a *Authenticator) Get(options []byte) ([]byte, error)Get answers sign-in options ({"publicKey": ...}) with a signed assertion, returning the JSON a browser would send.
func (*Authenticator) SetSignCount#
func (a *Authenticator) SetSignCount(n uint32)SetSignCount sets the signature counter; the next Get reports n+1.