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

Update to go-did v0.11 #2634

Merged
merged 12 commits into from
Dec 5, 2023
Merged

Update to go-did v0.11 #2634

merged 12 commits into from
Dec 5, 2023

Conversation

reinkrul
Copy link
Member

@reinkrul reinkrul commented Dec 1, 2023

Changes:

  • VerifiableCredential.IssuanceDate is now a required *time.Time. I had to add them where it wasn't present, and change it to a pointer where it was present.

Earlier, it included these changes, which we decided to revert since it leads to too many changes in the Nuts node:

  • The REST API and go-leia credential store assume JSON-LD arrays are compacted. Changing this, although still valid JSON-LD and semantically the same credential, would break expected behavior of API users. So I introduced a CompactingVerifiableCredential and CompactingVerifiablePresentation which essentially do the same as go-did earlier did for JSON-LD types; compacting arrays on JSON marshalling. This is the majority of the change. This can be removed when the VCR v2 API and go-leia credential store is replaced with something else.
  • SignedDocument.UnmarshalProofValue assumed there was only 1 proof which is never the case any more, since it's now always marshalled into an array (even if it has just one value). I extended the function to not burden the caller with checking the number of proofs, since I don't expect there multiple proofs at any time (although still supported).
  • PEX paths now always index array properties (mostly verifiableCredential[0]).

@reinkrul reinkrul changed the title Update to go-did v0.10.0 Update to go-did v0.10 Dec 1, 2023
@reinkrul reinkrul requested review from gerardsn and woutslakhorst and removed request for gerardsn December 4, 2023 10:43
@woutslakhorst
Copy link
Member

The REST API and go-leia credential store assume JSON-LD arrays are compacted. Changing this, although still valid JSON-LD and semantically the same credential, would break expected behavior of API users. So I introduced a CompactingVerifiableCredential and CompactingVerifiablePresentation which essentially do the same as go-did earlier did for JSON-LD types; compacting arrays on JSON marshalling. This is the majority of the change. This can be removed when the VCR v2 API and go-leia credential store is replaced with something else.

Could you elaborate on this? In go-leia in examples/jsonld I can change the template (remove the array from children) and it will work exactly the same. Is it only an API problem then?

Copy link
Member

@gerardsn gerardsn left a comment

Choose a reason for hiding this comment

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

I've added a commit to fix a VC validator issue

vcr/types/jsonld.go Outdated Show resolved Hide resolved
vcr/api/vcr/v2/types.go Outdated Show resolved Hide resolved
vcr/issuer/issuer.go Outdated Show resolved Hide resolved
vcr/issuer/leia_store.go Outdated Show resolved Hide resolved
vcr/issuer/network_publisher.go Show resolved Hide resolved
Copy link
Member

@woutslakhorst woutslakhorst left a comment

Choose a reason for hiding this comment

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

It seems this only happens for the JSON stores, we can just change them to JSONLD stores and the problem is solved.

  • change all JSON collection types to JSONLD collection types
  • change to the correct index and search queries
  • rename the index, then the index will be rebuild from the kv kackup

Lots of tests have to be updated though.

vcr/api/vcr/v2/generated.go Outdated Show resolved Hide resolved
@woutslakhorst
Copy link
Member

The need for this change started with simplifying the PEX submission validation. In order to do it without a lot of code, we could change the go-did library so it always marshals to arrays instead of objects when n=1. But this had some more consequences which are now being fixed by this PR. So in short: simplification lead to lib change lead to monkey patch...

Maybe it's better to implement the PEX stuff using the complex approach?

@reinkrul
Copy link
Member Author

reinkrul commented Dec 5, 2023

The need for this change started with simplifying the PEX submission validation. In order to do it without a lot of code, we could change the go-did library so it always marshals to arrays instead of objects when n=1. But this had some more consequences which are now being fixed by this PR. So in short: simplification lead to lib change lead to monkey patch...

Maybe it's better to implement the PEX stuff using the complex approach?

On the other hand, if upcoming VC versions don't compact arrays in JSON-LD, we need it sooner or later?

Copy link
Member

@gerardsn gerardsn left a comment

Choose a reason for hiding this comment

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

over complete review, but requesting changes mainly on last comment

didman/didman.go Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
go.sum Outdated Show resolved Hide resolved
vdr/didnuts/validators.go Show resolved Hide resolved
vcr/verifier/verifier_test.go Outdated Show resolved Hide resolved
@reinkrul reinkrul changed the title Update to go-did v0.10 Update to go-did v0.11 Dec 5, 2023
@gerardsn gerardsn merged commit 30d3f21 into master Dec 5, 2023
6 checks passed
@gerardsn gerardsn deleted the update-godid branch December 5, 2023 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants