Documentation ¶
Overview ¶
Package witness is designed to make sure the checkpoints of verifiable logs are consistent and store/serve/sign them if so. It is expected that a separate feeder component would be responsible for the actual interaction with logs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogInfo ¶
type LogInfo struct { // The verifier for signatures from the log. SigV note.Verifier // The expected Origin string in the checkpoints. Origin string // The hash strategy that should be used in verifying consistency. Hasher merkle.LogHasher }
LogInfo contains the information needed to verify log checkpoints.
type Opts ¶
type Opts struct { Persistence persistence.LogStatePersistence Signers []note.Signer KnownLogs map[string]LogInfo }
Opts is the options passed to a witness.
type Proof ¶
type Proof [][]byte
Proof represents a common format proof.
Interpretation of the proof bytes is ecosystem dependent.
type Witness ¶
type Witness struct { Signers []note.Signer // At some point we might want to store this information in a table in // the database too but as I imagine it being populated from a static // config file it doesn't seem very urgent to do that. Logs map[string]LogInfo // contains filtered or unexported fields }
Witness consists of a database for storing checkpoints, a signer, and a list of logs for which it stores and verifies checkpoints.
func (*Witness) GetCheckpoint ¶
GetCheckpoint gets a checkpoint for a given log, which is consistent with all other checkpoints for the same log signed by this witness.
func (*Witness) Update ¶
func (w *Witness) Update(ctx context.Context, logID string, nextRaw []byte, cProof [][]byte) ([]byte, error)
Update updates the latest checkpoint if nextRaw is consistent with the current latest one for this log.
It returns the latest cosigned checkpoint held by the witness, which is a signed version of nextRaw if the update was applied.
If an error occurs, this method will generally return an error with a status code: - codes.NotFound if the log is unknown - codes.InvalidArgument for general bad requests - codes.AlreadyExists if the checkpoint is smaller than the one the witness knows - codes.FailedPrecondition if the checkpoint is inconsistent with the one the witness knows