Documentation
¶
Overview ¶
Package vectors generates the golden vectors under testdata/vectors from the codec in internal/secrec. Every value is derived from fixed stand-ins (public test keys, hashes of labels for anything a client draws at random), so the files are reproducible byte for byte; every check the generator makes (a wallet opens what was wrapped to it, a member of another epoch does not, BRC-369's own vectors still reproduce) fails the run when it stops holding.
Index ¶
Constants ¶
const Created = 1798761600
Created is the vectors' fixed time, in Unix seconds.
const Crypt = "example_crypt_hmqzvtkwrx"
Crypt is the vectors' crypt identifier; its suffix is a fixed example.
const Hall = "example_hall_vkqzmtrwxp"
Hall is the identifier of the hall the vectors' group lives in.
const OtherCrypt = "other_crypt_qwertyuiop"
OtherCrypt is a well-formed crypt that is not the vectors' topic.
const PadBlock = 256
PadBlock is the block the scenario pads payloads to.
Variables ¶
var ( Org = party("org", 0x51) Alice = party("alice", 0x52) Bob = party("bob", 0x53) Carol = party("carol", 0x54) Dave = party("dave", 0x56) )
The parties: the organisation that owns the vault, three members of its group, and a key that is never a member. They are the identities the group substrate's own vectors use, so the two vector sets describe one scenario.
var GroupEpochs = []GroupEpoch{ {0, h32("f32d56bd890f105f1e9731d9607b464078644b0ce1df8e7a87196589bd0266ca"), h32("3d67c0041301c203085c253fb02a70d5d86ebdbe411759a18c7e63a40af8bd35"), h32("ceeed5d6813b5155763f35d7209ce29228cd9625bb6527946fcdf6ee1b30f4ee"), h32("f177512800bb4d36592b8d1828c32da6573fd256908efb8f0a234cd6911e79dc"), "the group is created with alice and bob; carol is added within the epoch", []string{"alice", "bob", "carol"}, 1000, false}, {1, h32("2502fa9da5b7f889d8de37defbdda85531e2c6b20626a3e59efa6815aac06189"), h32("836a3cd360f7eb2a083d0fd085c537f6fb6d29df6fbca8b68835e48d07d62dc0"), h32("33446213fbf23b1a12c81c0b6679ff8cb4345db876f39affabc0050bb46604eb"), h32("2f7d1933ba956338f37d5b60627c5ba30e86dbde98192030d8c0bed41fe3f421"), "bob is removed", []string{"alice", "carol"}, 1010, true}, {2, h32("ceebd5308ddfaee2f1fb4f5f2dc96b596b58f4ad1643136ec53eb35071587947"), h32("b73945e40061c4823d1d9cf528a76b2e7a33a2b97ef182828c6aaeca48fea003"), h32("16a5a7e954bc2b7400de9f24edd5d81c62e9d0c88557ee6cf2298e3dd39a62be"), h32("2eb099db87764574f67fa85ef85a6b467e003a109aaef169755cf2edb56f8ab2"), "a scheduled rotation, no member change", []string{"alice", "carol"}, 1030, false}, }
GroupEpochs is the group's history: created with alice and bob, carol added within epoch 0, bob removed (epoch 1), a scheduled rotation (epoch 2). The heights are those the audit vector uses.
var GroupID = func() (id [16]byte) { copy(id[:], unhex("406504d3fbe1ae098f09a49dffa12222")); return }()
GroupID is the vectors' group identifier.
Functions ¶
Types ¶
type GroupEpoch ¶
type GroupEpoch struct {
Epoch uint64
Key [32]byte
Symmetric [32]byte
Commitment [32]byte
EpochID [32]byte
Began string
Holders []string
Height uint32
Removed bool
}
GroupEpoch is one epoch of the vectors' group, as the group substrate's own golden vectors give it: the key the organisation sampled, the BRC-369 symmetric key and commitment it derives, and the epoch id. Holders is who was a member during the epoch and so holds its key.
type Headers ¶
Headers is the test chain's block headers: a merkle root per height. It is the chain tracker the transaction vectors are admitted against.
func (Headers) CurrentHeight ¶
CurrentHeight is the highest height held.
type Party ¶
type Party struct {
Name string
Priv *ec.PrivateKey
}
Party is one public test identity: 32 bytes of one value as the private key. Never for real use.
type Scenario ¶
type Scenario struct {
VaultID [32]byte
Genesis [32]byte // the stand-in txid of the chain tree the first token spends
Versions map[string]*Version
Order []string
Vaults []*secrec.Vault
VaultRecs [][]byte
VaultTxids [][32]byte
Heights []uint32
Labels []string
// Name is the vault's display name; "Example vault" when empty.
Name string
// Used is the tooling's record of every commitment it published or
// listed, shared by every vault of the owner (docs/spec.md section 6.2).
Used *secrec.Commitments
// contains filtered or unexported fields
}
Scenario is the vectors' one vault: its secrets' versions and its chain of tokens.
type Version ¶
type Version struct {
Name string
Number uint64
Epoch uint64
Key [32]byte
Payload *secrec.Payload
Plain []byte // the encoded payload
Cipher []byte
Rec *secrec.Secret
Raw []byte
CID [32]byte
SelfIV [32]byte
WrapIV [32]byte
File string
}
Version is one version of one secret of the scenario.