Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Data model description #88

Open
stevetodd opened this issue Jan 11, 2021 · 1 comment
Open

Data model description #88

stevetodd opened this issue Jan 11, 2021 · 1 comment

Comments

@stevetodd
Copy link
Contributor

stevetodd commented Jan 11, 2021

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)...
@chunningham
Copy link
Contributor

being worked on in KID0002

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants