Documentation ¶
Index ¶
- func SignWithKeys(keys types.PrivateKeys, tx *types.SignedTransaction) error
- func VerifySignedTransaction(keyBag *KeyBag, tx *types.SignedTransaction) (bool, error)
- type KeyBag
- func (b *KeyBag) Add(wifKey string) error
- func (b KeyBag) EncryptMemo(memo *types.Memo, msg string) error
- func (b *KeyBag) ImportFromFile(path string) error
- func (p KeyBag) Marshal(enc *util.TypeEncoder) error
- func (b KeyBag) Present(pub *types.PublicKey) bool
- func (b KeyBag) Private(pub *types.PublicKey) *types.PrivateKey
- func (b KeyBag) Privates() (out types.PrivateKeys)
- func (b KeyBag) PrivatesByPublics(pubKeys types.PublicKeys) (out types.PrivateKeys)
- func (b KeyBag) Publics() (out types.PublicKeys)
- func (b *KeyBag) Remove(pub string) bool
- func (p *KeyBag) Unmarshal(dec *util.TypeDecoder) error
- type TransactionSigner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SignWithKeys ¶ added in v0.6.1
func SignWithKeys(keys types.PrivateKeys, tx *types.SignedTransaction) error
SignWithKeys signs a given transaction with given private keys.
func VerifySignedTransaction ¶ added in v0.6.1
func VerifySignedTransaction(keyBag *KeyBag, tx *types.SignedTransaction) (bool, error)
VerifySignedTransaction verifies a signed transaction against all available keys in keyBag. If all required keys are found the function returns true, otherwise false.
Types ¶
type KeyBag ¶
type KeyBag struct {
// contains filtered or unexported fields
}
KeyBag is a PrivateKey collection for signing and verifying purposes.
func (KeyBag) EncryptMemo ¶ added in v0.6.1
func (*KeyBag) ImportFromFile ¶
func (KeyBag) Present ¶ added in v0.6.1
Present checks if a private key associated with the given public key is present
func (KeyBag) Private ¶ added in v0.6.1
func (b KeyBag) Private(pub *types.PublicKey) *types.PrivateKey
Private returns the private key associated with the given public key
func (KeyBag) Privates ¶
func (b KeyBag) Privates() (out types.PrivateKeys)
Privates returns a collection of private keys in bag.
func (KeyBag) PrivatesByPublics ¶
func (b KeyBag) PrivatesByPublics(pubKeys types.PublicKeys) (out types.PrivateKeys)
func (KeyBag) Publics ¶
func (b KeyBag) Publics() (out types.PublicKeys)
Public returns a collection of public keys in bag.
type TransactionSigner ¶
type TransactionSigner struct {
*types.SignedTransaction
}
TransactionSigner can sign and verify a transaction.
func NewTransactionSigner ¶
func NewTransactionSigner(tx *types.SignedTransaction) *TransactionSigner
NewTransactionSigner creates an New TransactionSigner. Invalid expiration time will be adjusted.
func (*TransactionSigner) Sign ¶
func (tx *TransactionSigner) Sign(privKeys types.PrivateKeys, chain *config.ChainConfig) error
Sign signs the underlying transaction
func (*TransactionSigner) Verify ¶
func (tx *TransactionSigner) Verify(keyBag *KeyBag, chain *config.ChainConfig) (bool, error)
Verify verifies the underlying transaction against a given KeyBag