storage

package
v0.0.0-...-b8b5d6a Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocalstateFileName = "localstate-%s.json"
	PoolPkAddrFileName = "poolPk.addr"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStateMgr

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

FileStateMgr save the local state to file

func NewFileStateMgr

func NewFileStateMgr(folder string) (*FileStateMgr, error)

NewFileStateMgr create a new instance of the FileStateMgr which implements LocalStateManager

func (*FileStateMgr) GetLocalState

func (fsm *FileStateMgr) GetLocalState(pubAddr string) (*KeygenLocalState, error)

GetLocalState read the local state from file system

func (*FileStateMgr) SaveLocalState

func (fsm *FileStateMgr) SaveLocalState(state *KeygenLocalState) error

SaveLocalState save the local state to file

type KeygenLocalState

type KeygenLocalState struct {
	// TSS pool pubkey raw byte
	PubKeyData []byte `json:"pub_key_data"`
	// TSS pool pubkey addr
	PubKeyAddr string `json:"pub_key_addr"`
	// the library method returns information that needs to be stored at the end of the keyGen
	LocalData keygen.LocalPartySaveData `json:"local_data"`

	// partyID.id -> pubkey
	ParticipantPksMap map[string][]byte `json:"participant_pks_map"` // the paticipant of last key gen
	LocalPartyPk      []byte            `json:"local_party_pk"`
}

KeygenLocalState is a structure used to represent the data we saved locally for different keygen A TSS public key address stores a corresponding KeygenLocalState structure

type LocalStateManager

type LocalStateManager interface {
	SaveLocalState(state *KeygenLocalState) error
	GetLocalState(pubAddr string) (*KeygenLocalState, error)
}

LocalStateManager provide necessary methods to manage the local state, save it , and read it back LocalStateManager doesn't have any opinion in regards to where it should be persistent to

Jump to

Keyboard shortcuts

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