Documentation
¶
Index ¶
- Variables
- func Escapable[T any](ctx context.Context, fn func(context.Context) (T, error)) (_ T, err error)
- func LogHex(key string, value []byte) slog.Attr
- func Must[T any](val T, err error) T
- type APDUer
- type APDUerFunc
- type Exchanger
- type ExchangerAPDUer
- type ExchangerFunc
- type RawSmartCard
- type RawSmartCardControl
- type SmartCardControl
- type SmartCardControlFunc
Constants ¶
This section is empty.
Variables ¶
var DeferWrap = func(ctx context.Context, err *error) {}
DeferWrap is called by library functions when returning errors to enrich them with stack trace information. By default, this is a no-op but exists so consumers of the library can BYO their own library If context is not available in a given function context.Background() will be used
Functions ¶
func Escapable ¶ added in v0.0.2
Escapable runs the given func in a goroutine and waits for the response. This is useful to convert non-context aware blocking functions to be context aware with the caveat that cancellation will not abort the non-context aware function but does enabling returning early. If the context is cancelled it returns immediately with the context.Cause abandoning the goroutine If the context is already cancelled it returns immediately without invoking the func.
Types ¶
type APDUer ¶ added in v0.0.2
APDUer is a higher level version of Exchanger that operates on parsed ISO7816 APDUs instead of raw byte slices
type APDUerFunc ¶ added in v0.0.2
APDUerFunc implements the ExchangerAPDUer interface as an APDUer.APDU func
type Exchanger ¶ added in v0.0.2
Exchanger is a higher level version of RawSmartCard that takes a context for cancellation
type ExchangerAPDUer ¶ added in v0.0.2
ExchangerAPDUer is a composite interface of Exchanger and APDUer
func RawSmartCardAPDUer ¶ added in v0.0.2
func RawSmartCardAPDUer(sc RawSmartCard) ExchangerAPDUer
RawSmartCardAPDUer transforms RawSmartCard into an ExchangerAPDUer with the ability to abandon waiting for a response if the context is cancelled
func RawSmartCardControlAPDUer ¶ added in v0.0.2
func RawSmartCardControlAPDUer(sc RawSmartCardControl, ioctl uint32) ExchangerAPDUer
RawSmartCardControlAPDUer transforms RawSmartCard into an ExchangerAPDUer by performing escape functions with the given ioctl. It also provides the ability to abandon waiting for a response if the context is cancelled
func SmartCardControlAPDUer ¶ added in v0.0.2
func SmartCardControlAPDUer(sc SmartCardControl, code uint16) ExchangerAPDUer
SmartCardControlAPDUer transforms SmartCardControl into an ExchangerAPDUer by performing control functions with the given code.
type ExchangerFunc ¶ added in v0.0.2
ExchangerFunc implements the ExchangerAPDUer interface as an Exchanger.Exchange func
type RawSmartCard ¶ added in v0.0.2
RawSmartCard is an interface that is implemented by *github.com/ebfe/go-scard.Card
type RawSmartCardControl ¶ added in v0.0.2
RawSmartCardControl is an interface that is implemented by *github.com/ebfe/go-scard.Card
type SmartCardControl ¶ added in v0.0.2
type SmartCardControl interface {
Control(ctx context.Context, code uint16, data []byte) ([]byte, error)
}
SmartCardControl is a higher level version of RawSmartCardControl that takes control codes instead of ioctls for platform portability and accepts a context for cancellation
func RawSmartCardControlToSmartCardControl ¶ added in v0.0.2
func RawSmartCardControlToSmartCardControl(sc RawSmartCardControl, controlCodeToIoctl func(code uint16) uint32) SmartCardControl
RawSmartCardControlToSmartCardControl transforms RawSmartCardControl into an SmartCardControl with the ability to abandon waiting for a response if the context is cancelled
type SmartCardControlFunc ¶ added in v0.0.2
SmartCardControlFunc implements the SmartCardControl interface as an SmartCardControl.Control func