fido2

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package fido2 implements a provider that derives a 32-byte secret from a FIDO2 hardware key using the hmac-secret extension.

Requires: libfido2 development headers and CGO_ENABLED=1.

This file calls fido_init(FIDO_DISABLE_U2F_FALLBACK) via a GCC constructor before go-libfido2's init() runs fido_init(0). The U2F fallback path probes PC/SC readers, which grabs an exclusive handle and prevents go-piv from establishing its own PC/SC context for PIV operations. Disabling the fallback lets both providers coexist.

fido_init ignores subsequent calls (libfido2 >= 1.5), so the upstream init() becomes a no-op.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceInfo

type DeviceInfo struct {
	Path         string
	Manufacturer string
	Product      string
	DisplayName  string
}

DeviceInfo holds device metadata safe for use outside CGo contexts.

func ListDevices

func ListDevices() ([]DeviceInfo, error)

ListDevices returns available FIDO2 devices.

type FIDO2

type FIDO2 struct{}

func (*FIDO2) Derive

func (f *FIDO2) Derive(ctx context.Context, params map[string]string) ([]byte, error)

func (*FIDO2) DeriveTimeout

func (f *FIDO2) DeriveTimeout() time.Duration

func (*FIDO2) Description

func (f *FIDO2) Description() string

func (*FIDO2) Enroll

func (f *FIDO2) Enroll(ctx context.Context, id string) (*provider.EnrollResult, error)

func (*FIDO2) EnrollOptions

func (f *FIDO2) EnrollOptions() []provider.EnrollOption

func (*FIDO2) InteractiveDerive

func (f *FIDO2) InteractiveDerive() bool

func (*FIDO2) PreDerive

func (f *FIDO2) PreDerive(ctx context.Context, params map[string]string) (context.Context, error)

PreDerive collects the FIDO2 PIN before the timeout-wrapped assertion. This avoids tty conflicts between PIN prompt and Enter-to-skip listener.

func (*FIDO2) Type

func (f *FIDO2) Type() string

Jump to

Keyboard shortcuts

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