Documentation ¶
Index ¶
- Constants
- Variables
- type Builder
- type Cert
- type CompactOneTimeSignature
- func (_ *CompactOneTimeSignature) CanMarshalMsg(z interface{}) bool
- func (_ *CompactOneTimeSignature) CanUnmarshalMsg(z interface{}) bool
- func (z *CompactOneTimeSignature) MarshalMsg(b []byte) (o []byte)
- func (z *CompactOneTimeSignature) MsgIsZero() bool
- func (z *CompactOneTimeSignature) Msgsize() (s int)
- func (z *CompactOneTimeSignature) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Params
- type Reveal
- type SortUint64
- type Verifier
Constants ¶
const ( HashType = crypto.Sumhash HashSize = crypto.SumhashDigestSize )
HashType/ hashSize relate to the type of hash this package uses.
const (
// MaxReveals is a bound on allocation and on numReveals to limit log computation
MaxReveals = 1024
)
Variables ¶
var ErrIndexOutOfBound = errors.New("index is out of bound")
ErrIndexOutOfBound returned when an index is out of the array's bound
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct { Params // contains filtered or unexported fields }
Builder keeps track of signatures on a message and eventually produces a compact certificate for that message.
func MkBuilder ¶
func MkBuilder(param Params, part []basics.Participant, parttree *merklearray.Tree) (*Builder, error)
MkBuilder constructs an empty builder (with no signatures). The message to be signed, as well as other security parameters, are specified in param. The participants that will sign the message are in part and parttree.
func (*Builder) Add ¶
Add a signature to the set of signatures available for building a certificate. verifySig should be set to true in production; setting it to false is useful for benchmarking to avoid the cost of signature checks.
func (*Builder) Build ¶
Build returns a compact certificate, if the builder has accumulated enough signatures to construct it.
func (*Builder) Present ¶
Present checks if the builder already contains a signature at a particular offset.
func (*Builder) SignedWeight ¶
SignedWeight returns the total weight of signatures added so far.
type Cert ¶
type Cert struct { SigCommit crypto.GenericDigest `codec:"c"` SignedWeight uint64 `codec:"w"` SigProofs merklearray.Proof `codec:"S"` PartProofs merklearray.Proof `codec:"P"` // Reveals is a sparse map from the position being revealed // to the corresponding elements from the sigs and participants // arrays. Reveals map[uint64]Reveal `codec:"r,allocbound=MaxReveals"` // contains filtered or unexported fields }
Cert represents a compact certificate.
func (*Cert) CanMarshalMsg ¶
func (*Cert) CanUnmarshalMsg ¶
func (*Cert) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type CompactOneTimeSignature ¶
type CompactOneTimeSignature struct { merklesignature.Signature // contains filtered or unexported fields }
CompactOneTimeSignature is crypto.OneTimeSignature with omitempty
func (*CompactOneTimeSignature) CanMarshalMsg ¶
func (_ *CompactOneTimeSignature) CanMarshalMsg(z interface{}) bool
func (*CompactOneTimeSignature) CanUnmarshalMsg ¶
func (_ *CompactOneTimeSignature) CanUnmarshalMsg(z interface{}) bool
func (*CompactOneTimeSignature) MarshalMsg ¶
func (z *CompactOneTimeSignature) MarshalMsg(b []byte) (o []byte)
MarshalMsg implements msgp.Marshaler
func (*CompactOneTimeSignature) MsgIsZero ¶
func (z *CompactOneTimeSignature) MsgIsZero() bool
MsgIsZero returns whether this is a zero value
func (*CompactOneTimeSignature) Msgsize ¶
func (z *CompactOneTimeSignature) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*CompactOneTimeSignature) UnmarshalMsg ¶
func (z *CompactOneTimeSignature) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Params ¶
type Params struct { Msg crypto.Hashable // Message to be cerified ProvenWeight uint64 // Weight threshold proven by the certificate SigRound basics.Round // The round for which the ephemeral key is committed to SecKQ uint64 // Security parameter (k+q) from analysis document EnableBatchVerification bool // whether ED25519 batch verification is enabled }
Params defines common parameters for the verifier and builder.
type Reveal ¶
type Reveal struct { SigSlot sigslotCommit `codec:"s"` Part basics.Participant `codec:"p"` // contains filtered or unexported fields }
Reveal is a single array position revealed as part of a compact certificate. It reveals an element of the signature array and the corresponding element of the participants array.
func (*Reveal) CanMarshalMsg ¶
func (*Reveal) CanUnmarshalMsg ¶
func (*Reveal) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
type SortUint64 ¶
type SortUint64 = basics.SortUint64
SortUint64 implements sorting by uint64 keys for canonical encoding of maps in msgpack format.
type Verifier ¶
type Verifier struct { Params // contains filtered or unexported fields }
Verifier is used to verify a compact certificate.
func MkVerifier ¶
func MkVerifier(p Params, partcom crypto.GenericDigest) *Verifier
MkVerifier constructs a verifier to check the compact certificate on the message specified in p, with partcom specifying the Merkle root of the participants that must sign the message.