@@ -168,19 +168,192 @@ message EventResponse {
168168 max_length : 1024
169169 }];
170170
171- // An event has exactly one proof mechanism. This field caputures the proof
172- // mechanism specific details supporting the trustworthyness of the event
173- // record. We anticipate at least two proof mechs: merkle_log and
174- // verkle_log. We use oneof to avoid repeating the scattering of randomly
175- // re-purposed fields we currently have for simple hash vs khipu.
176-
171+ // An event has exactly one proof mechanism. On any event only the entry
172+ // corresponding to the chosen proof mechanism will be present. (Note that
173+ // onfof exposes us to to many tooling compatibility issues)
177174
178175 // proof details for proof_mechanism MERKLE_LOG
179- MerkleLogEntry merklelog_entry = 19 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
180- description :
181- "verifiable merkle mmr log entry details" ,
176+ oneof proof_details {
177+ MerkleLogEntry merklelog_entry = 19 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
178+ description :
179+ "verifiable merkle mmr log entry details" ,
180+ // see https://github.com/grpc-ecosystem/grpc-gateway/blob/master/protoc-gen-openapiv2/options/openapiv2.proto
181+ // for specific types.
182+ type : OBJECT
183+ }];
184+ }
185+ }
186+
187+ // EventResponseJSONAPI represents how the consumer of the events api sees the event data.
188+ message EventResponseJSONAPI {
189+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema ) = {
190+ json_schema : {
191+ description : "This describes an Event."
192+ }
193+ example :"{ "
194+ "\"identity\": \"assets/add30235-1424-4fda-840a-d5ef82c4c96f/events/11bf5b37-e0b8-42e0-8dcf-dc8c4aefc000\", "
195+ "\"asset_identity\": \"assets/add30235-1424-4fda-840a-d5ef82c4c96f\", "
196+ "\"operation\": \"Record\", "
197+ "\"behaviour\": \"RecordEvidence\", "
198+ "\"event_attributes\": { "
199+ " \"arc_attachments\": ["
200+ " {"
201+ " \"arc_attachment_identity\": \"blobs/1754b920-cf20-4d7e-9d36-9ed7d479744d\","
202+ " \"arc_hash_value\": \"01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b\","
203+ " \"arc_display_name\": \"Picture from yesterday\","
204+ " \"arc_hash_alg\": \"sha256\""
205+ " }"
206+ " ]"
207+ "}, "
208+ "\"asset_attributes\": { "
209+ " \"arc_firmware_version\": \"3.2.1\", "
210+ " \"arc_home_location_identity\": \"locations/42054f10-9952-4c10-a082-9fd0d10295ae\""
211+ "}, "
212+ "\"timestamp_accepted\": \"2019-11-27T14:44:19Z\", "
213+ "\"timestamp_declared\": \"2019-11-27T14:44:19Z\", "
214+ "\"timestamp_committed\": \"2019-11-27T14:44:19Z\", "
215+ "\"principal_declared\": { "
216+ " \"issuer\": \"job.idp.server/1234\", \"subject\":\"bob@job\" "
217+ " }, "
218+ " \"principal_accepted\": { "
219+ " \"issuer\": \"job.idp.server/1234\", \"subject\":\"bob@job\" "
220+ "}, "
221+ "\"confirmation_status\": \"CONFIRMED\", "
222+ "\"block_number\": 12, "
223+ "\"transaction_index\": 5, "
224+ "\"transaction_id\": \"0x07569\", "
225+ "\"tenant_identity\": \"tenant/8e0b600c-8234-43e4-860c-e95bdcd695a9\" "
226+ "}"
227+ };
228+
229+ // Relative Resource Name for the operation event
230+ string identity = 1 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
231+ description : "identity of a event resource"
232+ read_only : true
233+ }];
234+
235+ // relative resource name for associated asset ( asset the operation is performed on - has to have specific behaviour enabled)
236+ string asset_identity = 2 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
237+ description : "identity of a related asset resource `assets/11bf5b37-e0b8-42e0-8dcf-dc8c4aefc000`"
238+ read_only : true
239+ }];
240+
241+ // map of event attributes. Specific behaviours define required and optional event attributes for each supported operation.
242+ map <string , string > event_attributes = 16 [
243+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
244+ description : "key value mapping of event attributes"
245+ }
246+ ];
247+
248+ // map of asset attributes. Specific behaviours define required and optional asset attributes. These attributes cause the corresponding attributes on the asset to be updated.
249+ map <string , string > asset_attributes = 17 [
250+ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
251+ description : "key value mapping of asset attributes"
252+ }
253+ ];
254+
255+ // name of operation on this behviour
256+ string operation = 4 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
257+ description : "The operation represented by the event. `Record`"
258+ read_only : true
259+ max_length : 4096
260+ }];
261+
262+ // name of this behaviour
263+ string behaviour = 14 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
264+ description : "The behaviour used to create event. `RecordEvidence`"
265+ read_only : true
266+ max_length : 4096
267+ }];
268+
269+ // timestamp when operation was actually performed - if not provided will be set to timestamp_accepted
270+ string timestamp_declared = 5 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
271+ description : "RFC 3339 time of event as declared by the user"
272+ read_only : true
273+ }];
274+
275+ // timestamp when system received operation request
276+ string timestamp_accepted = 6 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
277+ description : "RFC 3339 time of event as recorded by the server"
278+ read_only : true
279+ }];
280+
281+ // timestamp for when the event was committed to a verifiable log
282+ string timestamp_committed = 7 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
283+ description : "RFC 3339 time of event as recorded in verifiable storage"
284+ read_only : true
285+ }];
286+
287+ // principal information associated with event - if not provided will be set to principal_accepted
288+ Principal principal_declared = 8 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
289+ description : "principal provided by the user"
290+ read_only : true
291+ // see https://github.com/grpc-ecosystem/grpc-gateway/blob/master/protoc-gen-openapiv2/options/openapiv2.proto
292+ // for specific types.
293+ type : OBJECT
294+ }];
295+
296+ // principal logged into the system that performed the operation
297+ Principal principal_accepted = 9 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
298+ description : "principal recorded by the server"
299+ read_only : true
182300 // see https://github.com/grpc-ecosystem/grpc-gateway/blob/master/protoc-gen-openapiv2/options/openapiv2.proto
183301 // for specific types.
184302 type : OBJECT
185303 }];
304+
305+ // indicated if operation has been committed to the blockchain
306+ string confirmation_status = 10 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
307+ description : "indicates if the event has been succesfully committed to the blockchain"
308+ read_only : true
309+ // see https://github.com/grpc-ecosystem/grpc-gateway/blob/master/protoc-gen-openapiv2/options/openapiv2.proto
310+ // for specific types.
311+ type : STRING
312+ }];
313+
314+ // NOTICE: We expect to retire simple hash and then remove all the top level dlt fields.
315+
316+ // hash of transaction committing this operation on blockchain
317+ string transaction_id = 11 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
318+ description : "hash of the transaction as a hex string `0x11bf5b37e0b842e08dcfdc8c4aefc000`"
319+ max_length : 4096
320+ }];
321+
322+ // block number of committing transaction
323+ uint64 block_number = 12 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
324+ description : "number of block event was commited on"
325+ read_only : true
326+ }];
327+
328+ // transaction index of committing transaction
329+ uint64 transaction_index = 13 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
330+ description : "index of event within commited block"
331+ read_only : true
332+ }];
333+
334+ // wallet address for the creator of this event
335+ string from = 15 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
336+ description : "wallet address for the creator of this event"
337+ read_only : true
338+ }];
339+
340+ string tenant_identity = 18 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
341+ description :
342+ "Identity of the tenant the that created this event"
343+ max_length : 1024
344+ }];
345+
346+ // An event has exactly one proof mechanism. This field caputures the proof
347+ // mechanism specific details supporting the trustworthyness of the event
348+ // record. We anticipate at least two proof mechs: merkle_log and
349+ // verkle_log. We use oneof to avoid repeating the scattering of randomly
350+ // re-purposed fields we currently have for simple hash vs khipu.
351+ oneof proof_details {
352+ // proof details for proof_mechanism MERKLE_LOG
353+ MerkleLogEntry merklelog_entry = 19 [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field ) = {
354+ description :
355+ "verifiable merkle mmr log entry details"
356+ max_length : 1024
357+ }];
358+ };
186359}
0 commit comments