virtualauth

package
v0.45.0 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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