keystore

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoKeysAvailable = fmt.Errorf("no signing keys available")

Functions

This section is empty.

Types

type AccountKey

type AccountKey struct {
	flowsdk.AccountKey

	Address flowsdk.Address
	Signer  crypto.Signer
	// contains filtered or unexported fields
}

func NewAccountKey

func NewAccountKey(
	accountKey flowsdk.AccountKey,
	address flowsdk.Address,
	signer crypto.Signer,
) *AccountKey

func (*AccountKey) Done

func (k *AccountKey) Done()

Done releases a key after use.

func (*AccountKey) SetLockMetadata

func (k *AccountKey) SetLockMetadata(txID flowsdk.Identifier, referenceBlockHeight uint64)

SetLockMetadata sets the transaction ID and reference block height for the transaction the key was used for.

func (*AccountKey) SetProposerPayerAndSign

func (k *AccountKey) SetProposerPayerAndSign(
	tx *flowsdk.Transaction,
	address flowsdk.Address,
	acckey *flowsdk.AccountKey,
) error

SetProposerPayerAndSign sets the proposer, payer, and signs the transaction with the key.

type KeyLock

type KeyLock interface {
	// This method is intended for the happy path of valid EVM transactions.
	// The event subscriber module only subscribes to EVM-related events:
	// - `EVM.TransactionExecuted`
	// - `EVM.BlockExecuted`
	//
	// Valid EVM transactions do emit `EVM.TransactionExecuted` events, so we
	// release the account key that was used by the Flow tx which emitted
	// the above EVM event.
	NotifyTransaction(txID flowsdk.Identifier)
	// This method is intended for the unhappy path of invalid EVM transactions.
	// For each new Flow block, we check the result status of all included Flow
	// transactions, and we release the account keys which they used. This also
	// handles the release of expired transactions, that weren't even included
	// in a Flow block.
	NotifyBlock(blockHeader flowsdk.BlockHeader)
}

type KeyStore

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

func New

func New(
	ctx context.Context,
	keys []*AccountKey,
	client access.Client,
	config config.Config,
	logger zerolog.Logger,
) *KeyStore

func (*KeyStore) AvailableKeys

func (k *KeyStore) AvailableKeys() int

AvailableKeys returns the number of keys available for use.

func (*KeyStore) HasKeysInUse added in v1.3.0

func (k *KeyStore) HasKeysInUse() bool

HasKeysInUse returns whether any of the keys are currently being used.

func (*KeyStore) NotifyBlock

func (k *KeyStore) NotifyBlock(blockHeader flowsdk.BlockHeader)

NotifyBlock is called to notify the KeyStore of a newly ingested block. Pending transactions older than a threshold number of blocks are removed.

func (*KeyStore) NotifyTransaction

func (k *KeyStore) NotifyTransaction(txID flowsdk.Identifier)

NotifyTransaction unlocks a key after use and puts it back into the pool.

func (*KeyStore) Take

func (k *KeyStore) Take() (*AccountKey, error)

Take reserves a key for use in a transaction.

Jump to

Keyboard shortcuts

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