Documentation
¶
Overview ¶
Package vectors generates the golden vectors under testdata/vectors from the codec in borgrec. 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 decrypts what was wrapped, a certificate verifies, the SDK still refuses a short protocol name) fails the run when it stops holding.
Index ¶
Constants ¶
const Created = 1798761600
Created is the vectors' fixed time, 2027-01-01T00:00:00Z.
const Hall = "example_hall_vkqzmtrwxp"
Hall is the vectors' hall identifier; its suffix is a fixed example.
const OtherHall = "other_hall_qwertyuiop"
OtherHall is a well-formed hall that is not the vectors' topic.
Variables ¶
var ( Org = party("org", 0x51) Alice = party("alice", 0x52) Bob = party("bob", 0x53) Carol = party("carol", 0x54) // Dave is never a member: the stranger of refusal cases. Dave = party("dave", 0x56) // Successor is the key an organization hands over to (spec section 3.4). Successor = party("successor", 0x57) )
The parties: the organization and three members.
var GrantValues = map[string]map[string]string{
"alice": {"expiry": "2028-01-01T00:00:00Z", "role": "engineer", "scope": "member"},
"bob": {"expiry": "2028-01-01T00:00:00Z", "role": "team lead", "scope": "member,admin"},
"carol": {"expiry": "2027-07-01T00:00:00Z", "role": "contractor", "scope": "member"},
}
GrantValues are the members' grant fields in the clear.
var OrgOpaque = party("org-opaque", 0x55)
OrgOpaque is the second test organization, whose roll is opaque.
Functions ¶
Types ¶
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 {
Grants map[string]*borgrec.Grant // by member name
GrantRecs map[string][]byte
Commit map[string][32]byte // stand-in grant commitments (carrier txids)
OpaqueGrant *borgrec.Grant
OpaqueRec []byte
Orgs []*borgrec.Org
OrgRecs [][]byte
OrgTxids [][32]byte // stand-ins for each org token's mined txid
OpaqueOrg *borgrec.Org
OpaqueRaw []byte
Groups []*borgrec.Group
GroupRecs [][]byte
GroupTxids [][32]byte
EpochKeys [][32]byte // by epoch
EpochIDs [][32]byte // by epoch
Wraps []*borgrec.WrapRecord
WrapRecs [][]byte
WrapIVs []map[string][32]byte
}
Scenario is the story every record vector tells: an organization grants three members, makes a group of two, adds the third without rotating, removes one (the epoch rotates and the removed member cannot open it), rotates on schedule, and offboards the removed member from the roll.