testhid

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	// contains filtered or unexported fields
}

func New

func New(t testing.TB, responses ...Response) *Device

func NewCBORDevice

func NewCBORDevice(t testing.TB, cid ctaphid.ChannelID, responses ...[]byte) *Device

func (*Device) Close

func (d *Device) Close() error

func (*Device) Closed

func (d *Device) Closed() bool

func (*Device) FirstCTAPPayload

func (d *Device) FirstCTAPPayload(t testing.TB) (protocol.Command, []byte)

func (*Device) FirstCTAPRequestMap

func (d *Device) FirstCTAPRequestMap(t testing.TB) (protocol.Command, map[uint64]any)

func (*Device) FirstRequest

func (d *Device) FirstRequest(t testing.TB) Request

func (*Device) Read

func (d *Device) Read(p []byte) (int, error)

func (*Device) Requests

func (d *Device) Requests(t testing.TB) []Request

func (*Device) Write

func (d *Device) Write(p []byte) (int, error)

func (*Device) Writes

func (d *Device) Writes() []byte

type Request

type Request struct {
	CID     ctaphid.ChannelID
	Command ctaphid.Command
	Data    []byte
}

func ParseRequests

func ParseRequests(written []byte) ([]Request, error)

func (Request) CTAPPayload

func (r Request) CTAPPayload(t testing.TB) (protocol.Command, []byte)

func (Request) CTAPRequestMap

func (r Request) CTAPRequestMap(t testing.TB) (protocol.Command, map[uint64]any)

type Response

type Response struct {
	CID     ctaphid.ChannelID
	Command ctaphid.Command
	Data    []byte
}

func CBOROK

func CBOROK(cid ctaphid.ChannelID, data []byte) Response

func CBORStatus

func CBORStatus(cid ctaphid.ChannelID, status ctaphid.StatusCode) Response

func CTAPHIDError

func CTAPHIDError(cid ctaphid.ChannelID, err ctaphid.Error) Response

func Keepalive

func Keepalive(cid ctaphid.ChannelID, status ctaphid.StatusCode) Response

func Message

func Message(cid ctaphid.ChannelID, command ctaphid.Command, data []byte) Response

Jump to

Keyboard shortcuts

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