Documentation
¶
Overview ¶
Package token2 provides transport-independent Token2 device models, response parsers and identity lookup.
Concrete device implementations live under transport. All implement Device; supported operations are expressed by capability interfaces and remain available on concrete types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidATR = errors.New("token2: invalid ATR")
ErrInvalidATR reports an ATR that does not contain the expected Token2 historical bytes.
var ErrInvalidConfigResponse = errors.New("token2: invalid configuration response")
ErrInvalidConfigResponse reports malformed configuration data received from a Token2 device.
var ErrInvalidSerialResponse = errors.New("token2: invalid serial-number response")
ErrInvalidSerialResponse reports a malformed serial-number response received from a Token2 device.
Functions ¶
func ParseSerialNumber ¶
ParseSerialNumber parses the TAG-LENGTH-VALUE response returned by the Token2 serial-number command.
Types ¶
type Config ¶
type Config struct {
Raw []byte
TransferType byte
DeviceConfiguration byte
Appearance [4]byte
FIDOVersion Version
DeviceExtension byte
}
Config describes the Token2 configuration response. Raw retains the complete response, including fields unknown to this version of the package.
func ParseConfig ¶
ParseConfig parses either a one-byte legacy response or a modern response of at least ten bytes. Additional bytes are retained in Raw.
func (Config) CCIDSupported ¶
CCIDSupported reports whether the device exposes a CCID interface.
func (Config) FIDO21Supported ¶
FIDO21Supported reports whether the device supports FIDO 2.1.
func (Config) FingerprintSensorPresent ¶
FingerprintSensorPresent reports whether the device has a fingerprint sensor.
func (Config) HOTPSupported ¶
HOTPSupported reports whether the device supports HOTP.
func (Config) NFCSupported ¶
NFCSupported reports whether the device supports NFC.
func (Config) TOTPSupported ¶
TOTPSupported reports whether the device supports TOTP.
type Device ¶
type Device interface {
Close() error
}
Device is the lifecycle contract implemented by Token2 transport devices. Transport-specific capabilities are described by capability interfaces such as SerialNumberDevice and ATRDevice.
type Identity ¶
type Identity struct {
SerialNumber string
Prefix string
CheckDigit byte
Suffix string
Model Model
}
Identity contains the model information derived from a full Token2 serial number. Prefix, CheckDigit and Suffix are empty for range-based models.
type Model ¶
type Model struct {
Revision string
FormFactor string
Branding string
Prefix string
SerialFrom uint64
SerialTo uint64
}
Model describes a Token2 hardware model identified by either a serial-number prefix or an inclusive serial-number range.
func (Model) DisplayName ¶
DisplayName returns the canonical human-readable name of the model.
type SerialNumberDevice ¶
SerialNumberDevice is a Device capable of returning the full Token2 serial number.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package apdu implements the ISO/IEC 7816-4 command and response APDU subset used by Token2 devices.
|
Package apdu implements the ISO/IEC 7816-4 command and response APDU subset used by Token2 devices. |
|
internal
|
|
|
protocol
Package protocol defines the Token2 commands shared by transport adapters.
|
Package protocol defines the Token2 commands shared by transport adapters. |
|
transport
|
|
|
ctaphid
Package ctaphid accesses Token2 vendor commands over the CTAPHID protocol.
|
Package ctaphid accesses Token2 vendor commands over the CTAPHID protocol. |
|
hid
Package hid accesses Token2 devices through USB HID feature reports.
|
Package hid accesses Token2 devices through USB HID feature reports. |
|
pcsc
Package pcsc provides access to Token2 devices over PC/SC.
|
Package pcsc provides access to Token2 devices over PC/SC. |