diff --git a/README.md b/README.md index 49bdbd89..dcbbdd89 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ## ℹī¸ Overview -DID methods are expected to provide [standards-compliant methods of DID and DID Document ("DIDDoc") production](https://w3c.github.io/did-core/#production-and-consumption). The **cheqd DID Resolver** is designed to implement the [W3C DID *Resolution* specification](https://w3c.github.io/did-resolution/) for [`did:cheqd`](https://docs.cheqd.io/identity/architecture/adr-list/adr-001-cheqd-did-method) method. +DID methods are expected to provide [standards-compliant methods of DID and DID Document ("DIDDoc") production](https://w3c.github.io/did-core/#production-and-consumption). The **cheqd DID Resolver** is designed to implement the [W3C DID _Resolution_ specification](https://w3c.github.io/did-resolution/) for [`did:cheqd`](https://docs.cheqd.io/identity/architecture/adr-list/adr-001-cheqd-did-method) method. ### 📝 Architecture @@ -60,7 +60,7 @@ enable = true address = "0.0.0.0:9090" ``` -**Note**: If you're pointing a DID Resolver to your own node instance, by default `cheqd-node` instance gRPC endpoints are *not* served up with a TLS certificate. This means the `useTls` property would need to be set to `false`, unless you're otherwise using a load balancer that provides TLS connections to the gRPC port. +**Note**: If you're pointing a DID Resolver to your own node instance, by default `cheqd-node` instance gRPC endpoints are _not_ served up with a TLS certificate. This means the `useTls` property would need to be set to `false`, unless you're otherwise using a load balancer that provides TLS connections to the gRPC port. ## 🧑‍đŸ’ģ Building your own Docker image @@ -87,7 +87,7 @@ image: did-resolver:local Make sure you comment out the pre-existing `image` property that pulls in a container image from Github Container Registry, as shown above. -You can also do *just* a build with: +You can also do _just_ a build with: ```bash docker-compose -f docker/docker-compose.yml --env-file docker/docker-compose.env build --no-cache @@ -191,7 +191,7 @@ You can execute the tests as long as you have Ginkgo CLI installed, which target ginkgo -r --tags integration --race --randomize-suites --keep-going --trace ``` -**Note**: By default, the tests target `localhost:8080` as the port where it expects the running DID Resolver instance for testing. If your running instance is at a different address, you can override this by setting a value for the `TEST_HOST_ADDRESS` environment variable *before* executing the Ginkgo test suite. +**Note**: By default, the tests target `localhost:8080` as the port where it expects the running DID Resolver instance for testing. If your running instance is at a different address, you can override this by setting a value for the `TEST_HOST_ADDRESS` environment variable _before_ executing the Ginkgo test suite. ```bash export TEST_HOST_ADDRESS="where.is.did.resolver.running:port" diff --git a/go.mod b/go.mod index f3fa49c7..833c8ce1 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/cheqd/did-resolver go 1.21 -toolchain go1.21.0 +toolchain go1.21.13 require ( github.com/cheqd/cheqd-node/api/v2 v2.2.0 diff --git a/services/diddoc_service.go b/services/diddoc_service.go index c7c61cc6..c28a4d1c 100644 --- a/services/diddoc_service.go +++ b/services/diddoc_service.go @@ -53,6 +53,14 @@ func (dds DIDDocService) Resolve(did string, version string, contentType types.C result := types.DidResolution{Did: &didDoc, Metadata: *resolvedMetadata, ResolutionMetadata: didResolutionMetadata} if didResolutionMetadata.ContentType == types.DIDJSONLD || didResolutionMetadata.ContentType == types.JSONLD { didDoc.AddContext(types.DIDSchemaJSONLD) + + for _, service := range didDoc.Service { + if service.Type == types.LinkedDomains { + didDoc.AddContext(types.LinkedDomainsJSONLD) + break + } + } + for _, method := range didDoc.VerificationMethod { switch method.Type { case "Ed25519VerificationKey2020": @@ -164,7 +172,7 @@ func (dds DIDDocService) DereferenceSecondary(did string, version string, fragme return &result, nil } -func (dds DIDDocService) resolveMetadata(did string, metadata *didTypes.Metadata, contentType types.ContentType) (*types.ResolutionDidDocMetadata, *types.IdentityError) { +func (dds DIDDocService) resolveMetadata(did string, metadata *didTypes.Metadata, _ types.ContentType) (*types.ResolutionDidDocMetadata, *types.IdentityError) { resources, err := dds.ledgerService.QueryCollectionResources(did) if err != nil { return nil, err diff --git a/tests/constants/common.go b/tests/constants/common.go index d8bca6a8..6715fcd4 100644 --- a/tests/constants/common.go +++ b/tests/constants/common.go @@ -7,6 +7,7 @@ import ( didTypes "github.com/cheqd/cheqd-node/api/v2/cheqd/did/v2" resourceTypes "github.com/cheqd/cheqd-node/api/v2/cheqd/resource/v2" + "github.com/cheqd/did-resolver/types" "google.golang.org/protobuf/types/known/timestamppb" ) @@ -22,7 +23,7 @@ func generateVerificationMethod() didTypes.VerificationMethod { func generateService() didTypes.Service { return didTypes.Service{ Id: ExistentDid + "#" + ValidServiceId, - ServiceType: "DIDCommMessaging", + ServiceType: types.LinkedDomains, ServiceEndpoint: []string{"http://example.com"}, } } diff --git a/tests/integration/rest/testdata/diddoc/diddoc_indy_mainnet_did.json b/tests/integration/rest/testdata/diddoc/diddoc_indy_mainnet_did.json index bd62ee39..7c44488a 100644 --- a/tests/integration/rest/testdata/diddoc/diddoc_indy_mainnet_did.json +++ b/tests/integration/rest/testdata/diddoc/diddoc_indy_mainnet_did.json @@ -12,6 +12,7 @@ "didDocument": { "@context": [ "https://www.w3.org/ns/did/v1", + "https://identity.foundation/.well-known/did-configuration/v1", "https://w3id.org/security/suites/ed25519-2020/v1" ], "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", @@ -23,16 +24,12 @@ "publicKeyMultibase": "z6Mkta7joRuvDh7UnoESdgpr9dDUMh5LvdoECDi3WGrJoscA" } ], - "authentication": [ - "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#key1" - ], + "authentication": ["did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#key1"], "service": [ { "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#website", "type": "LinkedDomains", - "serviceEndpoint": [ - "https://www.cheqd.io" - ] + "serviceEndpoint": ["https://www.cheqd.io"] }, { "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#non-fungible-image", @@ -44,16 +41,12 @@ { "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#twitter", "type": "LinkedDomains", - "serviceEndpoint": [ - "https://twitter.com/cheqd_io" - ] + "serviceEndpoint": ["https://twitter.com/cheqd_io"] }, { "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#linkedin", "type": "LinkedDomains", - "serviceEndpoint": [ - "https://www.linkedin.com/company/cheqd-identity/" - ] + "serviceEndpoint": ["https://www.linkedin.com/company/cheqd-identity/"] } ] }, diff --git a/tests/integration/rest/testdata/diddoc/diddoc_uuid_testnet_several_versions.json b/tests/integration/rest/testdata/diddoc/diddoc_uuid_testnet_several_versions.json index 383104b3..66d4e8dc 100644 --- a/tests/integration/rest/testdata/diddoc/diddoc_uuid_testnet_several_versions.json +++ b/tests/integration/rest/testdata/diddoc/diddoc_uuid_testnet_several_versions.json @@ -1,61 +1,60 @@ { - "@context": "https://w3id.org/did-resolution/v1", - "didResolutionMetadata": { - "contentType": "application/did+ld+json", - "retrieved": "2023-04-12T14:51:09Z", - "did": { - "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "method": "cheqd" - } - }, - "didDocument": { - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3id.org/security/suites/ed25519-2018/v1" - ], - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "verificationMethod": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", - "type": "Ed25519VerificationKey2018", - "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "publicKeyBase58": "BpVGbTeT26LipAdk26DBZrmJx2939i9gZS5VxGt1zZQ6" - } - ], - "authentication": [ - "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" - ], - "service": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://bar.example.com" - ] - } - ] - }, - "didDocumentMetadata": { - "created": "2023-03-06T09:36:55Z", - "updated": "2023-03-06T09:59:22Z", - "deactivated": true, - "versionId": "f790c9b9-4817-4b31-be43-b198e6e18071", - "previousVersionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", - "linkedResourceMetadata": [ - { - "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceName": "TestResource", - "resourceType": "TestType", - "mediaType": "text/plain; charset=utf-8", - "created": "2023-03-06T09:53:44Z", - "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - "previousVersionId": null, - "nextVersionId": null, - "resourceVersion": "1.0" - } - ] + "@context": "https://w3id.org/did-resolution/v1", + "didResolutionMetadata": { + "contentType": "application/did+ld+json", + "retrieved": "2023-04-12T14:51:09Z", + "did": { + "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "method": "cheqd" } -} \ No newline at end of file + }, + "didDocument": { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://identity.foundation/.well-known/did-configuration/v1", + "https://w3id.org/security/suites/ed25519-2018/v1" + ], + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "verificationMethod": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", + "type": "Ed25519VerificationKey2018", + "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "publicKeyBase58": "BpVGbTeT26LipAdk26DBZrmJx2939i9gZS5VxGt1zZQ6" + } + ], + "authentication": [ + "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" + ], + "service": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", + "type": "LinkedDomains", + "serviceEndpoint": ["https://bar.example.com"] + } + ] + }, + "didDocumentMetadata": { + "created": "2023-03-06T09:36:55Z", + "updated": "2023-03-06T09:59:22Z", + "deactivated": true, + "versionId": "f790c9b9-4817-4b31-be43-b198e6e18071", + "previousVersionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", + "linkedResourceMetadata": [ + { + "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceName": "TestResource", + "resourceType": "TestType", + "mediaType": "text/plain; charset=utf-8", + "created": "2023-03-06T09:53:44Z", + "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + "previousVersionId": null, + "nextVersionId": null, + "resourceVersion": "1.0" + } + ] + } +} diff --git a/tests/integration/rest/testdata/diddoc/diddoc_uuid_testnet_several_versions_between.json b/tests/integration/rest/testdata/diddoc/diddoc_uuid_testnet_several_versions_between.json index 7e81d0ec..c29f7433 100644 --- a/tests/integration/rest/testdata/diddoc/diddoc_uuid_testnet_several_versions_between.json +++ b/tests/integration/rest/testdata/diddoc/diddoc_uuid_testnet_several_versions_between.json @@ -1,62 +1,61 @@ { - "@context": "https://w3id.org/did-resolution/v1", - "didResolutionMetadata": { - "contentType": "application/did+ld+json", - "retrieved": "2023-04-12T15:00:53Z", - "did": { - "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "method": "cheqd" - } - }, - "didDocument": { - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3id.org/security/suites/ed25519-2018/v1" - ], - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "verificationMethod": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", - "type": "Ed25519VerificationKey2018", - "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "publicKeyBase58": "BpVGbTeT26LipAdk26DBZrmJx2939i9gZS5VxGt1zZQ6" - } - ], - "authentication": [ - "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" - ], - "service": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://bar.example.com" - ] - } - ] - }, - "didDocumentMetadata": { - "created": "2023-03-06T09:36:55Z", - "updated": "2023-03-06T09:39:48Z", - "deactivated": true, - "versionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", - "nextVersionId": "f790c9b9-4817-4b31-be43-b198e6e18071", - "previousVersionId": "0ce23d04-5b67-4ea6-a315-788588e53f4e", - "linkedResourceMetadata": [ - { - "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceName": "TestResource", - "resourceType": "TestType", - "mediaType": "text/plain; charset=utf-8", - "created": "2023-03-06T09:53:44Z", - "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - "previousVersionId": null, - "nextVersionId": null, - "resourceVersion": "1.0" - } - ] + "@context": "https://w3id.org/did-resolution/v1", + "didResolutionMetadata": { + "contentType": "application/did+ld+json", + "retrieved": "2023-04-12T15:00:53Z", + "did": { + "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "method": "cheqd" } -} \ No newline at end of file + }, + "didDocument": { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://identity.foundation/.well-known/did-configuration/v1", + "https://w3id.org/security/suites/ed25519-2018/v1" + ], + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "verificationMethod": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", + "type": "Ed25519VerificationKey2018", + "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "publicKeyBase58": "BpVGbTeT26LipAdk26DBZrmJx2939i9gZS5VxGt1zZQ6" + } + ], + "authentication": [ + "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" + ], + "service": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", + "type": "LinkedDomains", + "serviceEndpoint": ["https://bar.example.com"] + } + ] + }, + "didDocumentMetadata": { + "created": "2023-03-06T09:36:55Z", + "updated": "2023-03-06T09:39:48Z", + "deactivated": true, + "versionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", + "nextVersionId": "f790c9b9-4817-4b31-be43-b198e6e18071", + "previousVersionId": "0ce23d04-5b67-4ea6-a315-788588e53f4e", + "linkedResourceMetadata": [ + { + "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceName": "TestResource", + "resourceType": "TestType", + "mediaType": "text/plain; charset=utf-8", + "created": "2023-03-06T09:53:44Z", + "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + "previousVersionId": null, + "nextVersionId": null, + "resourceVersion": "1.0" + } + ] + } +} diff --git a/tests/integration/rest/testdata/diddoc_version/diddoc_version_indy_mainnet_did.json b/tests/integration/rest/testdata/diddoc_version/diddoc_version_indy_mainnet_did.json index fe41c019..67e5e1a8 100644 --- a/tests/integration/rest/testdata/diddoc_version/diddoc_version_indy_mainnet_did.json +++ b/tests/integration/rest/testdata/diddoc_version/diddoc_version_indy_mainnet_did.json @@ -1,64 +1,57 @@ { - "@context": "https://w3id.org/did-resolution/v1", - "didResolutionMetadata": { - "contentType": "application/did+ld+json", - "retrieved": "2023-03-24T12:50:08Z", - "did": { - "didString": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", - "methodSpecificId": "Ps1ysXP2Ae6GBfxNhNQNKN", - "method": "cheqd" - } - }, - "didDocument": { - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3id.org/security/suites/ed25519-2020/v1" - ], - "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", - "verificationMethod": [ - { - "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#key1", - "type": "Ed25519VerificationKey2020", - "controller": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", - "publicKeyMultibase": "z6Mkta7joRuvDh7UnoESdgpr9dDUMh5LvdoECDi3WGrJoscA" - } - ], - "authentication": [ - "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#key1" - ], - "service": [ - { - "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#website", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://www.cheqd.io" - ] - }, - { - "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#non-fungible-image", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://gateway.ipfs.io/ipfs/bafybeihetj2ng3d74k7t754atv2s5dk76pcqtvxls6dntef3xa6rax25xe" - ] - }, - { - "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#twitter", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://twitter.com/cheqd_io" - ] - }, - { - "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#linkedin", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://www.linkedin.com/company/cheqd-identity/" - ] - } - ] - }, - "didDocumentMetadata": { - "created": "2022-04-05T11:49:19Z", - "versionId": "4fa8e367-c70e-533e-babf-3732d9761061" + "@context": "https://w3id.org/did-resolution/v1", + "didResolutionMetadata": { + "contentType": "application/did+ld+json", + "retrieved": "2023-03-24T12:50:08Z", + "did": { + "didString": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", + "methodSpecificId": "Ps1ysXP2Ae6GBfxNhNQNKN", + "method": "cheqd" } + }, + "didDocument": { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://identity.foundation/.well-known/did-configuration/v1", + "https://w3id.org/security/suites/ed25519-2020/v1" + ], + "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", + "verificationMethod": [ + { + "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#key1", + "type": "Ed25519VerificationKey2020", + "controller": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", + "publicKeyMultibase": "z6Mkta7joRuvDh7UnoESdgpr9dDUMh5LvdoECDi3WGrJoscA" + } + ], + "authentication": ["did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#key1"], + "service": [ + { + "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#website", + "type": "LinkedDomains", + "serviceEndpoint": ["https://www.cheqd.io"] + }, + { + "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#non-fungible-image", + "type": "LinkedDomains", + "serviceEndpoint": [ + "https://gateway.ipfs.io/ipfs/bafybeihetj2ng3d74k7t754atv2s5dk76pcqtvxls6dntef3xa6rax25xe" + ] + }, + { + "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#twitter", + "type": "LinkedDomains", + "serviceEndpoint": ["https://twitter.com/cheqd_io"] + }, + { + "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#linkedin", + "type": "LinkedDomains", + "serviceEndpoint": ["https://www.linkedin.com/company/cheqd-identity/"] + } + ] + }, + "didDocumentMetadata": { + "created": "2022-04-05T11:49:19Z", + "versionId": "4fa8e367-c70e-533e-babf-3732d9761061" + } } diff --git a/tests/integration/rest/testdata/query/diddoc_common/version_id/transform_key.json b/tests/integration/rest/testdata/query/diddoc_common/version_id/transform_key.json index 9d9dea2e..434df5a2 100644 --- a/tests/integration/rest/testdata/query/diddoc_common/version_id/transform_key.json +++ b/tests/integration/rest/testdata/query/diddoc_common/version_id/transform_key.json @@ -1,66 +1,65 @@ { - "@context": "https://w3id.org/did-resolution/v1", - "didResolutionMetadata": { - "contentType": "application/did+ld+json", - "retrieved": "2023-04-25T09:30:18Z", - "did": { - "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "method": "cheqd" - } - }, - "didDocument": { - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3id.org/security/suites/ed25519-2018/v1" - ], - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "verificationMethod": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", - "type": "JsonWebKey2020", - "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "publicKeyJwk": { - "crv": "Ed25519", - "kty": "OKP", - "x": "oL8hiQFXJqrR7ZBRrw7KcvBtGwk12U9TOPrqsJjaIsM" - } - } - ], - "authentication": [ - "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" - ], - "service": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://bar.example.com" - ] - } - ] - }, - "didDocumentMetadata": { - "created": "2023-03-06T09:36:55Z", - "updated": "2023-03-06T09:39:48Z", - "deactivated": true, - "versionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", - "nextVersionId": "f790c9b9-4817-4b31-be43-b198e6e18071", - "previousVersionId": "0ce23d04-5b67-4ea6-a315-788588e53f4e", - "linkedResourceMetadata": [ - { - "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceName": "TestResource", - "resourceType": "TestType", - "mediaType": "text/plain; charset=utf-8", - "resourceVersion": "1.0", - "created": "2023-03-06T09:53:44Z", - "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - "previousVersionId": null, - "nextVersionId": null - } - ] + "@context": "https://w3id.org/did-resolution/v1", + "didResolutionMetadata": { + "contentType": "application/did+ld+json", + "retrieved": "2023-04-25T09:30:18Z", + "did": { + "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "method": "cheqd" } + }, + "didDocument": { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://identity.foundation/.well-known/did-configuration/v1", + "https://w3id.org/security/suites/ed25519-2018/v1" + ], + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "verificationMethod": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", + "type": "JsonWebKey2020", + "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "publicKeyJwk": { + "crv": "Ed25519", + "kty": "OKP", + "x": "oL8hiQFXJqrR7ZBRrw7KcvBtGwk12U9TOPrqsJjaIsM" + } + } + ], + "authentication": [ + "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" + ], + "service": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", + "type": "LinkedDomains", + "serviceEndpoint": ["https://bar.example.com"] + } + ] + }, + "didDocumentMetadata": { + "created": "2023-03-06T09:36:55Z", + "updated": "2023-03-06T09:39:48Z", + "deactivated": true, + "versionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", + "nextVersionId": "f790c9b9-4817-4b31-be43-b198e6e18071", + "previousVersionId": "0ce23d04-5b67-4ea6-a315-788588e53f4e", + "linkedResourceMetadata": [ + { + "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceName": "TestResource", + "resourceType": "TestType", + "mediaType": "text/plain; charset=utf-8", + "resourceVersion": "1.0", + "created": "2023-03-06T09:53:44Z", + "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + "previousVersionId": null, + "nextVersionId": null + } + ] + } } diff --git a/tests/integration/rest/testdata/query/diddoc_common/version_id/version_time.json b/tests/integration/rest/testdata/query/diddoc_common/version_id/version_time.json index 09c62f3e..2701480e 100644 --- a/tests/integration/rest/testdata/query/diddoc_common/version_id/version_time.json +++ b/tests/integration/rest/testdata/query/diddoc_common/version_id/version_time.json @@ -1,62 +1,61 @@ { - "@context": "https://w3id.org/did-resolution/v1", - "didResolutionMetadata": { - "contentType": "application/did+ld+json", - "retrieved": "2023-04-25T09:29:12Z", - "did": { - "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "method": "cheqd" - } - }, - "didDocument": { - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3id.org/security/suites/ed25519-2018/v1" - ], - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "verificationMethod": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", - "type": "Ed25519VerificationKey2018", - "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "publicKeyBase58": "BpVGbTeT26LipAdk26DBZrmJx2939i9gZS5VxGt1zZQ6" - } - ], - "authentication": [ - "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" - ], - "service": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://bar.example.com" - ] - } - ] - }, - "didDocumentMetadata": { - "created": "2023-03-06T09:36:55Z", - "updated": "2023-03-06T09:39:48Z", - "deactivated": true, - "versionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", - "nextVersionId": "f790c9b9-4817-4b31-be43-b198e6e18071", - "previousVersionId": "0ce23d04-5b67-4ea6-a315-788588e53f4e", - "linkedResourceMetadata": [ - { - "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceName": "TestResource", - "resourceType": "TestType", - "mediaType": "text/plain; charset=utf-8", - "resourceVersion": "1.0", - "created": "2023-03-06T09:53:44Z", - "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - "previousVersionId": null, - "nextVersionId": null - } - ] + "@context": "https://w3id.org/did-resolution/v1", + "didResolutionMetadata": { + "contentType": "application/did+ld+json", + "retrieved": "2023-04-25T09:29:12Z", + "did": { + "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "method": "cheqd" } + }, + "didDocument": { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://identity.foundation/.well-known/did-configuration/v1", + "https://w3id.org/security/suites/ed25519-2018/v1" + ], + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "verificationMethod": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", + "type": "Ed25519VerificationKey2018", + "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "publicKeyBase58": "BpVGbTeT26LipAdk26DBZrmJx2939i9gZS5VxGt1zZQ6" + } + ], + "authentication": [ + "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" + ], + "service": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", + "type": "LinkedDomains", + "serviceEndpoint": ["https://bar.example.com"] + } + ] + }, + "didDocumentMetadata": { + "created": "2023-03-06T09:36:55Z", + "updated": "2023-03-06T09:39:48Z", + "deactivated": true, + "versionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", + "nextVersionId": "f790c9b9-4817-4b31-be43-b198e6e18071", + "previousVersionId": "0ce23d04-5b67-4ea6-a315-788588e53f4e", + "linkedResourceMetadata": [ + { + "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceName": "TestResource", + "resourceType": "TestType", + "mediaType": "text/plain; charset=utf-8", + "resourceVersion": "1.0", + "created": "2023-03-06T09:53:44Z", + "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + "previousVersionId": null, + "nextVersionId": null + } + ] + } } diff --git a/tests/integration/rest/testdata/query/diddoc_common/version_id/version_time_&_transform_key.json b/tests/integration/rest/testdata/query/diddoc_common/version_id/version_time_&_transform_key.json index 14bbf9f2..9eed0794 100644 --- a/tests/integration/rest/testdata/query/diddoc_common/version_id/version_time_&_transform_key.json +++ b/tests/integration/rest/testdata/query/diddoc_common/version_id/version_time_&_transform_key.json @@ -1,62 +1,61 @@ { - "@context": "https://w3id.org/did-resolution/v1", - "didResolutionMetadata": { - "contentType": "application/did+ld+json", - "retrieved": "2023-04-25T09:35:05Z", - "did": { - "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "method": "cheqd" - } - }, - "didDocument": { - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3id.org/security/suites/ed25519-2018/v1" - ], - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "verificationMethod": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", - "type": "Ed25519VerificationKey2020", - "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "publicKeyMultibase": "z6MkqGkKBhttMdqBvfUShfB2QxKJmbQtZbQ3FSzRnYr2unBU" - } - ], - "authentication": [ - "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" - ], - "service": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://bar.example.com" - ] - } - ] - }, - "didDocumentMetadata": { - "created": "2023-03-06T09:36:55Z", - "updated": "2023-03-06T09:39:48Z", - "deactivated": true, - "versionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", - "nextVersionId": "f790c9b9-4817-4b31-be43-b198e6e18071", - "previousVersionId": "0ce23d04-5b67-4ea6-a315-788588e53f4e", - "linkedResourceMetadata": [ - { - "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceName": "TestResource", - "resourceType": "TestType", - "mediaType": "text/plain; charset=utf-8", - "resourceVersion": "1.0", - "created": "2023-03-06T09:53:44Z", - "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - "previousVersionId": null, - "nextVersionId": null - } - ] + "@context": "https://w3id.org/did-resolution/v1", + "didResolutionMetadata": { + "contentType": "application/did+ld+json", + "retrieved": "2023-04-25T09:35:05Z", + "did": { + "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "method": "cheqd" } + }, + "didDocument": { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://identity.foundation/.well-known/did-configuration/v1", + "https://w3id.org/security/suites/ed25519-2018/v1" + ], + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "verificationMethod": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", + "type": "Ed25519VerificationKey2020", + "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "publicKeyMultibase": "z6MkqGkKBhttMdqBvfUShfB2QxKJmbQtZbQ3FSzRnYr2unBU" + } + ], + "authentication": [ + "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" + ], + "service": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", + "type": "LinkedDomains", + "serviceEndpoint": ["https://bar.example.com"] + } + ] + }, + "didDocumentMetadata": { + "created": "2023-03-06T09:36:55Z", + "updated": "2023-03-06T09:39:48Z", + "deactivated": true, + "versionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", + "nextVersionId": "f790c9b9-4817-4b31-be43-b198e6e18071", + "previousVersionId": "0ce23d04-5b67-4ea6-a315-788588e53f4e", + "linkedResourceMetadata": [ + { + "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceName": "TestResource", + "resourceType": "TestType", + "mediaType": "text/plain; charset=utf-8", + "resourceVersion": "1.0", + "created": "2023-03-06T09:53:44Z", + "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + "previousVersionId": null, + "nextVersionId": null + } + ] + } } diff --git a/tests/integration/rest/testdata/query/metadata/diddoc_did.json b/tests/integration/rest/testdata/query/metadata/diddoc_did.json index 42437e74..5aba64eb 100644 --- a/tests/integration/rest/testdata/query/metadata/diddoc_did.json +++ b/tests/integration/rest/testdata/query/metadata/diddoc_did.json @@ -1,64 +1,57 @@ { - "@context": "https://w3id.org/did-resolution/v1", - "didResolutionMetadata": { - "contentType": "application/did+ld+json", - "retrieved": "2023-06-15T08:10:37Z", - "did": { - "didString": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", - "methodSpecificId": "Ps1ysXP2Ae6GBfxNhNQNKN", - "method": "cheqd" - } - }, - "didDocument": { - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3id.org/security/suites/ed25519-2020/v1" - ], - "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", - "verificationMethod": [ - { - "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#key1", - "type": "Ed25519VerificationKey2020", - "controller": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", - "publicKeyMultibase": "z6Mkta7joRuvDh7UnoESdgpr9dDUMh5LvdoECDi3WGrJoscA" - } - ], - "authentication": [ - "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#key1" - ], - "service": [ - { - "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#website", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://www.cheqd.io" - ] - }, - { - "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#non-fungible-image", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://gateway.ipfs.io/ipfs/bafybeihetj2ng3d74k7t754atv2s5dk76pcqtvxls6dntef3xa6rax25xe" - ] - }, - { - "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#twitter", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://twitter.com/cheqd_io" - ] - }, - { - "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#linkedin", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://www.linkedin.com/company/cheqd-identity/" - ] - } - ] - }, - "didDocumentMetadata": { - "created": "2022-04-05T11:49:19Z", - "versionId": "4fa8e367-c70e-533e-babf-3732d9761061" + "@context": "https://w3id.org/did-resolution/v1", + "didResolutionMetadata": { + "contentType": "application/did+ld+json", + "retrieved": "2023-06-15T08:10:37Z", + "did": { + "didString": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", + "methodSpecificId": "Ps1ysXP2Ae6GBfxNhNQNKN", + "method": "cheqd" } + }, + "didDocument": { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://identity.foundation/.well-known/did-configuration/v1", + "https://w3id.org/security/suites/ed25519-2020/v1" + ], + "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", + "verificationMethod": [ + { + "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#key1", + "type": "Ed25519VerificationKey2020", + "controller": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN", + "publicKeyMultibase": "z6Mkta7joRuvDh7UnoESdgpr9dDUMh5LvdoECDi3WGrJoscA" + } + ], + "authentication": ["did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#key1"], + "service": [ + { + "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#website", + "type": "LinkedDomains", + "serviceEndpoint": ["https://www.cheqd.io"] + }, + { + "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#non-fungible-image", + "type": "LinkedDomains", + "serviceEndpoint": [ + "https://gateway.ipfs.io/ipfs/bafybeihetj2ng3d74k7t754atv2s5dk76pcqtvxls6dntef3xa6rax25xe" + ] + }, + { + "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#twitter", + "type": "LinkedDomains", + "serviceEndpoint": ["https://twitter.com/cheqd_io"] + }, + { + "id": "did:cheqd:mainnet:Ps1ysXP2Ae6GBfxNhNQNKN#linkedin", + "type": "LinkedDomains", + "serviceEndpoint": ["https://www.linkedin.com/company/cheqd-identity/"] + } + ] + }, + "didDocumentMetadata": { + "created": "2022-04-05T11:49:19Z", + "versionId": "4fa8e367-c70e-533e-babf-3732d9761061" + } } diff --git a/tests/integration/rest/testdata/query/version_time/diddoc_version_time_date_did.json b/tests/integration/rest/testdata/query/version_time/diddoc_version_time_date_did.json index 11d3ae6d..58c379b1 100644 --- a/tests/integration/rest/testdata/query/version_time/diddoc_version_time_date_did.json +++ b/tests/integration/rest/testdata/query/version_time/diddoc_version_time_date_did.json @@ -1,61 +1,60 @@ { - "@context": "https://w3id.org/did-resolution/v1", - "didResolutionMetadata": { - "contentType": "application/did+ld+json", - "retrieved": "2023-04-24T10:48:50Z", - "did": { - "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "method": "cheqd" - } - }, - "didDocument": { - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3id.org/security/suites/ed25519-2018/v1" - ], - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "verificationMethod": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", - "type": "Ed25519VerificationKey2018", - "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "publicKeyBase58": "BpVGbTeT26LipAdk26DBZrmJx2939i9gZS5VxGt1zZQ6" - } - ], - "authentication": [ - "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" - ], - "service": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://bar.example.com" - ] - } - ] - }, - "didDocumentMetadata": { - "created": "2023-03-06T09:36:55Z", - "updated": "2023-03-06T09:59:22Z", - "deactivated": true, - "versionId": "f790c9b9-4817-4b31-be43-b198e6e18071", - "previousVersionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", - "linkedResourceMetadata": [ - { - "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceName": "TestResource", - "resourceType": "TestType", - "mediaType": "text/plain; charset=utf-8", - "resourceVersion": "1.0", - "created": "2023-03-06T09:53:44Z", - "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - "previousVersionId": null, - "nextVersionId": null - } - ] + "@context": "https://w3id.org/did-resolution/v1", + "didResolutionMetadata": { + "contentType": "application/did+ld+json", + "retrieved": "2023-04-24T10:48:50Z", + "did": { + "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "method": "cheqd" } + }, + "didDocument": { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://identity.foundation/.well-known/did-configuration/v1", + "https://w3id.org/security/suites/ed25519-2018/v1" + ], + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "verificationMethod": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", + "type": "Ed25519VerificationKey2018", + "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "publicKeyBase58": "BpVGbTeT26LipAdk26DBZrmJx2939i9gZS5VxGt1zZQ6" + } + ], + "authentication": [ + "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" + ], + "service": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", + "type": "LinkedDomains", + "serviceEndpoint": ["https://bar.example.com"] + } + ] + }, + "didDocumentMetadata": { + "created": "2023-03-06T09:36:55Z", + "updated": "2023-03-06T09:59:22Z", + "deactivated": true, + "versionId": "f790c9b9-4817-4b31-be43-b198e6e18071", + "previousVersionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", + "linkedResourceMetadata": [ + { + "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceName": "TestResource", + "resourceType": "TestType", + "mediaType": "text/plain; charset=utf-8", + "resourceVersion": "1.0", + "created": "2023-03-06T09:53:44Z", + "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + "previousVersionId": null, + "nextVersionId": null + } + ] + } } diff --git a/tests/integration/rest/testdata/query/version_time/diddoc_version_time_did.json b/tests/integration/rest/testdata/query/version_time/diddoc_version_time_did.json index 763a0f59..a53c6acf 100644 --- a/tests/integration/rest/testdata/query/version_time/diddoc_version_time_did.json +++ b/tests/integration/rest/testdata/query/version_time/diddoc_version_time_did.json @@ -1,62 +1,61 @@ { - "@context": "https://w3id.org/did-resolution/v1", - "didResolutionMetadata": { - "contentType": "application/did+ld+json", - "retrieved": "2023-04-24T10:48:50Z", - "did": { - "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "method": "cheqd" - } - }, - "didDocument": { - "@context": [ - "https://www.w3.org/ns/did/v1", - "https://w3id.org/security/suites/ed25519-2018/v1" - ], - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "verificationMethod": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", - "type": "Ed25519VerificationKey2018", - "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "publicKeyBase58": "BpVGbTeT26LipAdk26DBZrmJx2939i9gZS5VxGt1zZQ6" - } - ], - "authentication": [ - "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" - ], - "service": [ - { - "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", - "type": "LinkedDomains", - "serviceEndpoint": [ - "https://bar.example.com" - ] - } - ] - }, - "didDocumentMetadata": { - "created": "2023-03-06T09:36:55Z", - "updated": "2023-03-06T09:39:48Z", - "deactivated": true, - "versionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", - "nextVersionId": "f790c9b9-4817-4b31-be43-b198e6e18071", - "previousVersionId": "0ce23d04-5b67-4ea6-a315-788588e53f4e", - "linkedResourceMetadata": [ - { - "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", - "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", - "resourceName": "TestResource", - "resourceType": "TestType", - "mediaType": "text/plain; charset=utf-8", - "resourceVersion": "1.0", - "created": "2023-03-06T09:53:44Z", - "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - "previousVersionId": null, - "nextVersionId": null - } - ] + "@context": "https://w3id.org/did-resolution/v1", + "didResolutionMetadata": { + "contentType": "application/did+ld+json", + "retrieved": "2023-04-24T10:48:50Z", + "did": { + "didString": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "methodSpecificId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "method": "cheqd" } + }, + "didDocument": { + "@context": [ + "https://www.w3.org/ns/did/v1", + "https://identity.foundation/.well-known/did-configuration/v1", + "https://w3id.org/security/suites/ed25519-2018/v1" + ], + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "verificationMethod": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1", + "type": "Ed25519VerificationKey2018", + "controller": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "publicKeyBase58": "BpVGbTeT26LipAdk26DBZrmJx2939i9gZS5VxGt1zZQ6" + } + ], + "authentication": [ + "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#key-1" + ], + "service": [ + { + "id": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c#bar", + "type": "LinkedDomains", + "serviceEndpoint": ["https://bar.example.com"] + } + ] + }, + "didDocumentMetadata": { + "created": "2023-03-06T09:36:55Z", + "updated": "2023-03-06T09:39:48Z", + "deactivated": true, + "versionId": "ce298b6f-594b-426e-b431-370d6bc5d3ad", + "nextVersionId": "f790c9b9-4817-4b31-be43-b198e6e18071", + "previousVersionId": "0ce23d04-5b67-4ea6-a315-788588e53f4e", + "linkedResourceMetadata": [ + { + "resourceURI": "did:cheqd:testnet:b5d70adf-31ca-4662-aa10-d3a54cd8f06c/resources/5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceCollectionId": "b5d70adf-31ca-4662-aa10-d3a54cd8f06c", + "resourceId": "5e16a3f9-7c6e-4b6b-8e28-20f56780ee25", + "resourceName": "TestResource", + "resourceType": "TestType", + "mediaType": "text/plain; charset=utf-8", + "resourceVersion": "1.0", + "created": "2023-03-06T09:53:44Z", + "checksum": "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + "previousVersionId": null, + "nextVersionId": null + } + ] + } } diff --git a/tests/unit/diddoc/common/did_doc_resolve_service_test.go b/tests/unit/diddoc/common/did_doc_resolve_service_test.go index 60602b0e..1c71089e 100644 --- a/tests/unit/diddoc/common/did_doc_resolve_service_test.go +++ b/tests/unit/diddoc/common/did_doc_resolve_service_test.go @@ -27,6 +27,7 @@ var _ = DescribeTable("Test Resolve method", func(testCase resolveDidDocTestCase (testCase.expectedError == nil) { testCase.expectedDIDResolution.Did.Context = []string{ types.DIDSchemaJSONLD, + types.LinkedDomainsJSONLD, types.JsonWebKey2020JSONLD, } } else if testCase.expectedDIDResolution.Did != nil { diff --git a/tests/unit/diddoc/request/diddoc_positive_cases_test.go b/tests/unit/diddoc/request/diddoc_positive_cases_test.go index 3f996277..878915fa 100644 --- a/tests/unit/diddoc/request/diddoc_positive_cases_test.go +++ b/tests/unit/diddoc/request/diddoc_positive_cases_test.go @@ -25,7 +25,7 @@ var _ = DescribeTable("Test Query handlers with versionId and versionTime params expectedDIDResolution := testCase.expectedResolution.(*types.DidResolution) if (testCase.resolutionType == "" || testCase.resolutionType == types.DIDJSONLD) && testCase.expectedError == nil { - expectedDIDResolution.Did.Context = []string{types.DIDSchemaJSONLD, types.JsonWebKey2020JSONLD} + expectedDIDResolution.Did.Context = []string{types.DIDSchemaJSONLD, types.LinkedDomainsJSONLD, types.JsonWebKey2020JSONLD} } else if expectedDIDResolution.Did != nil { expectedDIDResolution.Did.Context = nil } diff --git a/tests/unit/diddoc/request/diddoc_transform_key_test.go b/tests/unit/diddoc/request/diddoc_transform_key_test.go index eddbb84e..d62da111 100644 --- a/tests/unit/diddoc/request/diddoc_transform_key_test.go +++ b/tests/unit/diddoc/request/diddoc_transform_key_test.go @@ -23,7 +23,7 @@ var _ = DescribeTable("Test Query handler with transformKeys params", func(testC expectedDIDResolution := testCase.expectedResolution.(*types.DidResolution) if (testCase.resolutionType == "" || testCase.resolutionType == types.DIDJSONLD) && testCase.expectedError == nil { - expectedDIDResolution.Did.Context = []string{types.DIDSchemaJSONLD, types.JsonWebKey2020JSONLD} + expectedDIDResolution.Did.Context = []string{types.DIDSchemaJSONLD, types.LinkedDomainsJSONLD, types.JsonWebKey2020JSONLD} } else if expectedDIDResolution.Did != nil { expectedDIDResolution.Did.Context = nil } diff --git a/tests/unit/diddoc/request/request_service_resolve_did_doc_test.go b/tests/unit/diddoc/request/request_service_resolve_did_doc_test.go index 4013ae92..72db51f7 100644 --- a/tests/unit/diddoc/request/request_service_resolve_did_doc_test.go +++ b/tests/unit/diddoc/request/request_service_resolve_did_doc_test.go @@ -31,7 +31,7 @@ var _ = DescribeTable("Test DIDDocEchoHandler function", func(testCase resolveDI context, rec := utils.SetupEmptyContext(request, testCase.resolutionType, utils.MockLedger) if (testCase.resolutionType == "" || testCase.resolutionType == types.DIDJSONLD) && testCase.expectedError == nil { - testCase.expectedDIDResolution.Did.Context = []string{types.DIDSchemaJSONLD, types.JsonWebKey2020JSONLD} + testCase.expectedDIDResolution.Did.Context = []string{types.DIDSchemaJSONLD, types.LinkedDomainsJSONLD, types.JsonWebKey2020JSONLD} } else if testCase.expectedDIDResolution.Did != nil { testCase.expectedDIDResolution.Did.Context = nil } diff --git a/types/constants.go b/types/constants.go index 6120d904..e871b82f 100644 --- a/types/constants.go +++ b/types/constants.go @@ -37,6 +37,7 @@ func (tKType TransformKeysType) IsSupported() bool { const ( DIDSchemaJSONLD = "https://www.w3.org/ns/did/v1" + LinkedDomainsJSONLD = "https://identity.foundation/.well-known/did-configuration/v1" ResolutionSchemaJSONLD = "https://w3id.org/did-resolution/v1" Ed25519VerificationKey2020JSONLD = "https://w3id.org/security/suites/ed25519-2020/v1" Ed25519VerificationKey2018JSONLD = "https://w3id.org/security/suites/ed25519-2018/v1" @@ -57,6 +58,7 @@ const ( VersionId string = "versionId" VersionTime string = "versionTime" TransformKeys string = "transformKeys" + LinkedDomains string = "LinkedDomains" Metadata string = "metadata" ServiceQ string = "service" RelativeRef string = "relativeRef" diff --git a/types/helper.go b/types/helper.go index 2a6744dd..5ed8a992 100644 --- a/types/helper.go +++ b/types/helper.go @@ -36,15 +36,15 @@ func SetupLogger(config Config) { func ParseGRPCEndpoint(configEndpoint string, networkName string) (*Network, error) { config := strings.Split(configEndpoint, ",") if len(config) != 3 { - return nil, fmt.Errorf(fmt.Sprintf("Endpoint config for %s is invalid: %s", networkName, configEndpoint)) + return nil, fmt.Errorf("endpoint config for %s is invalid: %s", networkName, configEndpoint) } useTls, err := strconv.ParseBool(config[1]) if err != nil { - return nil, fmt.Errorf(fmt.Sprintf("useTls value %s for %s endpoint is invalid", configEndpoint, networkName)) + return nil, fmt.Errorf("useTls value %s for %s endpoint is invalid", configEndpoint, networkName) } timeout, err := time.ParseDuration(config[2]) if err != nil { - return nil, fmt.Errorf(fmt.Sprintf("Timeout value %s for %s endpoint is invalid", configEndpoint, networkName)) + return nil, fmt.Errorf("timeout value %s for %s endpoint is invalid", configEndpoint, networkName) } return &Network{