Documentation ¶
Overview ¶
Package u2fhid implements the U2F HID message framing protocol.
Index ¶
- type Communication
- func (communication *Communication) Close()
- func (communication *Communication) Query(request []byte) ([]byte, error)
- func (communication *Communication) Read(p []byte) (n int, err error)
- func (communication *Communication) ReadFrame() ([]byte, error)
- func (communication *Communication) SendFrame(msg string) error
- func (communication *Communication) Write(p []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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