keri
keri copied to clipboard
Data model description
In writing #86, I put together a pseudo code representation of the data model, which I will put here and then will reference there. We may want to use different notation in the spec, but this may be useful in composing kid0002:
// Notation Info
Foo(bar:int, baz:[Byte]) // data structure with bar int field and baz Byte array
Biz = Qux | Quux | Quuz // Biz is union type of Qux, Quux, Quuz
Corge(...Foo, grault:int) // Corge is composed of all the fields of Foo with the addition of grault
// Receipts
Receipt(...Message, ...EventCoordinatesWithDigest, a:EventCoordinatesWithDigest)
// ^^^^ a:EventCoordinatesWithDigest must point to establishment event
// (root) EventCoordinatesWithDigest point to receipted event
// Events
EstablishmentEvent(...Event, ...KeyConfig, ...WitnessConfig)
InceptionEvent(...EstablishmentEvent, c:[ConfigurationTrait])
RotationEvent(...EstablishmentEvent, a:[Seal])
DelegatedInceptionEvent(...InceptionEvent, da:EventCoordinatesWithPreviousDigest)
DelegatedRotationEvent(...RotationEvent, da:EventCoordinatesWithPreviousDigest)
KeyConfig(kt:SignatureThreshold, k:[PublicKey])
SignatureThreshold = integer | WeightedSignatureThreshold
WitnessConfig(wt:integer, w:[BasicPrefix])
ConfigurationTrait = EstablishmentEventsOnly | DoNotDelegate
Seal = Digest | MerkleTreeRoot | EventCoordinatesWithDigest
KeyEvent(...Message, ...EventCoordinatesWithPreviousDigest)
// Message
Message(v:Version, t:MessageType, signatures:[Signature])
// Common
EventCoordinatesWithDigest(...EventCoordinates, d:Digest)
EventCoordinatesWithPreviousDigest(...EventCoordinates, p:Digest)
EventCoordinates(i:Prefix, s:integer)
Prefix = BasicPrefix | SelfAddressedPrefix | SelfSignedPrefix
BasicPrefix = PublicKey
SelfAddressedPrefix = Digest
SelfSignedPrefix = Signature
Version(major:integer, minor:integer, format:Format, size:integer)
Format = JSON | CBOR | MessagePack
// Crypto Primatives
MerkleTreeRoot(rd:Digest)
Signature(algorithm:SignatureAlgorithm, data:[byte])
Digest(algorithm:DigestAlgorithm, data:[byte])
SignatureAlgorithm = ED25519|ED448|ECSECP256K1
DigestAlgorithm = BLAKE3|...(omitted)...
being worked on in KID0002