diff --git a/packages/did/src/DidResolver/DidResolverV2.ts b/packages/did/src/DidResolver/DidResolverV2.ts index ccb901ef5..fea6b0f1c 100644 --- a/packages/did/src/DidResolver/DidResolverV2.ts +++ b/packages/did/src/DidResolver/DidResolverV2.ts @@ -164,7 +164,8 @@ export async function resolve( } } - const { documentMetadata: didDocumentMetadata, document: didDocument } = resolutionResult + const { documentMetadata: didDocumentMetadata, document: didDocument } = + resolutionResult return { didResolutionMetadata: {}, diff --git a/packages/types/src/DidResolverV2.ts b/packages/types/src/DidResolverV2.ts index 8195bd7b4..4ae3bdc2b 100644 --- a/packages/types/src/DidResolverV2.ts +++ b/packages/types/src/DidResolverV2.ts @@ -20,28 +20,19 @@ import type { */ export type ResolutionOptions = Record -/* - * This specification defines the following common error values: - * invalidDid: The DID supplied to the DID resolution function does not conform to valid syntax. - * notFound: The DID resolver was unable to find the DID document resulting from this resolution request. - */ -type ResolutionMetadataError = 'invalidDid' | 'notFound' - -export type SuccessfulResolutionMetadata = Record -export type FailedResolutionMetadata = { +export type ResolutionMetadata = { /* * The error code from the resolution process. * This property is REQUIRED when there is an error in the resolution process. * The value of this property MUST be a single keyword ASCII string. * The possible property values of this field SHOULD be registered in the DID Specification Registries. + * This specification defines the following common error values: + * invalidDid: The DID supplied to the DID resolution function does not conform to valid syntax. + * notFound: The DID resolver was unable to find the DID document resulting from this resolution request. */ - error: ResolutionMetadataError + error?: 'invalidDid' | 'notFound' } -export type ResolutionMetadata = - | SuccessfulResolutionMetadata - | FailedResolutionMetadata - export type ResolutionDocumentMetadata = { /* * If a DID has been deactivated, DID document metadata MUST include this property with the boolean value true. @@ -92,17 +83,6 @@ export type RepresentationResolutionOptions = { accept?: Accept } -/* - * This specification defines the following common error values: - * invalidDid: The DID supplied to the DID resolution function does not conform to valid syntax. - * notFound: The DID resolver was unable to find the DID document resulting from this resolution request. - * representationNotSupported: This error code is returned if the representation requested via the accept input metadata property is not supported by the DID method and/or DID resolver implementation. - */ -type RepresentationResolutionMetadataError = - | 'invalidDid' - | 'notFound' - | 'representationNotSupported' - export type SuccessfulRepresentationResolutionMetadata< ContentType extends string > = { @@ -121,10 +101,15 @@ export type FailedRepresentationResolutionMetadata = { * This property is REQUIRED when there is an error in the resolution process. * The value of this property MUST be a single keyword ASCII string. * The possible property values of this field SHOULD be registered in the DID Specification Registries. + * This specification defines the following common error values: + * invalidDid: The DID supplied to the DID resolution function does not conform to valid syntax. + * notFound: The DID resolver was unable to find the DID document resulting from this resolution request. + * representationNotSupported: This error code is returned if the representation requested via the accept input metadata property is not supported by the DID method and/or DID resolver implementation. */ - error: RepresentationResolutionMetadataError + error: 'invalidDid' | 'notFound' | 'representationNotSupported' } +// Either success with `contentType` or failure with `error` export type RepresentationResolutionMetadata = | SuccessfulRepresentationResolutionMetadata | FailedRepresentationResolutionMetadata @@ -185,13 +170,6 @@ export type DereferenceOptions = { accept?: Accept } -/* - * This specification defines the following common error values: - * invalidDidUrl: The DID URL supplied to the DID URL dereferencing function does not conform to valid syntax. (See 3.2 DID URL Syntax.) - * notFound: The DID URL dereferencer was unable to find the contentStream resulting from this dereferencing request. - */ -type DereferenceMetadataError = 'invalidDidUrl' | 'notFound' - export type SuccessfulDereferenceMetadata = { /* * The Media Type of the returned contentStream SHOULD be expressed using this property if dereferencing is successful. @@ -205,10 +183,14 @@ export type FailedDereferenceMetadata = { * This property is REQUIRED when there is an error in the dereferencing process. * The value of this property MUST be a single keyword expressed as an ASCII string. * The possible property values of this field SHOULD be registered in the DID Specification Registries [DID-SPEC-REGISTRIES]. + * This specification defines the following common error values: + * invalidDidUrl: The DID URL supplied to the DID URL dereferencing function does not conform to valid syntax. (See 3.2 DID URL Syntax.) + * notFound: The DID URL dereferencer was unable to find the contentStream resulting from this dereferencing request. */ - error: DereferenceMetadataError + error: 'invalidDidUrl' | 'notFound' } +// Either success with `contentType` or failure with `error` export type DereferenceMetadata = | SuccessfulDereferenceMetadata | FailedDereferenceMetadata @@ -222,9 +204,7 @@ export type DereferenceContentStream = | JsonLd | Buffer -export type DereferenceContentMetadata = - | ResolutionDocumentMetadata - | Record +export type DereferenceContentMetadata = ResolutionDocumentMetadata export type DereferenceResult = { /*