conformance

package
v0.0.5 Latest Latest
Warning

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

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

Documentation

Overview

Package conformance carries the suite a protocol binding must pass, and the corpus it is defined over.

The corpus — the manifest, the valid and invalid envelope fixtures, and the Ed25519 signing vectors — is authored at the repository root and mirrored into this package by cmd/protoc-registry so that embed can reach it. It is part of the contract rather than scaffolding for this repository's own tests: a consumer that has the module but cannot run the vectors has half of what the module is for. Embedding it means a consumer needs no checkout of this repository, needs no knowledge of where the module cache put it, and cannot be broken by a relative path that was correct on one machine and wrong on the next.

FS returns the corpus. Signing returns the key and the vectors already decoded, so that no consumer has to rediscover where they live or how they are encoded. Everything else here is the Go runner over them, and a binding in another language consumes the same files and must produce the same canonical bytes and the same signatures.

The corpus lives here rather than in go/protocol because go/protocol is linked into every consumer's production binary and the corpus is only ever needed by tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FS

func FS() fs.FS

FS returns the conformance corpus: the manifest, the valid and invalid envelope fixtures, and the signing vectors.

It is the whole contract, available to anyone who has the module. A consumer does not need this repository checked out, does not need to know where the module cache put it, and cannot be broken by a relative path that was correct on one machine.

func Signing

func Signing() (SigningKey, []SigningVector, error)

Signing returns the conformance signing key and every vector.

The two are returned together because neither is usable without the other: verifying a vector needs the key, and the key alone asserts nothing.

Types

type SigningKey

type SigningKey struct {
	// Algorithm is always "ed25519" in this revision.
	Algorithm string
	// Seed is the 32-byte Ed25519 seed the key is derived from.
	Seed []byte
	// PublicKey is the 32-byte Ed25519 public key the seed derives.
	PublicKey []byte
	// KeyID is the identifier form the protocol uses: base32-nopad over the
	// SHA-256 of PublicKey.
	KeyID string
}

SigningKey is the conformance signing key from fixtures/signing/key.json.

It signs nothing outside the corpus. It is derived from a published seed precisely so that any implementation can reproduce the vectors rather than take them on trust.

type SigningVector

type SigningVector struct {
	// Name identifies the vector, and is the fixture's file name without its
	// extension.
	Name string
	// Fixture is the corpus path of the envelope this vector was built from.
	Fixture string
	// EventType is the envelope's event type.
	EventType string
	// Canonical is the exact byte sequence the signature covers. An
	// implementation's own canonicalisation must reproduce it.
	Canonical []byte
	// Digest is the hex SHA-256 of Canonical.
	Digest string
	// Signature is base64url-unpadded, as it appears in the envelope, so it can
	// be compared against a signed envelope's field without re-encoding.
	Signature string
	// Envelope is the signed envelope, as published.
	Envelope json.RawMessage
}

SigningVector is one entry of fixtures/signing/vectors.json: an envelope, the exact bytes it was signed over, and the signature.

Jump to

Keyboard shortcuts

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