Lux SDKGoPackages

crypto

Package crypto provides functionality for interacting with Ed25519 public and private keys.

import "github.com/luxfi/sdk/crypto"

Package crypto provides functionality for interacting with Ed25519 public and private keys. Package crypto uses the "crypto/ed25519" package from Go's standard library for the underlying cryptography.

Functions

Address

func Address(hrp string, p PublicKey) string

Address returns a Bech32 address from hrp and p. This function uses node's FormatBech32 function. Returns empty string if formatting fails.

Verify

func Verify(msg []byte, p PublicKey, s Signature) bool

Verify returns whether s is a valid signature of msg by p.

Types

PrivateKey

func GeneratePrivateKey() (PrivateKey, error)
func HexToKey(key string) (PrivateKey, error)
func LoadKey(filename string) (PrivateKey, error)
func (p PrivateKey) PublicKey() PublicKey
func (p PrivateKey) Save(filename string) error
func (p PrivateKey) ToHex() string

PublicKey

func ParseAddress(hrp, saddr string) (PublicKey, error)

Signature

func Sign(msg []byte, pk PrivateKey) Signature