-
Notifications
You must be signed in to change notification settings - Fork 87
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
Change document controller type to OneOrSet
#638
Conversation
Add IotaDocument::set_controller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for the changes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice improvement to the code base, but I think the associated from<U>(other: OneOrSet<U>)
method should be refactored before this gets merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes.
Description of change
Allows multiple controllers to be set on a
CoreDocument
using a new genericOneOrSet
collection, which wrapsOrderedSet
.OneOrSet
is similar toOneOrMany
except all entries are unique by key and is guaranteed to be non-empty.This is to comply with the W3C DID specification:
This type change is backwards compatible since a single controller DID will deserialize to
OneOrSetInner::One
.Changed
CoreDocument::controller()
fromOption<&CoreDID>
toOption<&OneOrSet<CoreDID>
.CoreDocument::controller_mut()
fromOption<&mut CoreDID>
to&mut Option<OneOrSet<CoreDID>>
.Added
OneOrSet
collection.IotaDocument::set_controller()
.Links to any relevant issues
See issue #306.
Type of change
How the change has been tested
Added new unit tests to ensure adding and removing document controllers is supported and works with diffs.
Change checklist