# DID Resolution Testable Statements
## 1. [OPTIONAL] If the `service` parameter is present, the associated value MUST be an ASCII string.
## 2. [OPTIONAL] If the `serviceType` parameter is present, the associated value MUST be an ASCII string.
## 3. [OPTIONAL] If the `relativeRef` parameter is present, the associated value MUST be an ASCII string and MUST use percent-encoding for certain characters as specified in RFC3986 Section 2.1.
## 4. [OPTIONAL] If the `versionTime` parameter is present, the associated value MUST be an ASCII string which is a valid XML datetime value, as defined in section 3.3.7 of W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes [XMLSCHEMA11-2]
## 5. [OPTIONAL] The datetime value of the `versionTime` parameter MUST be normalized to UTC 00:00:00 and without sub-second decimal precision
## 6. [OPTIONAL] If the `hl` parameter is present, the associated value MUST be an ASCII string.
## 7. All conformant DID resolvers MUST implement the DID resolution function for at least one DID method and MUST be able to return a DID document in at least one conformant representation.
## 8. The `did` input to the resolve function is REQUIRED and the value MUST be a conformant DID as defined in Decentralized Identifiers (DIDs) v1.0.
## 9. The `resolutionOptions` input to the resolve function is REQUIRED, but the structure MAY be empty.
## 10. The `didResolutionMetadata` structure is REQUIRED, and in the case of an error in the resolution process, this MUST NOT be empty.
## 11. If the resolution is not successful, the `didResolutionMetadata` structure MUST contain an error property describing the error
## 12. If the resolution is successful, the `didDocument` MUST be a DID document that is capable of being represented in one of the conformant representations of the Decentralized Identifiers (DIDs) v1.0 specification
## 13. The value of id in the resolved DID document MUST match the DID that was resolved
## 14. If the resolution is unsuccessful, the `didDocument` value MUST be empty.
## 15. If the resolution is successful, the `didDocumentMetadata` MUST be a metadata structure
## 16. If the resolution is unsuccessful, the `didDocumentMetadata` output MUST be an empty metadata structure
## 17. [OPTIONAL] The `accept` Media Type MUST be expressed as an ASCII string
## 18. [OPTIONAL] If the `contentType` property is present in DID Resolution Metadata, the value of this property MUST be an ASCII string that is the Media Type of the conformant representations. In this case, the caller of the resolve function MUST use this value when determining how to parse and process the didDocument.
## 19. [DUPLICATE, 11] The `error` property in the DID Resolution Metadata is REQUIRED when there is an error in the resolution process
## 19. [OPTIONAL] The value of the `created` property in DID Document Metadata MUST be a string formatted as an XML Datetime normalized to UTC 00:00:00 and without sub-second decimal precision
## 20. [OPTIONAL] The value of the `updated` property MUST follow the same formatting rules as the created property
## 21. If a DID has been deactivated, DID document metadata MUST include this property with the boolean value true
## 22. [OPTIONAL] If a DID has not been deactivated, this property is OPTIONAL, but if included, MUST have the boolean value false.
## 23. [OPTIONAL] The value of the `nextUpdate` property MUST follow the same formatting rules as the created property.
## 24. [OPTIONAL] The value of the `versionId` property MUST be an ASCII string.
## 25. [OPTIONAL] If present, the `equivalentId` value MUST be a set where each item is a string that conforms to the rules in Section Decentralized Identifiers (DIDs) v1.0
## 26. [OPTIONAL] Each equivalentId DID value MUST be produced by, and a form of, the same DID method as the id property value
## 27. [OPTIONAL] A conforming DID method specification MUST guarantee that each equivalentId value is logically equivalent to the id property value.
## 28. [OPTIONAL] equivalentId is a much stronger form of equivalence than alsoKnownAs because the equivalence MUST be guaranteed by the governing DID method
## 29. [OPTIONAL] If present, the `canonicalId` value MUST be a string that conforms to the rules in Section Decentralized Identifiers (DIDs) v1.0
## 30. [OPTIONAL] A canonicalId value MUST be produced by, and a form of, the same DID method as the id property value
## 31. [OPTIONAL] A conforming DID method specification MUST guarantee that the canonicalId value is logically equivalent to the id property value.
## 32. [UNTESTABLE?] The following DID resolution algorithm MUST be implemented by a conformant DID resolver.
## 33. If not, the DID resolver MUST return the following result: didResolutionMetadata: error object with type set to INVALID_DID didDocument: null didDocumentMetadata: «[ ]»
## 34. If not, the DID resolver MUST return the following result: didResolutionMetadata: error object with type set to METHOD_NOT_SUPPORTED didDocument: null didDocumentMetadata: «[ ]»
## 35. [UNTESTABLE] Besides the input DID, all additional resolution options of this algorithm MUST be passed to the Read operation of the input DID method.
## 36. This result MUST be represented in a conformant representation that corresponds to the accept input DID resolution option.
## 37. To dereference a DID fragment, the complete DID URL including the DID fragment MUST be used
## 38. The didUrl input is REQUIRED
## 39. The dereferencingOptions structure is REQUIRED, and in the case of an error in the dereferencing process, this MUST NOT be empty
## 40. If the dereferencing is not successful, this structure MUST contain an error property describing the error
## 41. If the dereferencing function was called and successful, this MUST contain a resource corresponding to the DID URL
## 42. If the dereferencing is unsuccessful, this value MUST be empty.
## 43. If the dereferencing is successful, this MUST be a metadata structure, but the structure MAY be empty
## 44. If the contentStream is a DID document, this MUST be a didDocumentMetadata structure as described in DID Resolution
## 45. If the dereferencing is unsuccessful, this output MUST be an empty metadata structure.
## 46. [OPTIONAL] If present, the associated value MUST be an ASCII string
## 47. [OPTIONAL] If the DID URL does not dereference to a verificationMethod, or the DID document does not authorize the verificationMethod for the specified verificationRelationship, then an error MUST be raised.
## 48. [OPTIONAl] The Media Type value MUST be expressed as an ASCII string.
## 49. This property is REQUIRED when there is an error in the dereferencing process
## 50. [UNTESTABLE] The following DID URL dereferencing algorithm MUST be implemented by a conformant DID resolver
## 51. If not, the DID URL dereferencer MUST return the following result: dereferencingMetadata: error object with type set to INVALID_DID_URL contentStream: null contentMetadata: «[ ]»
## 52. All dereferencing options and all DID parameters of the input DID URL MUST be passed as resolution options to the DID Resolution algorithm.
## 53. If the input DID does not exist in the VDR, the DID URL dereferencer MUST return the following result: dereferencingMetadata: error object with type set to NOT_FOUND contentStream: null contentMetadata: «[ ]»
## 54. If the input DID URL contains no DID path and no DID query: Example 3 did:example:1234 The DID URL dereferencer MUST return the resolved DID document and resolved 4.3 DID Document Metadata as follows: dereferencingMetadata: «[ ..
## 55. If the id property or the service DID parameter or both contain relative references, the corresponding absolute URIs MUST be resolved and used for determining the match, using the rules specified in RFC3986 Section 5: Reference Resolution and in section Relative DID URLs in Decentralized Identifiers (DIDs) v1.0.
## 56. If verificationMethod is not a conforming verification method, an error MUST be raised and SHOULD convey an error type of INVALID_VERIFICATION_METHOD.
## 57. If verificationMethod is not associated, either by reference (URL) or by value (object), with the verification relationship array in the output DID document identified by verificationRelationship, an error MUST be raised and SHOULD convey an error type of INVALID_RELATIONSHIP_FOR_VERIFICATION_METHOD.
## 58. The structure used to communicate this metadata MUST be a map of properties
## 59. Each property name MUST be a string
## 60. Each property value MUST be a string, map, list, set, boolean, or null
## 61. The values within any complex data structures such as maps and lists MUST be one of these data types as well
## 62. [UNTESTABLE] All metadata property definitions registered in the DID Specification Registries [DID-SPEC-REGISTRIES] MUST define the value type, including any additional formats or restrictions to that value (for example, a string formatted as a date or as a decimal integer)
## 63. The entire metadata structure MUST be serializable according to the JSON serialization rules in the [INFRA] specification
## 64. A DID resolver MUST support the DID resolution algorithm for at least one DID method and MAY support it for multiple DID methods:
## 65. The type value of the error object MUST be a URL
## 66. Where the values listed in the section below do not define a URL, the values MUST be prepended with the URL https://www.w3.org/ns/did#.
## 67. The input DID MUST be URL-encoded (as specified in RFC3986 Section 2.1).
## 68. The input DID URL MUST be URL-encoded (as specified in RFC3986 Section 2.1).
## 69. If the DID resolution or DID URL dereferencing function returns an error metadata property in the didResolutionMetadata or dereferencingMetadata, then the HTTP response status code MUST correspond to the value of the error metadata property, according to the following table: error HTTP status code INVALID_DID 400 INVALID_DID_URL 400 INVALID_OPTIONS 400 NOT_FOUND 404 REPRESENTATION_NOT_SUPPORTED 406 INVALID_DID_DOCUMENT 500 METHOD_NOT_SUPPORTED 501 INVALID_PUBLIC_KEY 500 INVALID_PUBLIC_KEY_LENGTH 500 INVALID_PUBLIC_KEY_TYPE 500 UNSUPPORTED_PUBLIC_KEY_TYPE 501 INTERNAL_ERROR 500 (any other value) 500
## 70. The HTTP response status code MUST be 410.
## 71. The HTTP body MUST contain a DID resolution result (see 8
## 72. The HTTP response status code MUST be 200.
## 73. The HTTP response MUST contain a Content-Type HTTP response header
## 74. Its value MUST be the value of the contentType metadata property in the didResolutionMetadata (see 4.2 DID Resolution Metadata).
## 75. The HTTP response body MUST contain the didDocument that is the result of the DID resolution function, in the representation corresponding to the Content-Type HTTP response header.
## 76. The HTTP body MUST contain a DID URL dereferencing result (see 9
## 77. The HTTP response status code MUST be 303.
## 78. The HTTP response MUST contain an Location header
## 79. The value of this header MUST be the selected service endpoint URL.
## 80. the HTTP response body MUST be empty.
## 81. Its value MUST be the value of the contentType metadata property in the dereferencingMetadata (see 5.2 DID URL Dereferencing Metadata).
## 82. The HTTP response body MUST contain the contentStream that is the result of the DID URL dereferencing function, in the representation corresponding to the Content-Type HTTP response header.