-
Notifications
You must be signed in to change notification settings - Fork 90
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
[Task] Implement metadata structures #486
Comments
CurrentIn the current codebase, the metadata fields ( The Note that we can deviate from the DID specification w.r.t. the document and resolution metadata representations as long as we can convert/re-arrange fields during the spec-compliant resolution. The on-Tangle representation can also differ if we convert it back during resolution, so there's room to play with the data layouts based on what makes sense for the API. Option 1Introduces two new structs:
Note that Option 2Same as Option 1 except it introduces:
Option 3Same as Option 2 except the resolution fields are split out of Option 4This tries to keep the metadata fields as close to the specification as possible, notably that the This option has the disadvantage of not having a wrapping struct for the Unresolved questions:
|
If keeping the |
I agree that Note that the I think I'm most in favour of |
OptionsI think having a wrapper for document and metadata would be nice to have, for the account at least. That wrapper would be what's cached in storage. Also, for allowing low-level access, it'd be nice to return that wrapper to users, so they can modify document and metadata at the same time. At least in the account, I don't think the So I think I'm slightly in favor of Option 3 over 4, but as long as there is a wrapper for doc + metadata, I think it's fine either way. NamingThe Diff UpdatesAs noted in #462, the If we end up separating document and metadata, then it might be more consistent to keep them separated in the diff message, so they can be deserialized independently. Not a strong opinion. WasmRegarding Wasm bindings: Would it not be possible to return a Rust tuple as an array? I think that's what is typically done for tuple-like return values in JS. I imagine it to be unergonomic to code, though. It also seems fine to have tuple return types in Rust but introduce a wrapper for bindings only. |
I think the Edit: the
I agree. A wrapper also appears necessary since several operations, particularly signing and verification, have to operate over both the document and its metadata now.
I've settled on
It's very awkward since by default a Option 5After more consideration and exploratory code, this is what I'm leaning towards. The separation of the resolution metadata fields seemed unnecessary and just added yet another struct to deal with, hence they are just part of the outer wrapper in this option. This is similar to Option 2 except:
|
Option 6I'm thinking about scrapping the code so far and going with a simpler design where the metadata lives directly in the This would be similar to how the metadata fields exist in the document properties currently, except they would be moved to alongside the Why? Simplicity and ergonomics.
The Disadvantages
It is unclear how this impacts generalising the code for any future method specifications, although that's unclear right now regardless. Please criticise this or raise any issues if you think this will lead to more problems or violate the DID core specification. |
I guess my biggest question is why we need an |
Yes. Those fields technically can be moved but that causes issues with serialization (we can't and shouldn't store those fields on the Tangle because they don't exist when publishing and shouldn't be signed). There needs to be a distinction between what fields are set and stored versus derived from the Tangle messages. For instance we currently have this problem with |
Description
Refactor
IotaDocument
and move the following fields to a newDocumentMetadata
structure as per https://www.w3.org/TR/did-core/#did-document-metadata:previousMessageId
created
updated
proof
(will need to sign the DID Document and its metadata)versionId
(new)deactivated
(new) - optional if we don't want to implement deactivation yetBoth
IotaDocument
and theDocumentMetadata
will be published to the Tangle together, not just the document.Additionally, aResolutionMetadata
structure should be implemented as per https://www.w3.org/TR/did-core/#did-resolution-metadata which holds:messageId
(split this intointegrationMessageId
anddiffMessageId
)contentType
(as per specification)error
(as per specification)Some metadata structures exist inidentity-did
already but they are mostly unused.The spec-compliant resolver has been pushed back for now, so
ResolutionMetadata
will be included in a later issue.Motivation
This change is necessary:
diff
andint
chain message identifiers in a resolved document [Task] Disambiguatemessage_id
inIotaDocument
#361Resources
To-do list
IotaDocumentMetadata
ImplementIotaResolutionMetadata
Change checklist
The text was updated successfully, but these errors were encountered: