Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add anchor and profile to anchor credential subject #1403

Merged
merged 1 commit into from
Jul 21, 2022

Conversation

bstasyszyn
Copy link
Contributor

The credialSubject field in the anchor credential now has:

  • id - hashlink of the original content
  • anchor - the core index file hashlink
  • profile - the ID of the generator that generated the content

When an anchor event is processed, the anchor credential subject is validated against the content.

closes #1348

Signed-off-by: Bob Stasyszyn Bob.Stasyszyn@securekey.com

@cla-bot cla-bot bot added the cla-signed label Jul 20, 2022
@codecov
Copy link

codecov bot commented Jul 20, 2022

Codecov Report

Merging #1403 (fd9627c) into main (49970cb) will decrease coverage by 0.04%.
The diff coverage is 91.57%.

@@            Coverage Diff             @@
##             main    #1403      +/-   ##
==========================================
- Coverage   88.08%   88.04%   -0.05%     
==========================================
  Files         205      205              
  Lines       19092    19157      +65     
==========================================
+ Hits        16818    16867      +49     
- Misses       1459     1468       +9     
- Partials      815      822       +7     
Impacted Files Coverage Δ
...nchor/anchorlinkset/generator/generatorregistry.go 100.00% <ø> (ø)
pkg/anchor/writer/writer.go 87.83% <66.66%> (-0.41%) ⬇️
pkg/anchor/anchorlinkset/anchorlinkset.go 62.50% <83.33%> (-0.14%) ⬇️
...nkset/generator/didorbgenerator/didorbgenerator.go 78.01% <85.18%> (+1.69%) ⬆️
cmd/orb-server/startcmd/start.go 67.85% <100.00%> (+0.53%) ⬆️
...nerator/didorbtestgenerator/didorbtestgenerator.go 100.00% <100.00%> (ø)
pkg/anchor/builder/builder.go 100.00% <100.00%> (ø)
pkg/anchor/graph/graph.go 81.81% <100.00%> (ø)
pkg/anchor/handler/credential/handler.go 78.04% <100.00%> (+2.53%) ⬆️
pkg/observer/observer.go 84.78% <100.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 49970cb...fd9627c. Read the comment docs.

The credialSubject field in the anchor credential now has:
- id - hashlink of the original content
- anchor - the core index file hashlink
- profile - the ID of the generator that generated the content

When an anchor event is processed, the anchor credential subject is validated against the content.

closes trustbloc#1348

Signed-off-by: Bob Stasyszyn <Bob.Stasyszyn@securekey.com>
@@ -139,6 +149,31 @@ func (h *AnchorEventHandler) HandleAnchorEvent(actor, anchorRef, source *url.URL
}

func (h *AnchorEventHandler) processAnchorEvent(anchorInfo *anchorInfo) error {
anchorLink := anchorInfo.anchorLink
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if this code should have been in observer.go line 340 This is where we parse VC with checking signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the checks in this spot since this is where anchor events from other domains are processed. The Observer also receives anchors from the local domain and these are assumed to be valid (since the local domain created it).

@sandrask sandrask merged commit 418103a into trustbloc:main Jul 21, 2022
@bstasyszyn bstasyszyn deleted the 1348 branch July 25, 2022 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

credentialSubject should be an object
3 participants