stellarkey

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

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

Key represents a Stellar (Soroban) key.

Stellar accounts use ed25519 (same primitive as Solana/Aptos), but the account identifier is a StrKey-encoded "G..." address: base32 of (versionByte || ed25519-pubkey || crc16). Using the canonical StrKey encoding is load-bearing: the Stellar relayer/TXM looks signing keys up by that exact "G..." address (loop.Keystore.Sign(account, data)), so ID() must match it byte-for-byte.

func FromEncryptedJSON

func FromEncryptedJSON(keyJSON []byte, password string) (Key, error)

FromEncryptedJSON gets key from json and password

func KeyFor

func KeyFor(raw internal.Raw) Key

func MustNewInsecure

func MustNewInsecure(reader io.Reader) Key

MustNewInsecure returns a Key if no error

func New

func New() (Key, error)

New creates a new Key

func (Key) Account

func (key Key) Account() string

Account returns the StrKey-encoded ("G...") Stellar account address.

func (Key) GetPublic

func (key Key) GetPublic() ed25519.PublicKey

GetPublic gets the Key's ed25519 public key

func (Key) ID

func (key Key) ID() string

ID gets the Key ID, which is the StrKey "G..." account address.

func (Key) PublicKeyStr

func (key Key) PublicKeyStr() string

PublicKeyStr returns the StrKey "G..." account address (canonical string form).

func (Key) Raw

func (key Key) Raw() internal.Raw

Raw returns the seed of the private key

func (Key) Sign

func (key Key) Sign(msg []byte) ([]byte, error)

Sign signs a message with the ed25519 private key. For Stellar the caller passes the transaction hash; the returned 64-byte signature is wrapped into an xdr.DecoratedSignature by the relayer/TXM.

func (Key) ToEncryptedJSON

func (key Key) ToEncryptedJSON(password string, scryptParams commonkeystore.ScryptParams) (export []byte, err error)

ToEncryptedJSON returns encrypted JSON representing key

Jump to

Keyboard shortcuts

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