Documentation ¶
Index ¶
- Variables
- func ErrEqual(err1, err2 error) bool
- func IntEqual(int1, int2 *big.Int) bool
- func Key(name string, modified int64, low, high uint) *yubico.Yubikey
- func LogRecordsEqual(lr1, lr2 *LogRecords) bool
- func RSAEqual(key1, key2 *rsa.PrivateKey) bool
- func ReadAll(t *testing.T, r io.Reader) string
- func StrSliceEqual(slice1, slice2 []string) bool
- func TempFile(t *testing.T, cb func(*os.File) error) error
- func TempFileName(t *testing.T, cb func(string) error) error
- func TestError(err error) testError
- func TestRSA(key *rsa.PrivateKey) testRSA
- func TestToken(token *yubico.Token) testToken
- func TestYubikey(ykey *yubico.Yubikey) testYubikey
- func Token(low uint16, high uint8) *yubico.Token
- func TokenAll(name string, ctr, use, high, low uint) *yubico.Token
- func TokenEqual(token1, token2 *yubico.Token) bool
- func YubikeyEqual(ykey1, ykey2 *yubico.Yubikey) bool
- type DumbYubikeyMapper
- type FileCb
- type LogRecord
- type LogRecords
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoop is here to be used for testing only // Purpose is to be propagated up the stack and retrieved/compared later // for error propagation check ErrNoop = fmt.Errorf("noop") )
Functions ¶
func ErrEqual ¶
ErrEqual compare two errors, it is safe to use with nil values and will compare the string representation
func IntEqual ¶
IntEqual compare two big.Int, it is safe to use with nil values. Comparison is done against the string representation of the arguments.
func LogRecordsEqual ¶
func LogRecordsEqual(lr1, lr2 *LogRecords) bool
LogRecordsEqual compare two LogRecord arrays, it is safe to use with nil values. Comparison is done against the level and format (if arguments differs it will still return true).
func RSAEqual ¶
func RSAEqual(key1, key2 *rsa.PrivateKey) bool
RSAEqual compare two RSA private keys, it is safe to use with nil values. Comparison is done against the string representation of the internal big.Int.
func StrSliceEqual ¶
StrSliceEqual compare two slices of strings, it is safe to use with nil values.
func TempFile ¶
TempFile wraps the ioutil.TempFile, handling the lifecycle of the file and removing it when callback has been executed
func TempFileName ¶
TempFileName wraps the ioutil.TempFile, handling the lifecycle of the file and removing it when callback has been executed. It only pass the name and not the file descriptor.
func TestError ¶
func TestError(err error) testError
TestError creates an error for testing purpose out of a regular error interface
func TestRSA ¶
func TestRSA(key *rsa.PrivateKey) testRSA
TestRSA creates a rsa private key for testing purpose out of a rsa.PrivateKey pointer
func TestYubikey ¶
TestYubikey creates a yubikey for testing purpose out of a yubico.Yubikey
func TokenEqual ¶
TokenEqual compare two tokens, it is safe to use with nil values.
func YubikeyEqual ¶
YubikeyEqual compare two yubikeys, it is safe to use with nil values. It only compares the public name attribute (sufficient for tests)
Types ¶
type DumbYubikeyMapper ¶
type DumbYubikeyMapper struct { yubico.YubikeyLoader yubico.YubikeyProducer yubico.YubikeyUpdater }
DumbYubikeyMapper is an utility structure for test purpose. It allows to customize internal interface behavior at runtime.
func NewDumbYubikeyMapper ¶
func NewDumbYubikeyMapper() *DumbYubikeyMapper
NewDumbYubikeyMapper creates a DumbYubikeyMapper with sensible defaults implementations
func (DumbYubikeyMapper) YubikeyLoad ¶
func (dym DumbYubikeyMapper) YubikeyLoad(name string) (*yubico.Yubikey, error)
YubikeyLoad implement the load interface and return the internal implementation
func (DumbYubikeyMapper) YubikeyProduce ¶
func (dym DumbYubikeyMapper) YubikeyProduce( token *yubico.Token, nonce string, ) (*yubico.Yubikey, error)
YubikeyProduce implement the load interface and return the internal implementation
func (DumbYubikeyMapper) YubikeyUpdate ¶
func (dym DumbYubikeyMapper) YubikeyUpdate(yubikey *yubico.Yubikey) error
YubikeyUpdate implement the update interface and return the internal implementation
type FileCb ¶
FileCb is a type representing a callback using a file Most probably the wrapping service is responsible for handling the file descriptor lifecycle, the callback is here for user to manipulate the file.
type LogRecords ¶
type LogRecords []LogRecord
LogRecords is an array of LogRecord
func (*LogRecords) Log ¶
func (lg *LogRecords) Log(level int, format string, a ...interface{})
Log is a wrapper to save logs in a cache for later comparison nolint:goprintffuncname
func (*LogRecords) String ¶
func (lg *LogRecords) String() string
String is a dump of an array of LogRecord