fidoctl

package module
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: MIT Imports: 6 Imported by: 0

README

fidoctl

A simple library to configure a Yubikey using the FIDO (HID) interface. Mostly used for reboot.

Documentation

Index

Examples

Constants

View Source
const (
	ConfigTagUsbSupported     = 0x01
	ConfigTagSerial           = 0x02
	ConfigTagUsbEnabled       = 0x03
	ConfigTagFormFactor       = 0x04
	ConfigTagVersion          = 0x05
	ConfigTagAutoEjectTimeout = 0x06
	ConfigTagChalrespTimeout  = 0x07
	ConfigTagDeviceFlags      = 0x08
	ConfigTagAppVersions      = 0x09
	ConfigTagConfigLock       = 0x0A
	ConfigTagUnlock           = 0x0B
	ConfigTagReboot           = 0x0C
	ConfigTagNfcSupported     = 0x0D
	ConfigTagNfcEnabled       = 0x0E
	ConfigTagIapDetection     = 0x0F
	ConfigTagMoreData         = 0x10
	ConfigTagFreeForm         = 0x11
	ConfigTagHidInitDelay     = 0x12
	ConfigTagPartNumber       = 0x13
	ConfigTagFipsCapable      = 0x14
	ConfigTagFipsApproved     = 0x15
	ConfigTagPinComplexity    = 0x16
	ConfigTagNfcRestricted    = 0x17
	ConfigTagResetBlocked     = 0x18
	ConfigTagFpsVersion       = 0x20
	ConfigTagStmVersion       = 0x21
)
View Source
const (
	YubicoVID = 0x1050
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CTAPError

type CTAPError struct {
	Code uint8
}

func (*CTAPError) Error

func (e *CTAPError) Error() string

type CTAPPacket

type CTAPPacket struct {
	CMD   uint8
	BCNTH uint8
	BCNTL uint8
	DATA  []byte
	// contains filtered or unexported fields
}

func (*CTAPPacket) FromHID

func (c *CTAPPacket) FromHID(cid uint32, in []byte) (bool, error)

func (*CTAPPacket) ToHID

func (c *CTAPPacket) ToHID(cid uint32, reportInputLength uint16) [][]byte

type Device

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

func Enumerate

func Enumerate() ([]Device, error)
Example
package main

import (
	"fmt"
	"log"

	"github.com/buglloc/fidoctl"
)

func main() {
	devices, err := fidoctl.Enumerate()
	if err != nil {
		panic(fmt.Errorf("Enumerate: %v", err))
	}

	for _, device := range devices {
		fmt.Println(device.String())
		cfg, err := device.YubiConfig()
		if err != nil {
			log.Printf("Getting YubiConfig: %v", err)
			continue
		}

		fmt.Printf("  - serial: %d\n", cfg.Serial())
		fmt.Printf("  - version: %s\n", cfg.Version())
	}
}

func (*Device) Close

func (d *Device) Close() error

func (*Device) OneShot

func (d *Device) OneShot(fn func(d *Device) error) error

func (*Device) Open

func (d *Device) Open() error

func (*Device) Path

func (d *Device) Path() string

func (*Device) Reboot

func (d *Device) Reboot() error

func (*Device) SendAndReceive

func (d *Device) SendAndReceive(cmd uint8, data []byte) ([]byte, error)

func (*Device) String

func (d *Device) String() string

func (*Device) YubiConfig added in v0.9.1

func (d *Device) YubiConfig() (*YubiConfig, error)

type Version added in v0.9.1

type Version struct {
	Major int
	Minor int
	Patch int
}

func (Version) String added in v0.9.1

func (v Version) String() string

type YubiConfig added in v0.9.1

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

func (*YubiConfig) Clear added in v0.9.1

func (c *YubiConfig) Clear() *YubiConfig

func (*YubiConfig) Get added in v0.9.1

func (c *YubiConfig) Get(tag int) []byte

func (*YubiConfig) Has added in v0.9.1

func (c *YubiConfig) Has(tag int) bool

func (*YubiConfig) Marshal added in v0.9.1

func (c *YubiConfig) Marshal() ([]byte, error)

func (*YubiConfig) Serial added in v0.9.1

func (c *YubiConfig) Serial() uint32

func (*YubiConfig) Set added in v0.9.1

func (c *YubiConfig) Set(tag int, data []byte) *YubiConfig

func (*YubiConfig) Unmarshal added in v0.9.1

func (c *YubiConfig) Unmarshal(data []byte) error

func (*YubiConfig) Version added in v0.9.1

func (c *YubiConfig) Version() Version

Jump to

Keyboard shortcuts

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