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) stringAddress 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) boolVerify 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() PublicKeyfunc (p PrivateKey) Save(filename string) errorfunc (p PrivateKey) ToHex() stringPublicKey
func ParseAddress(hrp, saddr string) (PublicKey, error)Signature
func Sign(msg []byte, pk PrivateKey) Signature