Help us shape the future of Go! Take the 2026 Go Developer Survey

verify

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package verify is a dependency-light, standalone verifier for Bide audit proofs. It depends on nothing but the Go standard library (crypto/sha256, crypto/ed25519, encoding/binary, bytes, math/bits), deliberately NOT the agent core or gsm, so a third party (an auditor, a regulator) can verify a proof without importing the SDK, or reimplement this file from RFC 6962 and check us against it. That is what "verifiable without trusting the vendor" means in practice.

It operates on canonical LEAF BYTES, not typed records, precisely so it needs no domain types. The leaf for a journal record is the record's canonical JSON (what the audit package hashes); the caller supplies those bytes. The algorithms mirror the audit package exactly and are cross-checked against it in the tests, so the intentional duplication cannot drift.

This mirror is verification-only, by design: it can check a proof, never mint one.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Consistency

func Consistency(first, size int, path [][]byte, firstRoot, laterRoot []byte) bool

Consistency runs the RFC 6962 §2.1.2 consistency-proof algorithm: reports whether firstRoot (over the first `first` leaves) is an append-only prefix of laterRoot (over `size` leaves).

func Inclusion

func Inclusion(root, leaf []byte, index, size int, path [][]byte) bool

Inclusion runs the RFC 6962 §2.1.1 inclusion-proof algorithm: leaf is the canonical leaf bytes, index/size locate it in the tree, path is the sibling hashes leaf-to-root, and root is the committed Merkle root (an STH's Root). Reports whether leaf is provably at index in a size-leaf tree committed by root.

func TreeHead

func TreeHead(root []byte, size int, timestamp int64, sig, pub []byte) bool

TreeHead reports whether sig is a valid Ed25519 signature, under pub, of the signed tree head committing to (root, size, timestamp). The canonical encoding is domain-separated and length-prefixed, byte-identical to audit.TreeHead.canonical(), so an STH signed by the SDK verifies here and vice versa.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL