MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / substance_view

Function substance_view

atomic-canonical/src/proof.rs:91–107  ·  view source on GitHub ↗

The value covered by the *substance* hash (`intentSubstanceHash`): the reviewable definition of an intent, with all review **state** and authorship/proof **metadata** removed. It extends [`hashing_view`] (which already drops `proof` + `contentHash`) by additionally stripping the top-level `status` and `attributedTo`, and, from every element of `hasAcceptanceCriterion`, the review-state keys in [`A

(value: &Value)

Source from the content-addressed store, hash-verified

89/// *meaning* changes and holds steady while it is merely being reviewed or
90/// attested.
91pub fn substance_view(value: &Value) -> Value {
92 let mut value = hashing_view(value);
93 if let Some(obj) = value.as_object_mut() {
94 obj.remove(PROP_STATUS);
95 obj.remove(PROP_ATTRIBUTED_TO);
96 if let Some(Value::Array(acs)) = obj.get_mut(PROP_HAS_ACCEPTANCE_CRITERION) {
97 for ac in acs.iter_mut() {
98 if let Some(ac_obj) = ac.as_object_mut() {
99 for key in AC_REVIEW_STATE_KEYS {
100 ac_obj.remove(*key);
101 }
102 }
103 }
104 }
105 }
106 value
107}
108
109/// Generic attest over a JSON-LD value — the *one* canonicalization/signing
110/// path all typed nodes share. Fills `attributedTo` (from the identity's

Callers 1

substance_valueMethod · 0.85

Calls 4

hashing_viewFunction · 0.85
get_mutMethod · 0.80
iter_mutMethod · 0.80
removeMethod · 0.65

Tested by

no test coverage detected