Background: The OCA Bundles that we generate and use are not fully compliant with the OCA because because we don't always maintain the digest attribute in all of the overlays. The branding credential never gets a digest, and if we manually update the OCA Bundle (vs. using the Excel), but digests don't get updated. The task is to write a command line utility that given an OCA Bundle, (re)calculates all of the digests in the bundle. An option on the command will verify (but not update) the digests in an OCA Bundle file.
An OCA digest is populated through the calculation of a SAID (Self Addressing IDentifier). A SAID is generated by hashing the content of the object (in this case, a JSON object) in a formally specified way to be used as the SAID, and then inserting the identifier into the object itself. That allows a verifier to do when they find a reference to a SAID, is to recalculate the SAID (e.g., hash the same data again in the same way) and make sure that the content has not changed. More background on SAIDs can be found here: https://kentbull.com/2024/09/22/keri-series-understanding-self-addressing-identifiers-said/ by @kentbull. For the purpose of this task, the most important part of the document is the the section on the seven steps to creating a SAID.
This task is to write a command line utility that implements (or borrows) the "seven steps" described in the blog post to generate a SAID, and then use that to process an OCA File. Given an OCA File (such as this), the steps of the process are:
- Iterate over the outer array. Typically with Aries OCA Bundles, we only have one OCA Bundle in the array, but assume there could be multiple. For each:
- Calculate the SAID for the
capture_base object, and update its digest property with the SAID value.
- Iterate through the list of overlays, and for each:
- Update the value of the
capture_base property with the SAID calculated for the capture_base object.
- Calculate the SAID for the Overlay and update its
digest property with the SAID value.
- Find, or if not present add, a property
d to the root of the OCABundle (beside capture_base) that will be a SAID, generate its value over the entire bundle and set its value to be the calculated SAID.
Add an option to verify the SAIDs of an OCA Bundle. Given an OCA Bundle, iterate through the Bundle and make sure that all of the SAIDs are accurate. Allow for the OCA Bundle level d SAID to NOT be present -- don't error if it is missing.
Background: The OCA Bundles that we generate and use are not fully compliant with the OCA because because we don't always maintain the
digestattribute in all of the overlays. Thebrandingcredential never gets adigest, and if we manually update the OCA Bundle (vs. using the Excel), butdigestsdon't get updated. The task is to write a command line utility that given an OCA Bundle, (re)calculates all of the digests in the bundle. An option on the command will verify (but not update) the digests in an OCA Bundle file.An OCA
digestis populated through the calculation of a SAID (Self Addressing IDentifier). A SAID is generated by hashing the content of the object (in this case, a JSON object) in a formally specified way to be used as the SAID, and then inserting the identifier into the object itself. That allows a verifier to do when they find a reference to a SAID, is to recalculate the SAID (e.g., hash the same data again in the same way) and make sure that the content has not changed. More background on SAIDs can be found here: https://kentbull.com/2024/09/22/keri-series-understanding-self-addressing-identifiers-said/ by @kentbull. For the purpose of this task, the most important part of the document is the the section on the seven steps to creating a SAID.This task is to write a command line utility that implements (or borrows) the "seven steps" described in the blog post to generate a SAID, and then use that to process an OCA File. Given an OCA File (such as this), the steps of the process are:
capture_baseobject, and update itsdigestproperty with the SAID value.capture_baseproperty with the SAID calculated for thecapture_baseobject.digestproperty with the SAID value.dto the root of the OCABundle (besidecapture_base) that will be a SAID, generate its value over the entire bundle and set its value to be the calculated SAID.Add an option to verify the SAIDs of an OCA Bundle. Given an OCA Bundle, iterate through the Bundle and make sure that all of the SAIDs are accurate. Allow for the OCA Bundle level
dSAID to NOT be present -- don't error if it is missing.