Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Sidetree DID Docs are not DID Core Spec Compliant without update or transformation. #137

Open
OR13 opened this issue Jan 10, 2020 · 5 comments

Comments

@OR13
Copy link
Collaborator

OR13 commented Jan 10, 2020

const transformArrays = [
  "assertionMethod",
  "authentication",
  "capabilityDelegation",
  "capabilityInvocation"
];

const transformObjects = ["publicKey", "keyAgreement"];

module.exports = didDocument => {
  const convertedDidDocument = { ...didDocument };

  transformObjects.forEach(property => {
    convertedDidDocument[property].forEach(value => {
      if (value.id[0] === "#") {
        value.id = convertedDidDocument.id + value.id;
      }

      if (!value.controller) {
        value.controller = convertedDidDocument.id;
      }
    });
  });

  transformArrays.forEach(property => {
    convertedDidDocument[property] = convertedDidDocument[property].map(
      value => {
        if (value[0] === "#") {
          return convertedDidDocument.id + value;
        }
        return value;
      }
    );
  });

  return convertedDidDocument;
};

@OR13
Copy link
Collaborator Author

OR13 commented Jan 13, 2020

We should add this transform to the library, since its likely to be needed until a better solution is available.

@gjgd
Copy link
Member

gjgd commented Jan 16, 2020

Since #138 the controller property is added and we have this helper function for adding dids to fragids so I think we can close this

@OR13
Copy link
Collaborator Author

OR13 commented Jan 17, 2020

We should leave this open until fragids are valid according to the did core spec, or we don't use them.

@OR13
Copy link
Collaborator Author

OR13 commented Jan 17, 2020

Linking the sidetree core issue: decentralized-identity/sidetree#368

@OR13
Copy link
Collaborator Author

OR13 commented Jan 17, 2020

Since #138 the controller property is added and we have this helper function for adding dids to fragids so I think we can close this

This helper method is excellent though.

@OR13 OR13 changed the title Sidetree DID Docs must be transformed before they work with Encrypted Data Vaults Sidetree DID Docs are not DID Core Spec Compliant without update or transformation. Jan 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants