Version: v0.0.0-...-e35fbaf Latest Latest

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

Go to latest
Published: Jul 5, 2021 License: Apache-2.0 Imports: 5 Imported by: 0



Package u2fhid implements the U2F HID message framing protocol.



This section is empty.


This section is empty.


This section is empty.


type Communication

type Communication struct {
	// contains filtered or unexported fields

Communication encodes messages as U2F HID packets. according to https://fidoalliance.org/specs/fido-u2f-v1.0-ps-20141009/fido-u2f-hid-protocol-ps-20141009.html#message--and-packet-structure.

func NewCommunication

func NewCommunication(
	device io.ReadWriteCloser,
	cmd byte) *Communication

NewCommunication creates a new Communication. cmd is the CMD byte which is sent and which is expected in responses.

func (*Communication) Close

func (communication *Communication) Close()

Close closes the underlying device.

func (*Communication) Query

func (communication *Communication) Query(request []byte) ([]byte, error)

Query sends a request and waits for the response. Blocking.

func (*Communication) Read

func (communication *Communication) Read(p []byte) (n int, err error)

Read reads from the underlying device.

func (*Communication) ReadFrame

func (communication *Communication) ReadFrame() ([]byte, error)

ReadFrame reads U2F HID message from a series of packets.

func (*Communication) SendFrame

func (communication *Communication) SendFrame(msg string) error

SendFrame sends one message in chunks, as a series of U2F HID packets. See https://fidoalliance.org/specs/fido-u2f-v1.0-ps-20141009/fido-u2f-hid-protocol-ps-20141009.html#message--and-packet-structure

func (*Communication) Write

func (communication *Communication) Write(p []byte) (n int, err error)

Write writes to the underlying device.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL