Versions in this module Expand all Collapse all v0 v0.6.5 Dec 1, 2020 Changes in this version + const EcdsaSignatureLen + const PrivKeyBytesLen + var ErrCurveTypeNotSupported = errors.New("not a supported CurveType") + var ErrKeyGenEdwards25519Failed = errors.New("keygen: error generating key pair for edwards25519 curve type") + var ErrKeyGenSecp256k1Failed = errors.New("keygen: error generating key pair for secp256k1 curve type") + var ErrPrivKeyLengthInvalid = errors.New("invalid privkey length") + var ErrPrivKeyUndecodable = errors.New("could not decode privkey") + var ErrPrivKeyZero = errors.New("privkey cannot be 0") + var ErrSignFailed = errors.New("sign: unable to sign") + var ErrSignUnsupportedPayloadSignatureType = errors.New("sign: unexpected payload.SignatureType while signing") + var ErrSignUnsupportedSignatureType = errors.New("sign: unexpected Signature type while signing") + var ErrVerifyFailed = errors.New("verify: verify returned false") + var ErrVerifyUnsupportedPayloadSignatureType = errors.New("verify: unexpected payload.SignatureType while verifying") + var ErrVerifyUnsupportedSignatureType = errors.New("verify: unexpected Signature type while verifying") + func Err(err error) bool + type KeyPair struct + PrivateKey []byte + PublicKey *types.PublicKey + func GenerateKeypair(curve types.CurveType) (*KeyPair, error) + func ImportPrivateKey(privKeyHex string, curve types.CurveType) (*KeyPair, error) + func (k *KeyPair) IsValid() error + func (k *KeyPair) MarshalJSON() ([]byte, error) + func (k *KeyPair) Signer() (Signer, error) + func (k *KeyPair) UnmarshalJSON(b []byte) error + type Signer interface + PublicKey func() *types.PublicKey + Sign func(payload *types.SigningPayload, sigType types.SignatureType) (*types.Signature, error) + Verify func(signature *types.Signature) error + type SignerEdwards25519 struct + KeyPair *KeyPair + func (s *SignerEdwards25519) PublicKey() *types.PublicKey + func (s *SignerEdwards25519) Sign(payload *types.SigningPayload, sigType types.SignatureType) (*types.Signature, error) + func (s *SignerEdwards25519) Verify(signature *types.Signature) error + type SignerSecp256k1 struct + KeyPair *KeyPair + func (s *SignerSecp256k1) PublicKey() *types.PublicKey + func (s *SignerSecp256k1) Sign(payload *types.SigningPayload, sigType types.SignatureType) (*types.Signature, error) + func (s *SignerSecp256k1) Verify(signature *types.Signature) error