Documentation
¶
Overview ¶
Package token2 parses vendor responses and identifies models by full serial. Device access lives in transport; physical-device correlation belongs to the consuming runtime.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidATR = errors.New("token2: invalid ATR")
ErrInvalidATR reports malformed ATR data or malformed Token2 identity bytes.
var ErrInvalidConfiguration = errors.New("token2: invalid configuration")
ErrInvalidConfiguration 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 ATR ¶
type ATR struct {
Raw []byte `json:"raw"`
Identity *ATRIdentity `json:"identity,omitempty"`
}
ATR contains Token2 identity data encoded in a PC/SC answer-to-reset.
type ATRIdentity ¶ added in v0.12.0
type ATRIdentity struct {
ProductID uint16 `json:"productId"`
SerialSuffix string `json:"serialSuffix"`
}
ATRIdentity is present only for Token2's vendor historical-byte format.
type Appearance ¶
type Appearance [4]byte
Appearance identifies the Token2 device appearance reported by its firmware.
type Capabilities ¶ added in v0.12.0
type Capabilities struct {
FIDOPINSet bool `json:"fidoPINSet"`
FIDOPINLocked bool `json:"fidoPINLocked"`
SupportsHOTP bool `json:"supportsHOTP"`
SupportsTOTP bool `json:"supportsTOTP"`
SupportsNFC bool `json:"supportsNFC"`
SupportsCCID bool `json:"supportsCCID"`
SupportsFIDO21 bool `json:"supportsFIDO21"`
HasFingerprintSensor bool `json:"hasFingerprintSensor"`
SupportsFingerprintRegistration bool `json:"supportsFingerprintRegistration"`
SupportsMandatoryFingerprint bool `json:"supportsMandatoryFingerprint"`
OTPRequiresFingerprint bool `json:"otpRequiresFingerprint"`
SupportsButtonHOTP bool `json:"supportsButtonHOTP"`
ButtonHOTPConfigured bool `json:"buttonHOTPConfigured"`
ButtonHOTPSendsEnter bool `json:"buttonHOTPSendsEnter"`
ButtonHOTPRequiresLongPress bool `json:"buttonHOTPRequiresLongPress"`
ButtonHOTPUsesNumericKeypad bool `json:"buttonHOTPUsesNumericKeypad"`
}
Capabilities contains flags reported in a modern configuration.
type Configuration ¶
type Configuration struct {
Raw []byte `json:"raw"`
TransferType TransferType `json:"transferType"`
DeviceConfiguration DeviceConfiguration `json:"deviceConfiguration"`
Appearance Appearance `json:"appearance"`
FIDOVersion FIDOVersion `json:"fidoVersion"`
DeviceExtension DeviceExtension `json:"deviceExtension"`
}
Configuration holds the decoded response; Raw retains all bytes, including unknown fields.
func ParseConfiguration ¶
func ParseConfiguration(response []byte) (Configuration, error)
ParseConfiguration parses either a one-byte legacy response or a modern response of at least ten bytes. Additional bytes are retained in Raw.
func (Configuration) Capabilities ¶ added in v0.12.0
func (c Configuration) Capabilities() (Capabilities, bool)
Capabilities decodes the modern configuration masks. The boolean is false for a legacy response, which supplies only interface state.
func (Configuration) InterfaceState ¶ added in v0.12.0
func (c Configuration) InterfaceState() InterfaceState
InterfaceState decodes the transfer-type mask, including legacy responses.
type Descriptor ¶ added in v0.12.0
Descriptor holds a device observation. A non-nil Value is a completed read, including zero values and empty strings. Err holds the original read failure. Both may be set when data was received before an error. Neither is set when the interface did not provide a reading. Errors are not serialized to JSON.
type DeviceConfiguration ¶ added in v0.12.0
type DeviceConfiguration byte
DeviceConfiguration contains the device's configuration and capability bits.
const ( DeviceConfigurationHOTPSuppressEnterMask DeviceConfiguration = 0x01 DeviceConfigurationFIDOPINSetMask DeviceConfiguration = 0x02 DeviceConfigurationHOTPMask DeviceConfiguration = 0x04 DeviceConfigurationFingerprintSensorMask DeviceConfiguration = 0x08 DeviceConfigurationNFCMask DeviceConfiguration = 0x10 DeviceConfigurationHOTPLongPressMask DeviceConfiguration = 0x20 DeviceConfigurationFIDOPINLockedMask DeviceConfiguration = 0x40 DeviceConfigurationButtonHOTPConfiguredMask DeviceConfiguration = 0x80 )
type DeviceExtension ¶ added in v0.12.0
type DeviceExtension byte
DeviceExtension contains the extended configuration and capability bits.
const ( DeviceExtensionTOTPMask DeviceExtension = 0x01 DeviceExtensionFIDO21Mask DeviceExtension = 0x02 DeviceExtensionFingerprintRegistrationMask DeviceExtension = 0x04 DeviceExtensionHOTPNumericKeypadMask DeviceExtension = 0x08 DeviceExtensionCCIDMask DeviceExtension = 0x10 DeviceExtensionButtonHOTPUnsupportedMask DeviceExtension = 0x20 DeviceExtensionOTPRequiresFingerprintMask DeviceExtension = 0x40 DeviceExtensionMandatoryFingerprintSupportMask DeviceExtension = 0x80 )
type DeviceInfo ¶
type DeviceInfo struct {
SerialNumber Descriptor[string] `json:"serialNumber"`
ATR Descriptor[ATR] `json:"atr"`
Configuration Descriptor[Configuration] `json:"configuration"`
Model *Model `json:"model,omitempty"`
}
DeviceInfo contains the independent vendor readings from one interface. Correlation with other interfaces belongs to the consuming device runtime.
func (DeviceInfo) HasData ¶ added in v0.12.0
func (info DeviceInfo) HasData() bool
type FIDOVersion ¶
type FIDOVersion struct {
Major byte `json:"major"`
Minor byte `json:"minor"`
Patch byte `json:"patch"`
}
FIDOVersion is the three-component FIDO version reported by a Token2 device.
type InterfaceState ¶ added in v0.12.0
type InterfaceState struct {
FIDOEnabled bool `json:"fidoEnabled"`
HOTPKeystrokeEnabled bool `json:"hotpKeystrokeEnabled"`
CCIDEnabled bool `json:"ccidEnabled"`
}
InterfaceState describes the interfaces enabled by the configuration mask.
type Model ¶ added in v0.12.0
type Model struct {
Release string `json:"release"`
FormFactor string `json:"formFactor"`
Branding string `json:"branding"`
}
Model is a serial-catalogue match, independent of raw command readings.
type TransferType ¶ added in v0.12.0
type TransferType byte
TransferType is the interface-state bitmask reported by the device.
const ( TransferTypeFIDODisabledMask TransferType = 0x01 TransferTypeHOTPKeystrokeDisabledMask TransferType = 0x02 TransferTypeCCIDDisabledMask TransferType = 0x04 )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
pcsc-serial-monitor
command
|
|
|
token2-probe
command
token2-probe records read-only observations from one manually labelled token.
|
token2-probe records read-only observations from one manually labelled token. |
|
internal
|
|
|
protocol
Package protocol defines the Token2 commands shared by transport adapters.
|
Package protocol defines the Token2 commands shared by transport adapters. |
|
Package piv implements TOKEN2 PIV extensions over a borrowed, selected PIV connection.
|
Package piv implements TOKEN2 PIV extensions over a borrowed, selected PIV connection. |
|
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. |