From 97540f9ded30f68f9fda62f66f3006414cbfd5b7 Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sat, 21 May 2022 20:31:09 +0200 Subject: move mock signer to internal/ --- internal/mocks/signer/signer.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 internal/mocks/signer/signer.go (limited to 'internal/mocks/signer') 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 +} -- cgit v1.2.3