Documentation ¶
Overview ¶
Package state implements the state of a hashchain.
Index ¶
- type State
- func (s *State) AddLinkHash(linkHash [32]byte, lineNumber int)
- func (s *State) AddSigner(pubKey [32]byte, weight int, comment string)
- func (s *State) AddSourceHash(linkHash, treeHash, pubKey [32]byte, comment string)
- func (s *State) HasLinkHash(linkHash [32]byte) bool
- func (s *State) HasSigner(pubKey [32]byte) bool
- func (s *State) HeadN() int
- func (s *State) LastSignedTreeHash() (string, int)
- func (s *State) LastTreeHash() string
- func (s *State) LinkHash(treeHash string) [32]byte
- func (s *State) LinkHashes() int
- func (s *State) M() int
- func (s *State) N() int
- func (s *State) NotPublished(treeHash string) error
- func (s *State) NotSigner(pubKey [32]byte) error
- func (s *State) OPs() int
- func (s *State) RemoveSigner(pubKey [32]byte) error
- func (s *State) SetSignatureControl(m int)
- func (s *State) Sign(linkHash, pubKey [32]byte) error
- func (s *State) Signer() map[string]bool
- func (s *State) SignerBarrier(pubKey string) int
- func (s *State) SignerComment(pubKey string) string
- func (s *State) SignerWeight(pubKey string) int
- func (s *State) SourceLine(treeHash string) int
- func (s *State) TreeComments() []string
- func (s *State) TreeHashes() []string
- func (s *State) UnsignedInfo(pubKey, treeHash string, omitSource bool) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State hold the state of a hashchain.
func (*State) AddLinkHash ¶
AddLinkHash adds linkHash with lineNumber to state.
func (*State) AddSourceHash ¶
AddSourceHash adds treeHash at given linkHash to state.
func (*State) HasLinkHash ¶
HasLinkHash checks wether the state s contains the given linkHash.
func (*State) HasSigner ¶
HasSigner checks wether the state s contains a valid the signer with pubKey.
func (*State) HeadN ¶
HeadN returns the total weight of all signers, including unconfirmed key additions and removals.
func (*State) LastSignedTreeHash ¶
LastSignedTreeHash returns the last signed tree hash.
func (*State) LastTreeHash ¶
LastTreeHash returns the most current tree hash.
func (*State) LinkHashes ¶
LinkHashes returns the number of link hashes contained in state.
func (*State) NotPublished ¶
NotPublished makes sure that the given treeHash has not been published before (unconfirmed or confirmed).
func (*State) NotSigner ¶
NotSigner makes sure the given pubKey is not a signer (unconfirmed or confirmed).
func (*State) RemoveSigner ¶
RemoveSigner removes pubKey with weight (must equal last addition) from state (unconfirmed).
func (*State) SetSignatureControl ¶
SetSignatureControl sets new signature control m (unconfirmed).
func (*State) SignerBarrier ¶
SignerBarrier returns the signer barrier for pubKey.
func (*State) SignerComment ¶
SignerComment returns the signer comment for given pubKey.
func (*State) SignerWeight ¶
SignerWeight returns the signer weight for given pubKey.
func (*State) SourceLine ¶
SourceLine returns the line number where the given tree hash was signed.
func (*State) TreeComments ¶
TreeComments returns a list of all tree comments in order (starting from tree.EmptyHash).
func (*State) TreeHashes ¶
TreeHashes returns a list of all tree hashes in order (starting from tree.EmptyHash).
func (*State) UnsignedInfo ¶
UnsignedInfo returns a string slice with information about all unsigned entries suitable for printing. If TreeHash is defined it returns info until that treeHash. If omitSource is true source lines are omitted