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

vectors

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package vectors generates the golden vectors under testdata/vectors from the boxrec codec. Every input is fixed, so a run writes the same bytes every time; TestVectors regenerates them and compares byte for byte.

Index

Constants

View Source
const Office = "example_office_qzxkvbmwtr"

Office is the vectors' office identifier: the readable part "example_office" and a fixed example suffix. A real office draws its suffix at random (boxrec.NewOffice); a vector fixes one so it is reproducible.

View Source
const OtherOffice = "example_office_hdjvnwpxle"

OtherOffice shares Office's readable part under another suffix: a different office, and a different topic.

Variables

View Source
var (
	SenderKey    = bytes.Repeat([]byte{0x42}, 32)
	RecipientKey = bytes.Repeat([]byte{0x43}, 32)
)

SenderKey and RecipientKey are the test keys: 32 bytes of 0x42 and of 0x43. Both are public and must never hold anything real.

View Source
var OtherKey = bytes.Repeat([]byte{0x44}, 32)

OtherKey is a third test key, 32 bytes of 0x44: an identity that is neither the sender nor the recipient. Public, never for real use.

Functions

func BRC78

func BRC78(plaintext, sender, recipient []byte, keyID, iv [32]byte) ([]byte, error)

BRC78 encrypts plaintext from sender to recipient exactly as BRC-78 and go-sdk's message.Encrypt do, but with the key id and the IV given rather than drawn, so the vector is reproducible. The tests decrypt every result with go-sdk's message.Decrypt and through the recipient's wallet.

func Generate

func Generate() (map[string][]byte, error)

Generate returns every vector file, keyed by its name under testdata/vectors.

func Names

func Names(files map[string][]byte) []string

Names returns the generated file names in order.

func Recipient

func Recipient() []byte

func Sender

func Sender() []byte

Sender and Recipient return the test identities' compressed keys.

Types

type Headers

type Headers map[uint32]chainhash.Hash

Headers is the test chain's block headers: a merkle root per height. It is the chain tracker the vectors are admitted against.

func (Headers) CurrentHeight

func (h Headers) CurrentHeight(context.Context) (uint32, error)

CurrentHeight is the highest height held.

func (Headers) IsValidRootForHeight

func (h Headers) IsValidRootForHeight(_ context.Context, root *chainhash.Hash, height uint32) (bool, error)

IsValidRootForHeight holds root to the one the test chain has at height.

Jump to

Keyboard shortcuts

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