Documentation ¶
Index ¶
- Constants
- func BitToIndex(b bool) int
- func CheckCommitment(commitment []byte, profile *proto.EncodedProfile) bool
- func CheckQuorum(want *proto.QuorumExpr, have map[uint64]struct{}) bool
- func GetRealmByDomain(cfg *proto.Config, domain string) (ret *proto.RealmConfig, err error)
- func GetRealmByUser(cfg *proto.Config, user string) (*proto.RealmConfig, error)
- func HashEmptyBranch(treeNonce []byte, prefixBits []bool) []byte
- func HashInternalNode(prefixBits []bool, childHashes *[2][HashBytes]byte) []byte
- func HashLeaf(treeNonce []byte, indexBytes []byte, depth int, value []byte) []byte
- func ListQuorum(e *proto.QuorumExpr, out map[uint64]struct{}) map[uint64]struct{}
- func RecomputeHash(treeNonce []byte, node MerkleNode) ([]byte, error)
- func ToBits(num int, bs []byte) []bool
- func ToBytes(bits []bool) []byte
- func TreeLookup(root MerkleNode, indexBytes []byte) (value []byte, err error)
- func VerifyConsensus(rcg *proto.RealmConfig, ratifications []*proto.SignedEpochHead, now time.Time) (root []byte, err error)
- func VerifyLookup(cfg *proto.Config, user string, pf *proto.LookupProof, now time.Time) (keys map[string][]byte, err error)
- func VerifyPolicy(policy *proto.AuthorizationPolicy, action []byte, evidence map[uint64][]byte) bool
- func VerifySignature(pk *proto.PublicKey, message []byte, sig []byte) bool
- func VerifyUpdate(current *proto.Entry, update *proto.SignedEntryUpdate) error
- type MerkleNode
- type ReconstructedNode
- func (n *ReconstructedNode) Child(rightChild bool) (MerkleNode, error)
- func (n *ReconstructedNode) ChildHash(rightChild bool) []byte
- func (n *ReconstructedNode) Depth() int
- func (n *ReconstructedNode) Index() []byte
- func (n *ReconstructedNode) IsEmpty() bool
- func (n *ReconstructedNode) IsLeaf() bool
- func (n *ReconstructedNode) Value() []byte
Constants ¶
const ( HashBytes = 32 IndexBytes = 32 IndexBits = IndexBytes * 8 )
const ( InternalNodeIdentifier = 'I' LeafIdentifier = 'L' EmptyBranchIdentifier = 'E' )
Variables ¶
This section is empty.
Functions ¶
func BitToIndex ¶
func CheckCommitment ¶
func CheckCommitment(commitment []byte, profile *proto.EncodedProfile) bool
func CheckQuorum ¶
func CheckQuorum(want *proto.QuorumExpr, have map[uint64]struct{}) bool
CheckQuorum evaluates whether the quorum requirement want can be satisfied by ratifications of the verifiers in have. want, have : &const // none of the inputs are modified
func GetRealmByDomain ¶
func GetRealmByUser ¶
func HashEmptyBranch ¶
This is the same as in the CONIKS paper. H(k_empty || nonce || prefix || depth)
func HashInternalNode ¶
Differences from the CONIKS paper:
- Add an identifier byte at the beginning to make it impossible for this to collide with leaves or empty branches.
- Add the prefix of the index, to protect against limited hash collisions or bugs.
This gives H(k_internal || h_child0 || h_child1 || prefix || depth)
func HashLeaf ¶
This is the same as in the CONIKS paper: H(k_leaf || nonce || index || depth || value)
func ListQuorum ¶
func ListQuorum(e *proto.QuorumExpr, out map[uint64]struct{}) map[uint64]struct{}
ListQuorum inserts all verifiers mentioned in e to out. If out is nil, a new map is allocated. ListQuorum is NOT intended to be used for implementing quorum verification, use CheckQuorum instead. e : &const out : *mut map mut // both the map and its contents can be modified arbitrarily
func RecomputeHash ¶
func RecomputeHash(treeNonce []byte, node MerkleNode) ([]byte, error)
func TreeLookup ¶
func TreeLookup(root MerkleNode, indexBytes []byte) (value []byte, err error)
TreeLookup looks up the entry at a particular index in the snapshot.
func VerifyConsensus ¶
func VerifyConsensus(rcg *proto.RealmConfig, ratifications []*proto.SignedEpochHead, now time.Time) (root []byte, err error)
func VerifyLookup ¶
func VerifyPolicy ¶
func VerifyPolicy(policy *proto.AuthorizationPolicy, action []byte, evidence map[uint64][]byte) bool
VerifyPolicy returns whether, by policy, action is justified by evidence. Evidence is in the form of digital signatures denoting agreement, and the policy contains public keys and a quorum rule. policy, action, evidence : &const // none of the inputs are modified NOTE: This does not work for verifier signatures on epoch heads because the signed contents will differ in their timestamps.
func VerifySignature ¶
VerifySignature returns true iff sig is a valid signature of message by verifier. pk, message, sig : &const // none of the inputs are modified
func VerifyUpdate ¶
func VerifyUpdate(current *proto.Entry, update *proto.SignedEntryUpdate) error
VerifyUpdate returns nil iff replacing entry current (nil if none) with next is justified given the evidence in update. Globally deterministic. current, update : &const // none of the inputs are modified
Types ¶
type MerkleNode ¶
type ReconstructedNode ¶
type ReconstructedNode struct {
// contains filtered or unexported fields
}
func ReconstructTree ¶
func ReconstructTree(trace *proto.TreeProof, lookupIndexBits []bool) (*ReconstructedNode, error)
func (*ReconstructedNode) Child ¶
func (n *ReconstructedNode) Child(rightChild bool) (MerkleNode, error)
func (*ReconstructedNode) ChildHash ¶
func (n *ReconstructedNode) ChildHash(rightChild bool) []byte
func (*ReconstructedNode) Depth ¶
func (n *ReconstructedNode) Depth() int
func (*ReconstructedNode) Index ¶
func (n *ReconstructedNode) Index() []byte
func (*ReconstructedNode) IsEmpty ¶
func (n *ReconstructedNode) IsEmpty() bool
func (*ReconstructedNode) IsLeaf ¶
func (n *ReconstructedNode) IsLeaf() bool
func (*ReconstructedNode) Value ¶
func (n *ReconstructedNode) Value() []byte
Directories ¶
Path | Synopsis |
---|---|
Package ed25519 implements the Ed25519 signature algorithm.
|
Package ed25519 implements the Ed25519 signature algorithm. |
edwards25519
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519.
|
Package edwards25519 implements operations in GF(2**255-19) and on an Edwards curve that is isomorphic to curve25519. |
kv
Package kv contains a generic interface for key-value databases with support for batch writes.
|
Package kv contains a generic interface for key-value databases with support for batch writes. |
kv/leveldbkv
Package leveldbkv implements the kv interface using leveldb
|
Package leveldbkv implements the kv interface using leveldb |
kv/tracekv
Package tracekv implements a tracing wrapper for kv.DB
|
Package tracekv implements a tracing wrapper for kv.DB |
replication/raftlog/proto
Package proto is a generated protocol buffer package.
|
Package proto is a generated protocol buffer package. |
Package proto is a generated protocol buffer package.
|
Package proto is a generated protocol buffer package. |
Package vrf implements a verifiable random function using the Edwards form of Curve25519, SHA3 and the Elligator map.
|
Package vrf implements a verifiable random function using the Edwards form of Curve25519, SHA3 and the Elligator map. |