filter

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOpen = errors.New("open card for detailed filtering")

ErrOpen is a sentinel error returned by a Filter indicating that the filter requires a connection to the card for checking its predicate. This is usually the case if the predicate needs to exchange APDUs with the card rather than simply checking the readers name

Functions

func IsNitrokey

func IsNitrokey(reader string, card *iso.Card) (bool, error)

IsNikrokey checks if the smart card is a Nitrokey based on the name of the smart card reader.

func IsNitrokey3

func IsNitrokey3(reader string, card *iso.Card) (bool, error)

IsNikrokey3 checks if the smart card is a Nitrokey 3 based on the name of the smart card reader.

func IsYubiKey

func IsYubiKey(reader string, card *iso.Card) (bool, error)

IsYubikey checks if the smart card is a YubiKey based on the name of the smart card reader.

Types

type Filter

type Filter func(reader string, card *iso.Card) (bool, error)

Filter is a predicate which evaluates whether a given reader/card matches a given condition.

var Any Filter = func(string, *iso.Card) (bool, error) {
	return true, nil
}

Any matches any card

var None Filter = func(string, *iso.Card) (bool, error) {
	return false, nil
}

None matches no card

func And

func And(fs ...Filter) Filter

And matches if all of the provided filters are matching.

func HasApplet

func HasApplet(aid []byte) Filter

HasApplet matches card which can select an applet with the given application identifier (AID).

func HasName

func HasName(nameExpected string) Filter

HasName compares the name of the smart card reader with the provided name.

func HasNameRegex

func HasNameRegex(regex string) Filter

HasName matches the name of the smart card reader against the provided regular expression.

func Not

func Not(f Filter) Filter

Not matches if the provided filters does not match.

func Or

func Or(fs ...Filter) Filter

Or matches if any of the provided filters are matching.

Jump to

Keyboard shortcuts

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