ed25519

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const PrivateKeySize = 32
View Source
const PublicKeySize = 32
View Source
const SignatureSize = 64

Variables

This section is empty.

Functions

This section is empty.

Types

type PrivateKey

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

func PrivateKeyFromBytes

func PrivateKeyFromBytes(data []byte) (*PrivateKey, error)

PrivateKeyFromBytes constructs a ED25519 private key from the raw bytes.

func PrivateKeyFromString

func PrivateKeyFromString(text string) (*PrivateKey, error)

PrivateKeyFromString decodes the input string and returns the PrivateKey if the string is a valid bech32m encoding of a Ed25519 public key.

func (*PrivateKey) Bytes

func (prv *PrivateKey) Bytes() []byte

Bytes return the raw bytes of the private key.

func (*PrivateKey) EqualsTo

func (prv *PrivateKey) EqualsTo(x crypto.PrivateKey) bool

func (*PrivateKey) PublicKey

func (prv *PrivateKey) PublicKey() crypto.PublicKey

func (*PrivateKey) PublicKeyNative

func (prv *PrivateKey) PublicKeyNative() *PublicKey

func (*PrivateKey) Sign

func (prv *PrivateKey) Sign(msg []byte) crypto.Signature

Sign calculates the signature from the private key and given message. It's defined in section 2.6 of the spec: CoreSign.

func (*PrivateKey) SignNative

func (prv *PrivateKey) SignNative(msg []byte) *Signature

func (*PrivateKey) String

func (prv *PrivateKey) String() string

String returns a human-readable string for the ED25519 private key.

type PublicKey

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

func PublicKeyFromBytes

func PublicKeyFromBytes(data []byte) (*PublicKey, error)

PublicKeyFromBytes constructs a Ed25519 public key from the raw bytes.

func PublicKeyFromString

func PublicKeyFromString(text string) (*PublicKey, error)

PublicKeyFromString decodes the input string and returns the PublicKey if the string is a valid bech32m encoding of a Ed25519 public key.

func (*PublicKey) AccountAddress

func (pub *PublicKey) AccountAddress() crypto.Address

AccountAddress returns the account address derived from the public key.

func (*PublicKey) Bytes

func (pub *PublicKey) Bytes() []byte

Bytes returns the raw byte representation of the public key.

func (*PublicKey) Decode

func (pub *PublicKey) Decode(r io.Reader) error

Decode reads the raw bytes of the public key from the provided reader and initializes the public key.

func (*PublicKey) Encode

func (pub *PublicKey) Encode(w io.Writer) error

Encode writes the raw bytes of the public key to the provided writer.

func (*PublicKey) EqualsTo

func (pub *PublicKey) EqualsTo(x crypto.PublicKey) bool

EqualsTo checks if the current public key is equal to another public key.

func (*PublicKey) MarshalCBOR

func (pub *PublicKey) MarshalCBOR() ([]byte, error)

MarshalCBOR encodes the public key into CBOR format.

func (*PublicKey) SerializeSize added in v1.6.0

func (*PublicKey) SerializeSize() int

func (*PublicKey) String

func (pub *PublicKey) String() string

String returns a human-readable string for the Ed25519 public key.

func (*PublicKey) UnmarshalCBOR

func (pub *PublicKey) UnmarshalCBOR(bs []byte) error

UnmarshalCBOR decodes the public key from CBOR format.

func (*PublicKey) Verify

func (pub *PublicKey) Verify(msg []byte, sig crypto.Signature) error

Verify checks that a signature is valid for the given message and public key. It's defined in section 2.6 of the spec: CoreVerify.

func (*PublicKey) VerifyAddress

func (pub *PublicKey) VerifyAddress(addr crypto.Address) error

VerifyAddress checks if the provided address matches the derived address from the public key.

type Signature

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

func SignatureFromBytes

func SignatureFromBytes(data []byte) (*Signature, error)

SignatureFromBytes constructs a Ed25519 signature from the raw bytes.

func SignatureFromString

func SignatureFromString(text string) (*Signature, error)

SignatureFromString decodes the input string and returns the Signature if the string is a valid hexadecimal encoding of a Ed25519 signature.

func (*Signature) Bytes

func (sig *Signature) Bytes() []byte

Bytes returns the raw byte representation of the signature.

func (*Signature) Decode

func (sig *Signature) Decode(r io.Reader) error

Decode reads the raw bytes of the signature from the provided reader and initializes the signature.

func (*Signature) Encode

func (sig *Signature) Encode(w io.Writer) error

Encode writes the raw bytes of the signature to the provided writer.

func (*Signature) EqualsTo

func (sig *Signature) EqualsTo(x crypto.Signature) bool

EqualsTo checks if the current signature is equal to another signature.

func (*Signature) MarshalCBOR

func (sig *Signature) MarshalCBOR() ([]byte, error)

MarshalCBOR encodes the signature into CBOR format.

func (*Signature) SerializeSize added in v1.6.0

func (*Signature) SerializeSize() int

func (*Signature) String

func (sig *Signature) String() string

String returns the hex-encoded string representation of the signature.

func (*Signature) UnmarshalCBOR

func (sig *Signature) UnmarshalCBOR(bs []byte) error

UnmarshalCBOR decodes the signature from CBOR format.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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