u2ftoken

package
v0.0.0-...-ab65172 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Register registers a new relying party.
	Register command

	// Authenticate authenticates a relying party with the associated identity, stored in the token.
	Authenticate

	// Version returns the standard "U2F_V2" version string.
	Version
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Params

type Params struct {
	First  uint8
	Second uint8
}

Params holds the two APDU standard request parameters.

type Request

type Request struct {
	Command          command
	Parameters       Params
	MaxResponseBytes uint16
	Data             []byte
}

Request represents a standard APDU request.

type Response

type Response struct {
	Data       []byte
	StatusCode [2]byte
}

Response represents a standard APDU response.

func (Response) Bytes

func (r Response) Bytes() []byte

Bytes returns the byte slice representation of r.

type Token

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

Token represents a U2F token. It handles request parsing and composition, key storage orchestration.

func New

func New(k *keyring.Keyring, attCert, attPrivKey []byte) (*Token, error)

New returns a new Token instance with k as Keyring. attCert must be a PEM-encoded certificate, while attPrivKey must be a X.509-encoded ECDSA private key.

func (*Token) HandleMessage

func (t *Token) HandleMessage(data []byte) []byte

HandleMessage handles a message, and returns a response byte slice.

func (*Token) ParseRequest

func (t *Token) ParseRequest(req []byte) (Request, error)

ParseRequest parses req as a U2F request. It returns a Request instance filled with the appropriate data from req, and an error.

Jump to

Keyboard shortcuts

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