devicetest

package
v0.17.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: 9 Imported by: 0

Documentation

Overview

Package devicetest is a virtual WebAuthn authenticator for tests: it signs device assertions as a phone's platform authenticator would, so locks and the hub can test device-signed decisions 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 {
	RPID, Origin string
	Name         string
	Cred         []byte
	Key          *ecdsa.PrivateKey
	Seal         *ecdh.PrivateKey
	Counter      uint32
}

Authenticator is one virtual device: a WebAuthn credential (ES256) and an X25519 sealing key.

func New

func New(rpID, origin, name string) *Authenticator

New is a fresh authenticator for the relying party rpID at origin.

func (*Authenticator) Assert

func (a *Authenticator) Assert(challenge []byte) *ticket.DeviceAssertion

Assert signs challenge as a user-verified assertion.

func (*Authenticator) AssertWith

func (a *Authenticator) AssertWith(challenge []byte, o Options) *ticket.DeviceAssertion

AssertWith signs challenge with o.

func (*Authenticator) Decide

func (a *Authenticator) Decide(d *ticket.Decision, signed []byte)

Decide makes d a decision taken on a about the signed ticket it showed: approver and facade, then the assertion over its statement. d is signed by the hub afterwards.

func (*Authenticator) Device

func (a *Authenticator) Device() ticket.Device

Device is the record a lock pins for a.

func (*Authenticator) PublicKey

func (a *Authenticator) PublicKey() []byte

PublicKey is the credential's uncompressed P-256 point.

type Options

type Options struct {
	Type   string // default webauthn.get
	Origin string // default a.Origin
	RPID   string // default a.RPID
	Flags  *byte  // default UP|UV
	Cross  bool
}

Options change an assertion, to test what a verifier refuses.

Jump to

Keyboard shortcuts

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