sicpa-dlab / didcomm-rust

Apache License 2.0
28 stars 20 forks source link

Types for TS is not following standards, specifically DIDDoc #91

Closed vongohren closed 1 year ago

vongohren commented 1 year ago

What

Give a brief description of the objective of this issue. What needs to be discussed? The current produced types for TS is not following standards of the spec. I just touched upon the DIDDoc type and that has false things such as:

    /**
     * DID for the given DID Doc
     */
    did: string,

This should be id - https://www.w3.org/TR/did-core/#did-document-properties

    /**
     * DID URLs of verification methods used for key agreement.
     * See https://www.w3.org/TR/did-core/#verification-methods.
     */
    key_agreements: Array<string>,

this should be keyAgreements - https://www.w3.org/TR/did-core/#did-document-properties

So I dont know how literal to the spec one should be, but the resolved documents will not be of proper attributes if these types are correct.

Why

Explain why you think this issue needs to be addressed and why it should be addressed in this repo.

Because the produced type is not correct to what a did doc should be if you want to work with other libraries.

Success Criteria

Explain what actions or decisions need to be completed to close this issue.

  • Using a task list here can be helpful to track progress. Update the production of types to produce proper TS types

Anything else

Include links to any examples, research or code that support this issue. I dont know how this works with a wasmbinding and the rust magic, but I assume it transpiles the attribute values in the rust code directly to these names. And then I can understand things become a bit wonky. Maybe one can define in some config somewhere to transpile to the right attributes?

Before submitting:

  • Add appropriate labels for 'type:' and 'related to:'
    • Add an assignee if you want to direct this issue at a particular individual
dkulic commented 1 year ago

Hi all, me and @yvgny are planning to fix this issue. Please be patient, we will do it.

vongohren commented 1 year ago

Great stuff! This is quite bad to use acctually becaues I have to write a "converter" if im going to follow your types.

And I assume your types are important as the data structure further down has to follow this structure.

So its great if the different types are updated to the standard, as did service attribute also seems out of date.

yvgny commented 1 year ago

Hi @vongohren, the main branch is now updated with types aligned to the standards. Let me know if you still find any discrepancies. Once it's stabilized we can issue a new release of the lib too.