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

VDR: Refactor types and didservice packages #2513

Merged
merged 1 commit into from
Sep 27, 2023
Merged

Conversation

reinkrul
Copy link
Member

@reinkrul reinkrul commented Sep 26, 2023

Replaces #2471

Goals of this PR are:

  • Getting rid of the types package, since packages should imply function, not technical contents
  • Getting rid of the didservice package, since it's a dumping place for every "service"-y type that doesn't fit anywhere else. And the same argument as for types applies here as well.
  • Making a clear separation of management (create, update, lower-level stuff) of DIDs owned by the current node and resolving any DID/key/service (regardless whether it's owned by the node or not).

Changes:

  • Removed vdr/didservice/common.go#CompoundService (type alias for map[string]string), was just used in didman.go
  • Removed vdr/didservice/common.go#ErrDIDAlreadyExists (unused)
  • Removed vdr/didservice/test.go (unused)
  • Moved all did-resolving-related types (constants, interfaces, implementations) from vdr/types and vdr/didservice to vdr/resolvers/did.go. The same for keys and services.
  • Renamed vdr/didservice#KeyResolver implementation to DIDKeyResolver (otherwise it clashes with the interface name).
  • Renamed vdr/didservice#ServiceResolver implementation to DIDServiceResolver (otherwise it clashes with the interface name).
  • Moved all DID creation/updating types in vdr/didservice to vdr/management/management.go
  • Moved all DID "finding" types (iterating over Nuts DID store) to vdr/management/finder.go
  • Renamed VDR main struct from VDR to Module, to avoid clash with the interface name (later on, the VDR interface should be renamed as well, since packages shouldn't contain types which starts with the same word or are named the same). We could do this for all module implementations, for consistency.

No functionality or behavior has been changed/removed.

@reinkrul reinkrul changed the title wip VDR: Remove types and didservice packages Sep 26, 2023
@reinkrul reinkrul changed the title VDR: Remove types and didservice packages VDR: Refactor types and didservice packages Sep 26, 2023
@reinkrul reinkrul marked this pull request as ready for review September 26, 2023 09:11
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.

Is there a reason to have a separate management and resolver package?

What happens if you place contents of those packages in the VDR root?

@reinkrul
Copy link
Member Author

reinkrul commented Sep 27, 2023

Is there a reason to have a separate management and resolver package?

Separation of concerns; management is for everything you want to do with your own DIDs, resolver is for resolving any DID (or key, or service) for any DID method. We could dump it in 1 common package, but then we end up with a service package again.

What happens if you place contents of those packages in the VDR root?

Cyclic dependencies with at least network module.

@reinkrul reinkrul merged commit 722e7a1 into master Sep 27, 2023
6 checks passed
@reinkrul reinkrul deleted the refactor-didservice branch September 27, 2023 10:50
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.

2 participants