diff options
Diffstat (limited to 'internal/mocks')
-rw-r--r-- | internal/mocks/signer/signer.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/mocks/signer/signer.go b/internal/mocks/signer/signer.go new file mode 100644 index 0000000..a4ec30d --- /dev/null +++ b/internal/mocks/signer/signer.go @@ -0,0 +1,22 @@ +package signer + +import ( + "crypto" + "crypto/ed25519" + "io" +) + +// Signer implements crypto.Signer with fixed outputs. Use for tests only. +type Signer struct { + PublicKey []byte + Signature []byte + Error error +} + +func (s *Signer) Public() crypto.PublicKey { + return ed25519.PublicKey(s.PublicKey[:]) +} + +func (s *Signer) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) { + return s.Signature[:], s.Error +} |