Versions in this module Expand all Collapse all v0 v0.9.0 Aug 8, 2026 Changes in this version + const AttributeAsyncProtocolTypes — darwin/amd64, linux/amd64 + const AttributeDeviceFriendlyName — darwin/amd64, linux/amd64 + const AttributeDeviceSystemName — darwin/amd64, linux/amd64 + const AttributeSyncProtocolTypes — darwin/amd64, linux/amd64 + var ErrBadSeek = errors.New("pcsc: bad seek") + var ErrCHVBlocked = errors.New("pcsc: CHV blocked") + var ErrCacheItemNotFound = errors.New("pcsc: cache item not found") — windows/amd64 + var ErrCacheItemStale = errors.New("pcsc: cache item stale") — windows/amd64 + var ErrCacheItemTooBig = errors.New("pcsc: cache item too big") — windows/amd64 + var ErrCanceled = errors.New("pcsc: canceled") + var ErrCanceledByUser = errors.New("pcsc: canceled by user") + var ErrCannotDispose = errors.New("pcsc: cannot dispose") + var ErrCardNotAuthenticated = errors.New("pcsc: card not authenticated") + var ErrCardRemoved = errors.New("pcsc: card removed") + var ErrCardReset = errors.New("pcsc: card reset") + var ErrCardUnsupported = errors.New("pcsc: card unsupported") + var ErrCertificateUnavailable = errors.New("pcsc: certificate unavailable") + var ErrClosed = errors.New("pcsc: card closed") + var ErrCommunication = errors.New("pcsc: communication error") + var ErrCommunicationDataLost = errors.New("pcsc: communication data lost") + var ErrDirectoryNotFound = errors.New("pcsc: directory not found") + var ErrDuplicateReader = errors.New("pcsc: duplicate reader") + var ErrEndOfFile = errors.New("pcsc: end of file") + var ErrFileNotFound = errors.New("pcsc: file not found") + var ErrICCCreationOrder = errors.New("pcsc: ICC creation order unsupported") + var ErrICCInstallation = errors.New("pcsc: ICC installation unavailable") + var ErrInsufficientBuffer = errors.New("pcsc: insufficient buffer") + var ErrInternalError = errors.New("pcsc: internal error") + var ErrInvalidATR = errors.New("pcsc: invalid ATR") + var ErrInvalidCHV = errors.New("pcsc: invalid CHV") + var ErrInvalidHandle = errors.New("pcsc: invalid handle") + var ErrInvalidParameter = errors.New("pcsc: invalid parameter") + var ErrInvalidTarget = errors.New("pcsc: invalid target") + var ErrInvalidValue = errors.New("pcsc: invalid value") + var ErrNoAccess = errors.New("pcsc: access denied") + var ErrNoCard = errors.New("pcsc: no smart card") + var ErrNoKeyContainer = errors.New("pcsc: key container not found") + var ErrNoMemory = errors.New("pcsc: not enough memory") + var ErrNoPINCache = errors.New("pcsc: PIN cache unavailable") — windows/amd64 + var ErrNoReaders = errors.New("pcsc: no readers available") + var ErrNoService = errors.New("pcsc: no service") + var ErrNoSuchCertificate = errors.New("pcsc: certificate not found") + var ErrNotDirectory = errors.New("pcsc: path is not a directory") + var ErrNotFile = errors.New("pcsc: path is not a file") + var ErrNotReady = errors.New("pcsc: not ready") + var ErrNotTransacted = errors.New("pcsc: not transacted") + var ErrPCITooSmall = errors.New("pcsc: PCI buffer too small") + var ErrPINCacheExpired = errors.New("pcsc: PIN cache expired") — windows/amd64 + var ErrProtocolMismatch = errors.New("pcsc: protocol mismatch") + var ErrReadOnlyCard = errors.New("pcsc: read-only card") — windows/amd64 + var ErrReaderUnavailable = errors.New("pcsc: reader unavailable") + var ErrReaderUnsupported = errors.New("pcsc: reader unsupported") + var ErrSecurityViolation = errors.New("pcsc: security violation") + var ErrServerTooBusy = errors.New("pcsc: server too busy") + var ErrServiceStopped = errors.New("pcsc: service stopped") + var ErrSharingViolation = errors.New("pcsc: sharing violation") + var ErrShutdown = errors.New("pcsc: shutdown") + var ErrSystemCanceled = errors.New("pcsc: canceled by system") + var ErrTimeout = errors.New("pcsc: timeout") + var ErrUnavailable = errors.New("pcsc: unavailable") + var ErrUnexpected = errors.New("pcsc: unexpected error") + var ErrUnknownCard = errors.New("pcsc: unknown card") + var ErrUnknownError = errors.New("pcsc: unknown internal error") + var ErrUnknownReader = errors.New("pcsc: unknown reader") + var ErrUnknownResourceManager = errors.New("pcsc: unknown resource manager error") + var ErrUnpoweredCard = errors.New("pcsc: unpowered card") + var ErrUnresponsiveCard = errors.New("pcsc: unresponsive card") + var ErrUnsupportedCard = errors.New("pcsc: unsupported card") + var ErrUnsupportedFeature = errors.New("pcsc: unsupported feature") + var ErrWaitedTooLong = errors.New("pcsc: waited too long") + var ErrWriteTooMany = errors.New("pcsc: insufficient card memory") + var ErrWrongCHV = errors.New("pcsc: wrong CHV") + func ControlCode(function uint32) uint32 — darwin/amd64, linux/amd64, windows/amd64 + func Enumerate() iter.Seq2[*ReaderInfo, error] — darwin/amd64, linux/amd64, windows/amd64 + type Attribute uint32 + const AttributeATRString + const AttributeChannelID + const AttributeCharacteristics + const AttributeCurrentBWT + const AttributeCurrentCLK + const AttributeCurrentCWT + const AttributeCurrentD + const AttributeCurrentEBCEncoding + const AttributeCurrentF + const AttributeCurrentIFSC + const AttributeCurrentIFSD + const AttributeCurrentIOState + const AttributeCurrentN + const AttributeCurrentProtocolType + const AttributeCurrentW + const AttributeDefaultCLK + const AttributeDefaultDataRate + const AttributeDeviceFriendlyName + const AttributeDeviceFriendlyNameA + const AttributeDeviceFriendlyNameW + const AttributeDeviceInUse + const AttributeDeviceSystemName + const AttributeDeviceSystemNameA + const AttributeDeviceSystemNameW + const AttributeDeviceUnit + const AttributeESCAuthRequest + const AttributeESCCancel + const AttributeESCReset + const AttributeExtendedBWT + const AttributeICCInterfaceStatus + const AttributeICCPresence + const AttributeICCTypePerATR + const AttributeMaxCLK + const AttributeMaxDataRate + const AttributeMaxIFSD + const AttributeMaxInput + const AttributePerformanceBytesTransmitted + const AttributePerformanceNumberOfTransmissions + const AttributePerformanceTransmissionTime + const AttributePowerManagementSupport + const AttributeProtocolTypes + const AttributeSupressT1IFSRequest + const AttributeUserAuthInputDevice + const AttributeUserToCardAuthDevice + const AttributeVendorIFDSerialNo + const AttributeVendorIFDType + const AttributeVendorIFDVersion + const AttributeVendorName + type Card struct — darwin/amd64, linux/amd64, windows/amd64 + func Open(reader string, opts ...OpenOption) (*Card, error) + func (card *Card) BeginTransaction(ctx context.Context) error + func (card *Card) Close() error + func (card *Card) Control(ctx context.Context, controlCode uint32, input []byte, responseSize int) ([]byte, error) + func (card *Card) EndTransaction(disposition Disposition) error + func (card *Card) GetAttribute(attribute Attribute) ([]byte, error) + func (card *Card) Interface() CardInterface + func (card *Card) Reconnect(ctx context.Context, shareMode ShareMode, preferredProtocols Protocol, ...) (Protocol, error) + func (card *Card) SetAttribute(attribute Attribute, value []byte) error + func (card *Card) Status() (*CardStatus, error) + func (card *Card) Transmit(ctx context.Context, apdu []byte) ([]byte, error) + type CardInterface string + const CardInterfaceContact + const CardInterfaceContactless + const CardInterfaceUnknown + type CardState uint32 + const CardStateAbsent + const CardStateNegotiable + const CardStatePowered + const CardStatePresent + const CardStateSpecific + const CardStateSwallowed + const CardStateUnknown + type CardStatus struct + ATR []byte + Protocol Protocol + ReaderNames []string + State CardState + type DeviceEvent struct + ReaderInfo *ReaderInfo + Type DeviceEventType + type DeviceEventType string + const DeviceEventCardInserted + const DeviceEventCardRemoved + const DeviceEventReaderConnected + const DeviceEventReaderDisconnected + type Disposition uint32 + const DispositionEjectCard + const DispositionLeaveCard + const DispositionResetCard + const DispositionUnpowerCard + type Error struct + Code uint32 + Operation string + func (e *Error) Error() string + func (e *Error) Is(target error) bool + type OpenOption func(*openOptions) + func WithDisconnectDisposition(disposition Disposition) OpenOption + func WithPreferredProtocols(protocols Protocol) OpenOption + func WithShareMode(mode ShareMode) OpenOption + type Protocol uint32 + const ProtocolAny + const ProtocolDefault + const ProtocolOptimal + const ProtocolRaw + const ProtocolT0 + const ProtocolT1 + const ProtocolT15 + const ProtocolTx + const ProtocolUndefined + type ReaderInfo struct + ATR []byte + Name string + State ReaderState + type ReaderState uint32 + const ReaderStateATRMatch + const ReaderStateChanged + const ReaderStateEmpty + const ReaderStateExclusive + const ReaderStateIgnore + const ReaderStateInUse + const ReaderStateMute + const ReaderStatePresent + const ReaderStateUnavailable + const ReaderStateUnaware + const ReaderStateUnknown + const ReaderStateUnpowered + type ShareMode uint32 + const ShareModeDirect + const ShareModeExclusive + const ShareModeShared + type Snapshot struct + Readers []*ReaderInfo + type Watcher interface + Close func() error + Listen func() <-chan DeviceEvent + Snapshot func() Snapshot + func Watch() (Watcher, error)