Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

feat: new component for data models - DIDs, signatures, JSON-LD #3565

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

Moopli
Copy link
Contributor

@Moopli Moopli commented Apr 24, 2023

component/models/:

  • did: afgo's DID and DID Doc models.
  • ld: JSON-LD support - data models, context stores, LD-Proofs, canonicalization, etc.
  • signature: signing APIs used in DID Docs etc.
  • util: utility data models needed for other model implementations, but not specific to a given model.

@codecov
Copy link

codecov bot commented Apr 24, 2023

Codecov Report

Merging #3565 (3d0f089) into main (a8b546e) will decrease coverage by 0.53%.
The diff coverage is 54.03%.

@@            Coverage Diff             @@
##             main    #3565      +/-   ##
==========================================
- Coverage   87.76%   87.24%   -0.53%     
==========================================
  Files         351      353       +2     
  Lines       48627    48671      +44     
==========================================
- Hits        42677    42461     -216     
- Misses       4402     4673     +271     
+ Partials     1548     1537      -11     
Impacted Files Coverage Δ
component/models/did/endpoint/endpoint.go 91.50% <ø> (ø)
component/models/did/helpers.go 54.47% <ø> (ø)
component/models/did/legacy.go 92.94% <ø> (ø)
component/models/did/serialize_default.go 100.00% <ø> (ø)
...ponent/models/ld/context/remote/remote_provider.go 79.48% <ø> (ø)
component/models/ld/proof/utils.go 78.84% <ø> (ø)
component/models/ld/store/context_store.go 87.50% <ø> (ø)
component/models/ld/store/remote_provider_store.go 93.87% <ø> (ø)
...e/suite/bbsblssignature2020/public_key_verifier.go 100.00% <ø> (ø)
...te/bbsblssignatureproof2020/public_key_verifier.go 100.00% <ø> (ø)
... and 39 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Moopli Moopli marked this pull request as ready for review April 24, 2023 23:13
@Moopli
Copy link
Contributor Author

Moopli commented Apr 24, 2023

Note: Since this PR introduces a new component that afgo depends on, it needs a followup that removes the go.mod replace directives (replace github.com/hyperledger/aries-framework-go/component/models => ./component/, etc) and updates imports of component/models to use this PR commit.

@Moopli Moopli force-pushed the did-module branch 2 times, most recently from 6be9993 to ece95a7 Compare April 24, 2023 23:54
@@ -1208,7 +1208,7 @@ func (doc *Doc) MarshalJSON() ([]byte, error) {
}

// VerifyProof verifies document proofs.
func (doc *Doc) VerifyProof(suites []verifier.SignatureSuite, jsonldOpts ...jsonld.ProcessorOpts) error {
func (doc *Doc) VerifyProof(suites []verifier.SignatureSuite, jsonldOpts ...processor.ProcessorOpts) error {
Copy link
Contributor

@DRK3 DRK3 Apr 25, 2023

Choose a reason for hiding this comment

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

I would suggest renaming ProcessorOpts to just Opts to avoid the repetition

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

"github.com/hyperledger/aries-framework-go/spi/storage"
)

// MockContextStore is a mock JSON-LD context store.
type MockContextStore struct {
type MockContextStore struct { // nolint:golint
Copy link
Contributor

Choose a reason for hiding this comment

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

Reason for the nolint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for the name stuttering, but I've now fixed the stuttering instead.

"github.com/hyperledger/aries-framework-go/pkg/doc/signature/jsonld"
"github.com/hyperledger/aries-framework-go/pkg/internal/ldtestutil"
ldcontext "github.com/hyperledger/aries-framework-go/component/models/ld/context"
"github.com/hyperledger/aries-framework-go/component/models/ld/ldtestutil"
Copy link
Contributor

Choose a reason for hiding this comment

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

since ldtestutil is under ld, you can change ldtestutil to simply testutil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

Copy link
Contributor

Choose a reason for hiding this comment

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

The package name is still jsonld - it should be changed to processor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

Copy link
Contributor

@DRK3 DRK3 left a comment

Choose a reason for hiding this comment

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

See my comments

Copy link
Contributor

Choose a reason for hiding this comment

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

Package name needs to be updated to avoid weirdness when importing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done!

@DRK3
Copy link
Contributor

DRK3 commented Apr 25, 2023

Something else I'm wondering: do we really need individual packages for all the various pieces under component/models/ld? If they're all related, is there a reason to require a caller to import multiple packages? Will anyone need to import one of them but not the other? etc

Copy link
Contributor

@DRK3 DRK3 Apr 25, 2023

Choose a reason for hiding this comment

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

Package name should be store instead of ld now. Also, with that in mind - ContextStore should then be simplified to avoid repetition. But as I'm writing this, I'm seeing some weirdness with trying to come up with an appropriate name - should this just be merged in along with the other ld stuff into a single ld package? Then you could have things like ld.ContextStore, ld.DocumentLoader instead of store.ContextStore, documentloader.Loader, etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed!

@Moopli Moopli force-pushed the did-module branch 3 times, most recently from 3543558 to 7248c9a Compare April 25, 2023 16:45
@rolsonquadras rolsonquadras requested a review from DRK3 April 25, 2023 16:55
@Moopli
Copy link
Contributor Author

Moopli commented Apr 25, 2023

If they're all related, is there a reason to require a caller to import multiple packages? Will anyone need to import one of them but not the other?

Hmm so, testutil definitely needs to be separate, and usually only context is imported together with other ld/ packages, so I'm not sure what it gains, while at least right now there's a clear separation of functionality.

@Moopli Moopli force-pushed the did-module branch 2 times, most recently from 6b37f93 to d5b1156 Compare April 25, 2023 18:19
@Moopli Moopli force-pushed the did-module branch 3 times, most recently from 6b98ea7 to fd1f3cc Compare April 25, 2023 18:59
* perf: remove extra parsing

* fix: lint

* perf: avoid one more perse
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

7 participants