blob: 87c883aa79f189ef02ae7e2f71ccd5d038168eee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package mocks
import (
"crypto"
"crypto/ed25519"
"io"
)
// TestSign implements the signer interface. It can be used to mock an Ed25519
// signer that always return the same public key, signature, and error.
type TestSigner struct {
PublicKey *[ed25519.PublicKeySize]byte
Signature *[ed25519.SignatureSize]byte
Error error
}
func (ts *TestSigner) Public() crypto.PublicKey {
return ed25519.PublicKey(ts.PublicKey[:])
}
func (ts *TestSigner) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) {
return ts.Signature[:], ts.Error
}
|