pcsc

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package pcsc provides access to Token2 devices over PC/SC.

Index

Constants

This section is empty.

Variables

View Source
var ErrOTPApplicationNotAvailable = errors.New(
	"token2 pcsc: OTP application not available",
)

ErrOTPApplicationNotAvailable reports that the selected card does not expose the Token2 OTP application used for device information.

Functions

This section is empty.

Types

type Device

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

Device is a Token2 device connected through a PC/SC reader.

func Open

func Open(reader string) (*Device, error)

Open connects to the Token2 device in reader.

func (*Device) ATR

func (d *Device) ATR(_ context.Context) (token2.ATR, error)

ATR returns information encoded in the device answer-to-reset.

func (*Device) Close

func (d *Device) Close() error

Close closes the PC/SC connection.

func (*Device) Configuration

func (d *Device) Configuration(
	ctx context.Context,
) (config token2.Configuration, err error)

Configuration returns the Token2 device configuration.

func (*Device) DeviceInfo

func (d *Device) DeviceInfo(
	ctx context.Context,
) (info token2.DeviceInfo, err error)

DeviceInfo returns transport-neutral information derived from the device serial number.

func (*Device) SetReaderNFC

func (d *Device) SetReaderNFC(ctx context.Context, enabled bool) error

SetReaderNFC enables or disables the Token2 reader NFC interface. A nil error confirms only that the reader returned 9000; unsupported readers may accept and ignore the command. Power-cycle the reader to apply the setting.

func (*Device) SetReaderSoundLevel

func (d *Device) SetReaderSoundLevel(ctx context.Context, level ReaderSoundLevel) error

SetReaderSoundLevel configures the Token2 reader sound level. A nil error confirms only that the reader returned 9000; unsupported readers may accept and ignore the command. Power-cycle the reader to apply the setting.

type ReaderSoundLevel

type ReaderSoundLevel byte

ReaderSoundLevel is the sound level configured on a Token2 reader.

const (
	ReaderSoundOff ReaderSoundLevel = iota
	ReaderSoundLevel1
	ReaderSoundLevel2
	ReaderSoundLevel3
	ReaderSoundLevel4
	ReaderSoundLevel5
)

Jump to

Keyboard shortcuts

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