ed25519

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadPrivateKeySize         = fmt.Errorf("bad ed25519 private key size")
	ErrBadPrivateKeyBase64Format = fmt.Errorf("bad ed25519 private key base64 format")
)
View Source
var (
	ErrBadPublicKeySize         = fmt.Errorf("bad ed25519 public key size")
	ErrBadPublicKeyBase64Format = fmt.Errorf("bad ed25519 public key base64 format")
)
View Source
var (
	ErrBadSignatureSize = fmt.Errorf("bad ed25519 signature size")
)

Functions

This section is empty.

Types

type PrivateKey

type PrivateKey [ed25519.PrivateKeySize]byte

PrivateKey is an ed25519 private key wrapper (64 bytes).

func NewPrivateKey

func NewPrivateKey(privateKeyBytes []byte) PrivateKey

PrivateKey constructor.

func (PrivateKey) GetPublicKey

func (pk PrivateKey) GetPublicKey() PublicKey

GetPublicKey returns the underlying ed25519 public key.

func (PrivateKey) Sign

func (pk PrivateKey) Sign(message []byte) Signature

Sign accepts a message and returns its corresponding ed25519 signature.

func (PrivateKey) String

func (pk PrivateKey) String() string

String returns the base64 representation.

type PublicKey

type PublicKey [ed25519.PublicKeySize]byte

PublicKey is an ed25519 public key wrapper (32 bytes).

func NewPublicKey

func NewPublicKey(publicKeyBytes []byte) PublicKey

PublicKey constructor.

func (PublicKey) MarshalJSON

func (pk PublicKey) MarshalJSON() ([]byte, error)

MarshalJSON encodes the base64 value of an ed25519 public key.

func (PublicKey) String

func (pk PublicKey) String() string

String returns the base64 representation.

func (*PublicKey) UnmarshalJSON

func (pk *PublicKey) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts a base64 value to load an ed25519 public key.

func (PublicKey) Verify

func (pk PublicKey) Verify(message []byte, signature Signature) bool

Verify indicates if a message and a signature match.

type Signature

type Signature [ed25519.SignatureSize]byte

Signature is an ed25519 signature wrapper (64 bytes).

func (Signature) MarshalJSON

func (s Signature) MarshalJSON() ([]byte, error)

MarshalJSON encodes the base64 value of an ed25519 signature.

func (Signature) String

func (s Signature) String() string

String returns the base64 representation.

func (*Signature) UnmarshalJSON

func (s *Signature) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts a base64 value to load an ed25519 signature.

Jump to

Keyboard shortcuts

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