virtualauth

package
v0.44.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package virtualauth is a software WebAuthn authenticator for tests: it produces "none" attestations and ES256 assertions exactly as the specification lays them out, so ceremonies can be driven end to end without a browser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator struct {
	// Origin is what the "browser" reports in clientDataJSON (default: the origin passed to New).
	Origin string
	// UserVerified sets the UV flag (default true); BackupEligible/BackupState set BE/BS.
	UserVerified   bool
	BackupEligible bool
	BackupState    bool
	// AAGUID is reported at registration.
	AAGUID [16]byte
	// Counter increment per assertion; 0 keeps the counter at zero like most synced passkeys.
	CounterStep uint32
	Creds       []*Credential
}

Authenticator holds credentials and the knobs tests turn to exercise failure paths.

func New

func New(origin string) *Authenticator

New returns an authenticator for a browser at origin.

func (*Authenticator) Create

func (a *Authenticator) Create(options []byte) ([]byte, *Credential, error)

Create answers navigator.credentials.create(options): options is the server's JSON ({"publicKey": ...}); the result is PublicKeyCredential.toJSON().

func (*Authenticator) Get

func (a *Authenticator) Get(options []byte) ([]byte, *Credential, error)

Get answers navigator.credentials.get(options). The credential is chosen from the allow list, or, when empty, any resident credential for the RP. The result is PublicKeyCredential.toJSON().

func (*Authenticator) GetWith

func (a *Authenticator) GetWith(options []byte, c *Credential, counter uint32, origin string) ([]byte, error)

GetWith signs an assertion with an explicit counter and origin (to forge regressions and wrong origins).

type Credential

type Credential struct {
	ID         []byte
	Key        *ecdsa.PrivateKey
	RPID       string
	UserHandle []byte
	Counter    uint32
}

Credential is one resident credential held by the authenticator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL