From bb269f709d929f8ef9cf8a19ea51b123a4af0edb Mon Sep 17 00:00:00 2001 From: Brian Richter Date: Tue, 14 Jan 2025 21:16:30 -0800 Subject: [PATCH] # Switch to array-based format Changes the CEL data model to use arrays instead of objects at the root level. This makes the format simpler and better matches how event logs actually work. Key changes: - Root structure is now an array instead of {log: [...]} - previousLog is now an event type rather than a property - Updated examples and docs to match Before: ```json { "log": [{ "event": {...}, "proof": [...] }] } ``` After: ```json [{ "event": {...}, "proof": [...] }] ``` This should make the format easier to work with, especially for streaming. It also means everything (including previousLog) is just an event, which simplifies processing. Closes #3 --- index.html | 134 +++++++++++++++++++++-------------------------------- 1 file changed, 54 insertions(+), 80 deletions(-) diff --git a/index.html b/index.html index d9ab86a..117fc69 100644 --- a/index.html +++ b/index.html @@ -368,27 +368,25 @@

Data Model

Event Log

-A cryptographic event log contains a [=list=] of -witnessed events. The log's basic structure is shown below: +A cryptographic event log contains a [=list=] of witnessed events. +The log's basic structure is shown below:

-{
-  "log": [{
-    "event": {...}, // the first event in the event log
-    "proof": [...]  // a list of witness proofs securing the event
-    }, {
-    "event": {...}, // the second event
-    "proof": [...]  // a list of witness proofs securing the second event
-    }, {
-    "event": {...}, // the third event
-    "proof": [...]  // a list of witness proofs securing the third event
-  }]
-}
+[{
+  "event": {...}, // the first event in the event log
+  "proof": [...]  // a list of witness proofs securing the event
+}, {
+  "event": {...}, // the second event
+  "proof": [...]  // a list of witness proofs securing the second event
+}, {
+  "event": {...}, // the third event
+  "proof": [...]  // a list of witness proofs securing the third event
+}]
         

-An [=event log=] MUST conform to the following format: +An [=event log=] MUST be a [=list=] where each entry conforms to the following format:

@@ -400,87 +398,63 @@

Event Log

- + - +
logevent -A REQUIRED property whose value is a [=list=] of one or more entries that -conform to the following format: - - - - - - - - - - - - - - - - - -
PropertyDescription
event A REQUIRED property whose value conforms to the data structure defined in Section [[[#event-entry]]]. -
proof -A REQUIRED property whose value conforms to a [=data integrity proof=] -as defined by the [[VC-DATA-INTEGRITY]] specification. [=Conforming processors=] -MUST support at least the `ecdsa-jcs-2019` cryptosuite as defined by the -[[[VC-DI-ECDSA]]] specification. - -

-
previousLogproof -An OPTIONAL property whose value MUST conform to an external reference as -defined in Section [[[#external-reference]]]. The value MUST also contain a -`proof` property whose value conforms to a [=data integrity proof=] as defined -by the [[VC-DATA-INTEGRITY]] specification. [=Conforming processors=] MUST -support at least the `ecdsa-jcs-2019` cryptosuite as defined by the -[[[VC-DI-ECDSA]]] specification. Event logs MUST have a default maximum size of -10MB which can be overridden by [=application specification=]s and SHOULD be at -least 1MB in size before creating a new chunk. +A REQUIRED property whose value conforms to a [=data integrity proof=] +as defined by the [[VC-DATA-INTEGRITY]] specification. [=Conforming processors=] +MUST support at least the `ecdsa-jcs-2019` cryptosuite as defined by the +[[[VC-DI-ECDSA]]] specification.

-To support chunking, the `previousLog` property is provided to ensure that -arbitrarily long change histories are supported. +To support chunking, a special `previousLog` event type is provided to ensure that +arbitrarily long change histories are supported. Event logs MUST have a default maximum size of +10MB which can be overridden by [=application specification=]s and SHOULD be at +least 1MB in size before creating a new chunk. When a log exceeds the maximum size, +a new log should be created with its first event being a `previousLog` event that +references the previous log.

-
-{
-  "previousLog" : {
-    // URLs that can be used to retrieve the previous event log
-    "url": [
-      "https://website.example/log123.cel",
-      "3jxop4cs2lu5ur2...sseqdsp3k262uwy4.onion/log123.cel",
-      "ipfs://QmCQFJGkARStJbTy8w65yBXgyfG2ZBg5TrfB2hPjrDQH3R"
-    ],
-    // The media type associated with the previous log
-    "mediaType": "application/cel",
-    // a cryptographic digest of the previous log (sha2-256 base64-url-nopad)
-    "digestMultibase": "uEiwLZcLK9EBguM5WZlbAgfXBDuQAkoYyQ6YVtUmER8pN24"
+        
+[{
+  "event": {
+    "operation": {
+      "type": "previousLog",
+      "dataReference": {
+        // URLs that can be used to retrieve the previous event log
+        "url": [
+          "https://website.example/log123.cel",
+          "3jxop4cs2lu5ur2...sseqdsp3k262uwy4.onion/log123.cel",
+          "ipfs://QmCQFJGkARStJbTy8w65yBXgyfG2ZBg5TrfB2hPjrDQH3R"
+        ],
+        // The media type associated with the previous log
+        "mediaType": "application/cel",
+        // a cryptographic digest of the previous log (sha2-256 base64-url-nopad)
+        "digestMultibase": "uEiwLZcLK9EBguM5WZlbAgfXBDuQAkoYyQ6YVtUmER8pN24"
+      }
+    },
     "proof": [...]  // a list of witness proofs securing the previous event log
+  }, {
+  "event": {
+    "operation": {
+      "type": "create",
+      // ... rest of create event
+    }
   },
-  "log": [{
-    "event": {...}, // the first event in the event log
-    "proof": [...]  // a list of witness proofs securing the event
-    }, {
-    "event": {...}, // the second event
-    "proof": [...]  // a list of witness proofs securing the second event
-    }, {
-    "event": {...}, // the third event
-    "proof": [...]  // a list of witness proofs securing the third event
-  }]
-}
+  "proof": [...]
+}, {
+  // ... additional events
+}]
         
@@ -585,7 +559,7 @@

Event Entry

A REQUIRED property whose value is the type of event being expressed. A [=conforming processor=] MUST support the following [=string=] values: `create`, -`update`, and `deactivate` and MAY support other values defined by a +`update`, `deactivate`, and `previousLog` and MAY support other values defined by a [=conforming application specification=].