keys

package
v0.0.0-...-0e482a4 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAccount

func CheckAccount(signedMsg types.SignedMessage, chainId types.ChainId, accountResource *types.AccountResource) (bool, error)

CheckAccount check account of signed message

func CheckSignature

func CheckSignature(signedMsg types.SignedMessage) (bool, error)

func Ed25519Sign

func Ed25519Sign(privateKey ed25519.PrivateKey, data []byte) []byte

func SignMessage

func SignMessage(privateKey Ed25519PrivateKey, message string) (string, error)

Types

type Ed25519PrivateKey

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

Ed25519PrivateKey implements `PrivateKey` interface for ed25519 private key

func NewEd25519PrivateKey

func NewEd25519PrivateKey(key ed25519.PrivateKey) *Ed25519PrivateKey

NewEd25519PrivateKey creates `Ed25519PrivateKey`

func NewEd25519PrivateKeyFromString

func NewEd25519PrivateKeyFromString(key string) (*Ed25519PrivateKey, error)

NewEd25519PrivateKeyFromString creates `*Ed25519PrivateKey` from given hex-encoded `ed25519.PrivateKey` string

func (*Ed25519PrivateKey) Hex

func (k *Ed25519PrivateKey) Hex() string

Hex returns hex string of private key, used for testing

func (*Ed25519PrivateKey) Sign

func (k *Ed25519PrivateKey) Sign(msg []byte) []byte

Sign signs given message bytes by private key

type Ed25519PublicKey

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

Ed25519PublicKey implements `PublicKey` interface for ed25519 public key

func NewEd25519PublicKey

func NewEd25519PublicKey(key ed25519.PublicKey) *Ed25519PublicKey

NewEd25519PublicKey creates `Ed25519PublicKey`

func NewEd25519PublicKeyFromString

func NewEd25519PublicKeyFromString(key string) (*Ed25519PublicKey, error)

NewEd25519PublicKeyFromString creates `*Ed25519PublicKey` from given hex-encoded `ed25519.PublicKey` string

func (*Ed25519PublicKey) Bytes

func (k *Ed25519PublicKey) Bytes() []byte

Bytes returns public key bytes

func (*Ed25519PublicKey) Hex

func (k *Ed25519PublicKey) Hex() string

Hex returns hex string of the public key

func (*Ed25519PublicKey) IsMulti

func (k *Ed25519PublicKey) IsMulti() bool

IsMulti returns false

func (*Ed25519PublicKey) Verify

func (k *Ed25519PublicKey) Verify(msg []byte, sign []byte) bool

Verify sign is a valid signature

Jump to

Keyboard shortcuts

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