u2fhid

package
v0.0.0-...-c9753ac Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package u2fhid implements the U2F HID message framing protocol.

Index

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

func (*Communication) Write

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

Write writes to the underlying device.

Jump to

Keyboard shortcuts

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