Documentation
¶
Overview ¶
Package signer defines a signing interface for TRON transactions and provides concrete implementations backed by private keys, keystores, and hardware wallets.
Index ¶
- type Signer
- func NewKeystorePassphraseSigner(ks *keystore.KeyStore, acct keystore.Account, passphrase string) Signer
- func NewKeystoreSigner(ks *keystore.KeyStore, acct keystore.Account) Signer
- func NewLedgerSigner() (Signer, error)
- func NewPrivateKeySigner(key *ecdsa.PrivateKey) (Signer, error)
- func NewPrivateKeySignerFromBTCEC(key *btcec.PrivateKey) (Signer, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Signer ¶
type Signer interface {
// Sign appends a signature to the transaction and returns it.
// Implementations must not modify the transaction's raw data.
Sign(tx *core.Transaction) (*core.Transaction, error)
// Address returns the TRON address of the signing key.
Address() address.Address
}
Signer signs TRON transactions and exposes the associated address.
func NewKeystorePassphraseSigner ¶
func NewKeystorePassphraseSigner(ks *keystore.KeyStore, acct keystore.Account, passphrase string) Signer
NewKeystorePassphraseSigner creates a Signer that decrypts the key on each Sign call using the provided passphrase. This is safer than keeping the key unlocked but slower.
func NewKeystoreSigner ¶
NewKeystoreSigner creates a Signer backed by a keystore account. The account must be unlocked (via ks.Unlock) before Sign is called.
func NewLedgerSigner ¶
NewLedgerSigner creates a Signer backed by a connected Ledger device. It immediately queries the device for its address.
func NewPrivateKeySigner ¶
func NewPrivateKeySigner(key *ecdsa.PrivateKey) (Signer, error)
NewPrivateKeySigner creates a Signer from an ECDSA private key. The key must be on the secp256k1 curve; other curves are rejected.
func NewPrivateKeySignerFromBTCEC ¶
func NewPrivateKeySignerFromBTCEC(key *btcec.PrivateKey) (Signer, error)
NewPrivateKeySignerFromBTCEC creates a Signer from a btcec private key.