crypto

package
v0.72.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ed25519 string = "vega/ed25519"
)

Variables

View Source
var (
	// ErrBadED25519PrivateKeyLength is returned if a private key with incorrect length is supplied.
	ErrBadED25519PrivateKeyLength = errors.New("bad ed25519 private key length")

	// ErrBadED25519PublicKeyLength is returned if a public key with incorrect length is supplied.
	ErrBadED25519PublicKeyLength = errors.New("bad ed25519 public key length")

	ErrCouldNotCastPrivateKeyToBytes = errors.New("couldn't cast private key to bytes")
	ErrCouldNotCastPublicKeyToBytes  = errors.New("couldn't cast public key to bytes")

	ErrSignatureIsNil = errors.New("signature is nil")
)
View Source
var ErrUnsupportedSignatureAlgorithm = errors.New("unsupported signature algorithm")

Functions

func VerifyMessage

func VerifyMessage(req *VerifyMessageRequest) (bool, error)

Types

type SignatureAlgorithm

type SignatureAlgorithm struct {
	// contains filtered or unexported fields
}

func NewEd25519

func NewEd25519() SignatureAlgorithm

func NewSignatureAlgorithm

func NewSignatureAlgorithm(name string, version uint32) (SignatureAlgorithm, error)

func (*SignatureAlgorithm) MarshalJSON

func (a *SignatureAlgorithm) MarshalJSON() ([]byte, error)

func (*SignatureAlgorithm) Name

func (a *SignatureAlgorithm) Name() string

func (*SignatureAlgorithm) Sign

func (a *SignatureAlgorithm) Sign(priv crypto.PrivateKey, buf []byte) ([]byte, error)

func (*SignatureAlgorithm) UnmarshalJSON

func (a *SignatureAlgorithm) UnmarshalJSON(data []byte) error

func (*SignatureAlgorithm) Verify

func (a *SignatureAlgorithm) Verify(pub crypto.PublicKey, message, sig []byte) (bool, error)

func (*SignatureAlgorithm) Version

func (a *SignatureAlgorithm) Version() uint32

type VerifyMessageRequest

type VerifyMessageRequest struct {
	Message   []byte
	Signature []byte
	PubKey    string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL