Add methods to directly add Reference Values and Endorsed Values #142
+398
−53
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Files Added/Modified:
comid/comid.go
comid/comid_test.go
comid/digests.go
comid/hashalg.go
comid/hashalg_test.go
comid/valuetriple.go
Issue Addressed:
This pull request addresses #136 which highlights the difficulty in introducing Extensions for Reference Value Measurements using the current Extensions Interface.
###** Solution:**
New methods have been introduced to the CoMID struct to facilitate the addition of Reference Values without requiring the creation of instances for Measurement and ValueTriples. These methods include:
AddSimpleReferenceValue
AddDigestReferenceValue
AddRawReferenceValue
AddReferenceValueDirect
AddEndorsedValueDirect
These enhancements streamline the process, making it easier to add Reference Values and ensuring better usability of the Extensions Interface.
Before:
Users had to manually create instances for Measurement and ValueTriples to add Reference Values, which was cumbersome and error-prone.
Example:
measurement := &Measurement{ /* initialize measurement */ }
valueTriple := ValueTriple{
Environment: env,
Measurements: *NewMeasurements().Add(measurement),
}
comid.Triples.ReferenceValues.Add(valueTriple)
### After:
With the new methods, users can directly add Reference Values without creating these instances, significantly simplifying the process and reducing the likelihood of errors.
Example:
err := comid.AddSimpleReferenceValue(env, measurement)
if err != nil {
log.Fatalf("failed to add reference value: %v", err)
}