Documentation ¶
Index ¶
- type Algorithm
- func (a Algorithm) CheckSeckey(seckey []byte) error
- func (a Algorithm) GenSeckey() []byte
- func (a Algorithm) GetPubkey(seckey []byte) []byte
- func (a Algorithm) Sign(message []byte, seckey []byte) []byte
- func (a Algorithm) String() string
- func (a Algorithm) Verify(message []byte, pubkey []byte, sig []byte) (ret bool)
- type AlgorithmBackend
- type Signature
- func (s *Signature) Decode(b []byte) error
- func (s *Signature) Encode() ([]byte, error)
- func (s *Signature) Equal(sig *Signature) bool
- func (s *Signature) FromPb(sr *sigpb.Signature) *Signature
- func (s *Signature) Hash() []byte
- func (s *Signature) SetPubkey(pubkey []byte)
- func (s *Signature) ToBytes() []byte
- func (s *Signature) ToPb() *sigpb.Signature
- func (s *Signature) Verify(info []byte) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Algorithm ¶
type Algorithm uint8
Algorithm is the crypto algorithm of signature
const ( Secp256k1 Algorithm Ed25519 )
Algorithm list
func NewAlgorithm ¶ added in v1.1.0
NewAlgorithm returns a new algorithm by name
type AlgorithmBackend ¶
type AlgorithmBackend interface { Sign(message []byte, seckey []byte) []byte Verify(message []byte, pubkey []byte, sig []byte) bool GetPubkey(seckey []byte) []byte GenSeckey() []byte CheckSeckey(seckey []byte) error }
AlgorithmBackend is the interface of algorithm backend
type Signature ¶
Signature is the signature of some message
func NewSignature ¶
NewSignature returns new signature
Click to show internal directories.
Click to hide internal directories.