Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.0.48
type Config struct {
PushCore PushCoreClient
CheckInterval time.Duration
Logger zerolog.Logger
}
Config holds configuration for the keyshare sweeper.
type KeyshareStore ¶ added in v0.0.48
type KeyshareStore interface {
}
KeyshareStore is the subset of keyshare.Manager the sweeper depends on.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides methods for storing and retrieving encrypted keyshares from files.
func NewManager ¶
NewManager creates a new keyshare manager instance. homeDir: Base directory (e.g., $HOME/.puniversal) encryptionPassword: Password for encrypting/decrypting keyshares
func (*Manager) Delete ¶ added in v0.0.48
Delete removes a stored keyshare. It overwrites the file with random bytes before unlinking; on SSD/COW filesystems that is best-effort, so the real protection remains the at-rest encryption. Deleting a missing ID is a no-op.
func (*Manager) Get ¶
Get retrieves and decrypts a keyshare from a file. Returns the decrypted keyshare bytes.
type PushCoreClient ¶ added in v0.0.48
type PushCoreClient interface {
GetCurrentKey(ctx context.Context) (*utsstypes.TssKey, error)
GetKeyByID(ctx context.Context, keyID string) (*utsstypes.TssKey, error)
}
PushCoreClient is the subset of pushcore.Client the sweeper depends on. Defined as an interface so tests can inject a mock. *pushcore.Client satisfies it.
type Sweeper ¶ added in v0.0.48
type Sweeper struct {
// contains filtered or unexported fields
}
Sweeper deletes local keyshares that chain state proves are redundant.
A keyshare is deleted only when every one of these holds:
- it is not the current key ID;
- its TSS pubkey equals the current key's pubkey, i.e. a quorum change or key refresh superseded it while preserving the vault key.
Those two conditions are sufficient. The current key only changes when a key process finalizes, so while one is in flight the predecessor is still current and therefore never a deletion candidate. Fund migrations only exist across a pubkey rotation, so they can only reference a key this sweeper already keeps.
Shares whose pubkey differs from the current one are kept: they belong to a rotated-away key that fund migration still needs to sweep its vault. Retiring those is an explicit operator action, since a chain that was never migrated is indistinguishable from one with nothing to migrate.
Every chain-state lookup fails closed: on error the sweep is skipped and retried next tick rather than deleting on incomplete information. Pubkeys are resolved per held share rather than from the full key history, which grows unbounded and would need paging.
func NewSweeper ¶ added in v0.0.48
NewSweeper creates a new keyshare sweeper.