diff --git a/merkletree/README.md b/merkletree/README.md index 759554f..027e5c6 100644 --- a/merkletree/README.md +++ b/merkletree/README.md @@ -10,8 +10,7 @@ Initiate the history hash chain (the persistent authenticated dictionary) signKey := crypto.GenerateKey() // init STR history chain with maximum length is len -// using DefaultPolicies as current policy -pad := NewPAD(NewPolicies(epochDeadline), signKey, len) +pad := NewPAD(NewPolicies(epochDeadline, vrfPrivKey), signKey, len) ``` Update tree in each epoch @@ -26,7 +25,7 @@ pad.Update(nil) Look-up -`LookUp(key)` and `LookUpInEpoch(key, epoch)` return a `MerkleNode` instance and an `AuthenticationPath` for proofs of inclusion/absence. +`LookUp(key)` and `LookUpInEpoch(key, epoch)` return an `AuthenticationPath` for proofs of inclusion/absence. A proof of absence also includes an empty leaf node in the returned auth path. ### TODO diff --git a/merkletree/policy.go b/merkletree/policy.go index 55fd44c..2f937d6 100644 --- a/merkletree/policy.go +++ b/merkletree/policy.go @@ -14,15 +14,15 @@ type Policies interface { vrfPrivate() *[vrf.SecretKeySize]byte } -type DefaultPolicies struct { +type ConiksPolicies struct { vrfPrivateKey *[vrf.SecretKeySize]byte epochDeadline TimeStamp } -var _ Policies = (*DefaultPolicies)(nil) +var _ Policies = (*ConiksPolicies)(nil) func NewPolicies(epDeadline TimeStamp, vrfPrivKey *[vrf.SecretKeySize]byte) Policies { - return &DefaultPolicies{ + return &ConiksPolicies{ epochDeadline: epDeadline, vrfPrivateKey: vrfPrivKey, } @@ -30,7 +30,7 @@ func NewPolicies(epDeadline TimeStamp, vrfPrivKey *[vrf.SecretKeySize]byte) Poli // Serialize encodes the policy to a byte array with the following format: // [lib version, cryptographic algorithm in use, epoch deadline] -func (p *DefaultPolicies) Serialize() []byte { +func (p *ConiksPolicies) Serialize() []byte { var bs []byte bs = append(bs, []byte(Version)...) // lib Version bs = append(bs, []byte(crypto.HashID)...) // cryptographic algorithms in use @@ -39,10 +39,10 @@ func (p *DefaultPolicies) Serialize() []byte { return bs } -func (p *DefaultPolicies) vrfPrivate() *[vrf.SecretKeySize]byte { +func (p *ConiksPolicies) vrfPrivate() *[vrf.SecretKeySize]byte { return p.vrfPrivateKey } -func (p *DefaultPolicies) EpochDeadline() TimeStamp { +func (p *ConiksPolicies) EpochDeadline() TimeStamp { return p.epochDeadline }