Documentation
¶
Overview ¶
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: stable, for tests only: the API follows the compatibility promise; what the helpers do inside a test may change (ADR-0015, ADR-0054).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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) *Authenticator
New 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() []byte
CredentialID 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.