From f99f4baddd99e0919b39bd326fbd78f53a3a6a64 Mon Sep 17 00:00:00 2001 From: toktar Date: Mon, 5 Dec 2022 23:01:14 +0300 Subject: [PATCH] fix(docs): Autogenerate Swagger docs [DEV-1839] (#57) * docs: Add swagger docs * docs: Update swagger docs * Update dependencies * Linter fixes * Extend Resolver functionality * go mod tidy * gofumpt -l -w . * fix: Remove swagger files * feat: Add linted swagger docs * build: Upgrade pytest * Update basics * go mod tidy * Update diddoc_service.go * Rename splitDID * Update base details * Update base details * Change base details * Fix examples in DID APIs * Resource-specific metadata * Fetch specific resource * Fetch all resource metadata * Update all Swagger docs * Define dereferencing examples * Update DIDDoc metadata examples * Update DIDDoc examples * Update resolution_metadata.go * Update diddoc_service.go * Set API version * swag fmt * Add service examples * Move DID Resolution annotation to ledger_service * Update constants * swag fmt all docs after moving * Remove unused examples * swag init * Correct swag error * PR format check * go mod tidy * Update doc formatting error * Update package-lock.json * Bump alpine version Co-authored-by: Ankur Banerjee Co-authored-by: DaevMithran --- .github/workflows/pull-request.yml | 29 +- cmd/serve.go | 2 + docker/Dockerfile | 2 +- docs/docs.go | 639 ++++++++++++++++++++++++++ docs/swagger.json | 615 +++++++++++++++++++++++++ docs/swagger.yaml | 416 +++++++++++++++++ go.mod | 45 +- go.sum | 91 +++- main.go | 11 + package-lock.json | 6 +- services/diddoc_service.go | 2 - services/ledger_service.go | 45 ++ services/request_service.go | 69 ++- tests/pytest/requirements.txt | 2 +- types/constants.go | 1 + types/dereferecing_metadata.go | 2 +- types/dereferencing_content_stream.go | 20 +- types/did_doc.go | 14 +- types/did_doc_metadata.go | 8 +- types/resolution_metadata.go | 4 +- 20 files changed, 1943 insertions(+), 80 deletions(-) create mode 100644 docs/docs.go create mode 100644 docs/swagger.json create mode 100644 docs/swagger.yaml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 84abd594..be6c7829 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -4,6 +4,7 @@ on: branches: - main - develop + - release/** types: - opened - reopened @@ -19,15 +20,29 @@ jobs: lint-pr: name: "PR format check" runs-on: ubuntu-latest + steps: - uses: actions/checkout@v3 - # check for the most recent release: https://github.com/CondeNast/conventional-pull-request-action/releases - # replace vX.X.X below with the most recently released version - - uses: CondeNast/conventional-pull-request-action@v0.1.2 + + - uses: amannn/action-semantic-pull-request@v5.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - # to override config-conventional rules, specify a relative path to your rules module, actions/checkout is required for this setting! - commitlintRulesPath: "./.github/linters/.commitlint.rules.js" # default: undefined - # if the PR contains a single commit, fail if the commit message and the PR title do not match - commitTitleMatch: false # default: 'true' + # Configure which types are allowed (newline delimited). + # Default: https://github.com/commitizen/conventional-commit-types + types: | + feat + fix + build + chore + ci + docs + feat + fix + perf + refactor + revert + style + test + # Configure that a scope must always be provided. + requireScope: false diff --git a/cmd/serve.go b/cmd/serve.go index 8d96feb8..4e7701ec 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -11,6 +11,7 @@ import ( "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/spf13/cobra" + echoSwagger "github.com/swaggo/echo-swagger" ) func getServeCmd() *cobra.Command { @@ -61,6 +62,7 @@ func serve() { requestService := services.NewRequestService(types.DID_METHOD, ledgerService) // Routes + e.GET(types.SWAGGER_PATH, echoSwagger.WrapHandler) e.GET(types.RESOLVER_PATH+":did", requestService.ResolveDIDDoc) e.GET(types.RESOLVER_PATH+":did"+types.RESOURCE_PATH+":resource", requestService.DereferenceResourceData) e.GET(types.RESOLVER_PATH+":did"+types.RESOURCE_PATH+":resource/metadata", requestService.DereferenceResourceMetadata) diff --git a/docker/Dockerfile b/docker/Dockerfile index 54f501c3..a9202165 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,7 +14,7 @@ RUN go mod download && go build -o did-resolver main.go ### STAGE 2: Build cheqd did-resolver container image ### ##################################################################### -FROM alpine:3.16 AS resolver +FROM alpine:3.17 AS resolver # Install pre-requisites RUN apk update && apk add --no-cache bash ca-certificates diff --git a/docs/docs.go b/docs/docs.go new file mode 100644 index 00000000..3a0ccb53 --- /dev/null +++ b/docs/docs.go @@ -0,0 +1,639 @@ +// Package docs GENERATED BY SWAG; DO NOT EDIT +// This file was generated by swaggo/swag +package docs + +import "github.com/swaggo/swag" + +const docTemplate = `{ + "schemes": {{ marshal .Schemes }}, + "swagger": "2.0", + "info": { + "description": "{{escape .Description}}", + "title": "{{.Title}}", + "contact": { + "name": "Cheqd Foundation Limited" + }, + "license": { + "name": "Apache 2.0" + }, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/{did}": { + "get": { + "description": "Fetch DID Document (\"DIDDoc\") from cheqd network", + "consumes": [ + "application/did+ld+json", + "application/ld+json", + "application/did+json" + ], + "produces": [ + "application/did+ld+json", + "application/ld+json", + "application/did+json" + ], + "tags": [ + "DID Resolution" + ], + "summary": "Resolve DID Document on did:cheqd", + "parameters": [ + { + "type": "string", + "description": "Full DID with unique identifier", + "name": "did", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Service Type", + "name": "service", + "in": "query" + }, + { + "type": "string", + "description": "#Fragment", + "name": "fragmentId", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/types.DidResolution" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "406": { + "description": "Not Acceptable", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + } + } + } + }, + "/{did}/resources/all": { + "get": { + "description": "Get metadata for all Resources within a DID Resource Collection", + "consumes": [ + "application/did+ld+json", + "application/ld+json", + "application/did+json" + ], + "produces": [ + "application/did+ld+json", + "application/ld+json", + "application/did+json" + ], + "tags": [ + "Resource Resolution" + ], + "summary": "Fetch metadata for all Resources", + "parameters": [ + { + "type": "string", + "description": "Full DID with unique identifier", + "name": "did", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/types.DidDereferencing" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "406": { + "description": "Not Acceptable", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + } + } + } + }, + "/{did}/resources/{resourceId}": { + "get": { + "description": "Get specific Resource within a DID Resource Collection", + "consumes": [ + "*/*" + ], + "produces": [ + "*/*" + ], + "tags": [ + "Resource Resolution" + ], + "summary": "Fetch specific Resource", + "parameters": [ + { + "type": "string", + "description": "Full DID with unique identifier", + "name": "did", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Resource-specific unique-identifier", + "name": "resourceId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "type": "integer" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "406": { + "description": "Not Acceptable", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + } + } + } + }, + "/{did}/resources/{resourceId}/metadata": { + "get": { + "description": "Get metadata for a specific Resource within a DID Resource Collection", + "consumes": [ + "application/did+ld+json", + "application/ld+json", + "application/did+json" + ], + "produces": [ + "application/did+ld+json", + "application/ld+json", + "application/did+json" + ], + "tags": [ + "Resource Resolution" + ], + "summary": "Fetch Resource-specific metadata", + "parameters": [ + { + "type": "string", + "description": "Full DID with unique identifier", + "name": "did", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Resource-specific unique identifier", + "name": "resourceId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/types.DidDereferencing" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "406": { + "description": "Not Acceptable", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + } + } + } + } + }, + "definitions": { + "types.ContentType": { + "type": "string", + "enum": [ + "application/did+json", + "application/did+ld+json", + "application/ld+json", + "application/json" + ], + "x-enum-varnames": [ + "DIDJSON", + "DIDJSONLD", + "JSONLD", + "JSON" + ] + }, + "types.DereferencedResource": { + "type": "object", + "properties": { + "checksum": { + "type": "string", + "example": "a95380f460e63ad939541a57aecbfd795fcd37c6d78ee86c885340e33a91b559" + }, + "created": { + "type": "string", + "example": "2021-09-01T12:00:00Z" + }, + "mediaType": { + "type": "string", + "example": "image/png" + }, + "nextVersionId": { + "type": "string", + "example": "d4829ac7-4566-478c-a408-b44767eddadc" + }, + "previousVersionId": { + "type": "string", + "example": "ad7a8442-3531-46eb-a024-53953ec6e4ff" + }, + "resourceCollectionId": { + "type": "string", + "example": "55dbc8bf-fba3-4117-855c-1e0dc1d3bb47" + }, + "resourceId": { + "type": "string", + "example": "398cee0a-efac-4643-9f4c-74c48c72a14b" + }, + "resourceName": { + "type": "string", + "example": "Image Resource" + }, + "resourceType": { + "type": "string", + "example": "Image" + }, + "resourceURI": { + "type": "string", + "example": "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47/resources/398cee0a-efac-4643-9f4c-74c48c72a14b" + } + } + }, + "types.DereferencingMetadata": { + "type": "object", + "properties": { + "contentType": { + "allOf": [ + { + "$ref": "#/definitions/types.ContentType" + } + ], + "example": "application/did+ld+json" + }, + "did": { + "$ref": "#/definitions/types.DidProperties" + }, + "error": { + "type": "string" + }, + "retrieved": { + "type": "string", + "example": "2021-09-01T12:00:00Z" + } + } + }, + "types.DidDereferencing": { + "type": "object", + "properties": { + "@context": { + "type": "string", + "example": "https://w3id.org/did-resolution/v1" + }, + "contentMetadata": { + "$ref": "#/definitions/types.ResolutionDidDocMetadata" + }, + "contentStream": {}, + "dereferencingMetadata": { + "$ref": "#/definitions/types.DereferencingMetadata" + } + } + }, + "types.DidDoc": { + "type": "object", + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "https://www.w3.org/ns/did/v1" + ] + }, + "alsoKnownAs": { + "type": "array", + "items": { + "type": "string" + } + }, + "assertionMethod": { + "type": "array", + "items": { + "type": "string" + } + }, + "authentication": { + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#key-1" + ] + }, + "capabilityInvocation": { + "type": "array", + "items": { + "type": "string" + } + }, + "capability_delegation": { + "type": "array", + "items": { + "type": "string" + } + }, + "controller": { + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47" + ] + }, + "id": { + "type": "string", + "example": "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47" + }, + "keyAgreement": { + "type": "array", + "items": { + "type": "string" + } + }, + "service": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Service" + } + }, + "verificationMethod": { + "type": "array", + "items": { + "$ref": "#/definitions/types.VerificationMethod" + } + } + } + }, + "types.DidProperties": { + "type": "object", + "properties": { + "didString": { + "type": "string" + }, + "method": { + "type": "string" + }, + "methodSpecificId": { + "type": "string" + } + } + }, + "types.DidResolution": { + "type": "object", + "properties": { + "@context": { + "type": "string" + }, + "didDocument": { + "$ref": "#/definitions/types.DidDoc" + }, + "didDocumentMetadata": { + "$ref": "#/definitions/types.ResolutionDidDocMetadata" + }, + "didResolutionMetadata": { + "$ref": "#/definitions/types.ResolutionMetadata" + } + } + }, + "types.IdentityError": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "contentType": { + "$ref": "#/definitions/types.ContentType" + }, + "did": { + "type": "string" + }, + "internal": {}, + "isDereferencing": { + "type": "boolean" + }, + "message": { + "type": "string" + } + } + }, + "types.ResolutionDidDocMetadata": { + "type": "object", + "properties": { + "created": { + "type": "string", + "example": "2021-09-01T12:00:00Z" + }, + "deactivated": { + "type": "boolean", + "example": false + }, + "linkedResourceMetadata": { + "type": "array", + "items": { + "$ref": "#/definitions/types.DereferencedResource" + } + }, + "updated": { + "type": "string", + "example": "2021-09-10T12:00:00Z" + }, + "versionId": { + "type": "string", + "example": "4979BAF49599FEF0BAD5ED0849FDD708156761EBBC8EBE78D0907F8BECC9CB2E" + } + } + }, + "types.ResolutionMetadata": { + "type": "object", + "properties": { + "contentType": { + "allOf": [ + { + "$ref": "#/definitions/types.ContentType" + } + ], + "example": "application/did+ld+json" + }, + "did": { + "$ref": "#/definitions/types.DidProperties" + }, + "error": { + "type": "string" + }, + "retrieved": { + "type": "string", + "example": "2021-09-01T12:00:00Z" + } + } + }, + "types.Service": { + "type": "object", + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "string", + "example": "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#service-1" + }, + "serviceEndpoint": { + "type": "string", + "example": "https://example.com/endpoint/8377464" + }, + "type": { + "type": "string", + "example": "did-communication" + } + } + }, + "types.VerificationMethod": { + "type": "object", + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string" + } + }, + "controller": { + "type": "string" + }, + "id": { + "type": "string" + }, + "publicKeyJwk": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "publicKeyMultibase": { + "type": "string" + }, + "type": { + "type": "string" + } + } + } + } +}` + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = &swag.Spec{ + Version: "1.0", + Host: "resolver.cheqd.net", + BasePath: "/1.0/identifiers", + Schemes: []string{}, + Title: "DID Resolver for did:cheqd method", + Description: "", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, +} + +func init() { + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) +} diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 00000000..f0a1c5c5 --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,615 @@ +{ + "swagger": "2.0", + "info": { + "title": "DID Resolver for did:cheqd method", + "contact": { + "name": "Cheqd Foundation Limited" + }, + "license": { + "name": "Apache 2.0" + }, + "version": "1.0" + }, + "host": "resolver.cheqd.net", + "basePath": "/1.0/identifiers", + "paths": { + "/{did}": { + "get": { + "description": "Fetch DID Document (\"DIDDoc\") from cheqd network", + "consumes": [ + "application/did+ld+json", + "application/ld+json", + "application/did+json" + ], + "produces": [ + "application/did+ld+json", + "application/ld+json", + "application/did+json" + ], + "tags": [ + "DID Resolution" + ], + "summary": "Resolve DID Document on did:cheqd", + "parameters": [ + { + "type": "string", + "description": "Full DID with unique identifier", + "name": "did", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Service Type", + "name": "service", + "in": "query" + }, + { + "type": "string", + "description": "#Fragment", + "name": "fragmentId", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/types.DidResolution" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "406": { + "description": "Not Acceptable", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + } + } + } + }, + "/{did}/resources/all": { + "get": { + "description": "Get metadata for all Resources within a DID Resource Collection", + "consumes": [ + "application/did+ld+json", + "application/ld+json", + "application/did+json" + ], + "produces": [ + "application/did+ld+json", + "application/ld+json", + "application/did+json" + ], + "tags": [ + "Resource Resolution" + ], + "summary": "Fetch metadata for all Resources", + "parameters": [ + { + "type": "string", + "description": "Full DID with unique identifier", + "name": "did", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/types.DidDereferencing" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "406": { + "description": "Not Acceptable", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + } + } + } + }, + "/{did}/resources/{resourceId}": { + "get": { + "description": "Get specific Resource within a DID Resource Collection", + "consumes": [ + "*/*" + ], + "produces": [ + "*/*" + ], + "tags": [ + "Resource Resolution" + ], + "summary": "Fetch specific Resource", + "parameters": [ + { + "type": "string", + "description": "Full DID with unique identifier", + "name": "did", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Resource-specific unique-identifier", + "name": "resourceId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "type": "integer" + } + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "406": { + "description": "Not Acceptable", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + } + } + } + }, + "/{did}/resources/{resourceId}/metadata": { + "get": { + "description": "Get metadata for a specific Resource within a DID Resource Collection", + "consumes": [ + "application/did+ld+json", + "application/ld+json", + "application/did+json" + ], + "produces": [ + "application/did+ld+json", + "application/ld+json", + "application/did+json" + ], + "tags": [ + "Resource Resolution" + ], + "summary": "Fetch Resource-specific metadata", + "parameters": [ + { + "type": "string", + "description": "Full DID with unique identifier", + "name": "did", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Resource-specific unique identifier", + "name": "resourceId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/types.DidDereferencing" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "406": { + "description": "Not Acceptable", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/types.IdentityError" + } + } + } + } + } + }, + "definitions": { + "types.ContentType": { + "type": "string", + "enum": [ + "application/did+json", + "application/did+ld+json", + "application/ld+json", + "application/json" + ], + "x-enum-varnames": [ + "DIDJSON", + "DIDJSONLD", + "JSONLD", + "JSON" + ] + }, + "types.DereferencedResource": { + "type": "object", + "properties": { + "checksum": { + "type": "string", + "example": "a95380f460e63ad939541a57aecbfd795fcd37c6d78ee86c885340e33a91b559" + }, + "created": { + "type": "string", + "example": "2021-09-01T12:00:00Z" + }, + "mediaType": { + "type": "string", + "example": "image/png" + }, + "nextVersionId": { + "type": "string", + "example": "d4829ac7-4566-478c-a408-b44767eddadc" + }, + "previousVersionId": { + "type": "string", + "example": "ad7a8442-3531-46eb-a024-53953ec6e4ff" + }, + "resourceCollectionId": { + "type": "string", + "example": "55dbc8bf-fba3-4117-855c-1e0dc1d3bb47" + }, + "resourceId": { + "type": "string", + "example": "398cee0a-efac-4643-9f4c-74c48c72a14b" + }, + "resourceName": { + "type": "string", + "example": "Image Resource" + }, + "resourceType": { + "type": "string", + "example": "Image" + }, + "resourceURI": { + "type": "string", + "example": "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47/resources/398cee0a-efac-4643-9f4c-74c48c72a14b" + } + } + }, + "types.DereferencingMetadata": { + "type": "object", + "properties": { + "contentType": { + "allOf": [ + { + "$ref": "#/definitions/types.ContentType" + } + ], + "example": "application/did+ld+json" + }, + "did": { + "$ref": "#/definitions/types.DidProperties" + }, + "error": { + "type": "string" + }, + "retrieved": { + "type": "string", + "example": "2021-09-01T12:00:00Z" + } + } + }, + "types.DidDereferencing": { + "type": "object", + "properties": { + "@context": { + "type": "string", + "example": "https://w3id.org/did-resolution/v1" + }, + "contentMetadata": { + "$ref": "#/definitions/types.ResolutionDidDocMetadata" + }, + "contentStream": {}, + "dereferencingMetadata": { + "$ref": "#/definitions/types.DereferencingMetadata" + } + } + }, + "types.DidDoc": { + "type": "object", + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "https://www.w3.org/ns/did/v1" + ] + }, + "alsoKnownAs": { + "type": "array", + "items": { + "type": "string" + } + }, + "assertionMethod": { + "type": "array", + "items": { + "type": "string" + } + }, + "authentication": { + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#key-1" + ] + }, + "capabilityInvocation": { + "type": "array", + "items": { + "type": "string" + } + }, + "capability_delegation": { + "type": "array", + "items": { + "type": "string" + } + }, + "controller": { + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47" + ] + }, + "id": { + "type": "string", + "example": "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47" + }, + "keyAgreement": { + "type": "array", + "items": { + "type": "string" + } + }, + "service": { + "type": "array", + "items": { + "$ref": "#/definitions/types.Service" + } + }, + "verificationMethod": { + "type": "array", + "items": { + "$ref": "#/definitions/types.VerificationMethod" + } + } + } + }, + "types.DidProperties": { + "type": "object", + "properties": { + "didString": { + "type": "string" + }, + "method": { + "type": "string" + }, + "methodSpecificId": { + "type": "string" + } + } + }, + "types.DidResolution": { + "type": "object", + "properties": { + "@context": { + "type": "string" + }, + "didDocument": { + "$ref": "#/definitions/types.DidDoc" + }, + "didDocumentMetadata": { + "$ref": "#/definitions/types.ResolutionDidDocMetadata" + }, + "didResolutionMetadata": { + "$ref": "#/definitions/types.ResolutionMetadata" + } + } + }, + "types.IdentityError": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "contentType": { + "$ref": "#/definitions/types.ContentType" + }, + "did": { + "type": "string" + }, + "internal": {}, + "isDereferencing": { + "type": "boolean" + }, + "message": { + "type": "string" + } + } + }, + "types.ResolutionDidDocMetadata": { + "type": "object", + "properties": { + "created": { + "type": "string", + "example": "2021-09-01T12:00:00Z" + }, + "deactivated": { + "type": "boolean", + "example": false + }, + "linkedResourceMetadata": { + "type": "array", + "items": { + "$ref": "#/definitions/types.DereferencedResource" + } + }, + "updated": { + "type": "string", + "example": "2021-09-10T12:00:00Z" + }, + "versionId": { + "type": "string", + "example": "4979BAF49599FEF0BAD5ED0849FDD708156761EBBC8EBE78D0907F8BECC9CB2E" + } + } + }, + "types.ResolutionMetadata": { + "type": "object", + "properties": { + "contentType": { + "allOf": [ + { + "$ref": "#/definitions/types.ContentType" + } + ], + "example": "application/did+ld+json" + }, + "did": { + "$ref": "#/definitions/types.DidProperties" + }, + "error": { + "type": "string" + }, + "retrieved": { + "type": "string", + "example": "2021-09-01T12:00:00Z" + } + } + }, + "types.Service": { + "type": "object", + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string" + } + }, + "id": { + "type": "string", + "example": "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#service-1" + }, + "serviceEndpoint": { + "type": "string", + "example": "https://example.com/endpoint/8377464" + }, + "type": { + "type": "string", + "example": "did-communication" + } + } + }, + "types.VerificationMethod": { + "type": "object", + "properties": { + "@context": { + "type": "array", + "items": { + "type": "string" + } + }, + "controller": { + "type": "string" + }, + "id": { + "type": "string" + }, + "publicKeyJwk": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "publicKeyMultibase": { + "type": "string" + }, + "type": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml new file mode 100644 index 00000000..f3c3eb01 --- /dev/null +++ b/docs/swagger.yaml @@ -0,0 +1,416 @@ +basePath: /1.0/identifiers +definitions: + types.ContentType: + enum: + - application/did+json + - application/did+ld+json + - application/ld+json + - application/json + type: string + x-enum-varnames: + - DIDJSON + - DIDJSONLD + - JSONLD + - JSON + types.DereferencedResource: + properties: + checksum: + example: a95380f460e63ad939541a57aecbfd795fcd37c6d78ee86c885340e33a91b559 + type: string + created: + example: "2021-09-01T12:00:00Z" + type: string + mediaType: + example: image/png + type: string + nextVersionId: + example: d4829ac7-4566-478c-a408-b44767eddadc + type: string + previousVersionId: + example: ad7a8442-3531-46eb-a024-53953ec6e4ff + type: string + resourceCollectionId: + example: 55dbc8bf-fba3-4117-855c-1e0dc1d3bb47 + type: string + resourceId: + example: 398cee0a-efac-4643-9f4c-74c48c72a14b + type: string + resourceName: + example: Image Resource + type: string + resourceType: + example: Image + type: string + resourceURI: + example: did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47/resources/398cee0a-efac-4643-9f4c-74c48c72a14b + type: string + type: object + types.DereferencingMetadata: + properties: + contentType: + allOf: + - $ref: '#/definitions/types.ContentType' + example: application/did+ld+json + did: + $ref: '#/definitions/types.DidProperties' + error: + type: string + retrieved: + example: "2021-09-01T12:00:00Z" + type: string + type: object + types.DidDereferencing: + properties: + '@context': + example: https://w3id.org/did-resolution/v1 + type: string + contentMetadata: + $ref: '#/definitions/types.ResolutionDidDocMetadata' + contentStream: {} + dereferencingMetadata: + $ref: '#/definitions/types.DereferencingMetadata' + type: object + types.DidDoc: + properties: + '@context': + example: + - https://www.w3.org/ns/did/v1 + items: + type: string + type: array + alsoKnownAs: + items: + type: string + type: array + assertionMethod: + items: + type: string + type: array + authentication: + example: + - did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#key-1 + items: + type: string + type: array + capability_delegation: + items: + type: string + type: array + capabilityInvocation: + items: + type: string + type: array + controller: + example: + - did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47 + items: + type: string + type: array + id: + example: did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47 + type: string + keyAgreement: + items: + type: string + type: array + service: + items: + $ref: '#/definitions/types.Service' + type: array + verificationMethod: + items: + $ref: '#/definitions/types.VerificationMethod' + type: array + type: object + types.DidProperties: + properties: + didString: + type: string + method: + type: string + methodSpecificId: + type: string + type: object + types.DidResolution: + properties: + '@context': + type: string + didDocument: + $ref: '#/definitions/types.DidDoc' + didDocumentMetadata: + $ref: '#/definitions/types.ResolutionDidDocMetadata' + didResolutionMetadata: + $ref: '#/definitions/types.ResolutionMetadata' + type: object + types.IdentityError: + properties: + code: + type: integer + contentType: + $ref: '#/definitions/types.ContentType' + did: + type: string + internal: {} + isDereferencing: + type: boolean + message: + type: string + type: object + types.ResolutionDidDocMetadata: + properties: + created: + example: "2021-09-01T12:00:00Z" + type: string + deactivated: + example: false + type: boolean + linkedResourceMetadata: + items: + $ref: '#/definitions/types.DereferencedResource' + type: array + updated: + example: "2021-09-10T12:00:00Z" + type: string + versionId: + example: 4979BAF49599FEF0BAD5ED0849FDD708156761EBBC8EBE78D0907F8BECC9CB2E + type: string + type: object + types.ResolutionMetadata: + properties: + contentType: + allOf: + - $ref: '#/definitions/types.ContentType' + example: application/did+ld+json + did: + $ref: '#/definitions/types.DidProperties' + error: + type: string + retrieved: + example: "2021-09-01T12:00:00Z" + type: string + type: object + types.Service: + properties: + '@context': + items: + type: string + type: array + id: + example: did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#service-1 + type: string + serviceEndpoint: + example: https://example.com/endpoint/8377464 + type: string + type: + example: did-communication + type: string + type: object + types.VerificationMethod: + properties: + '@context': + items: + type: string + type: array + controller: + type: string + id: + type: string + publicKeyJwk: + additionalProperties: + type: string + type: object + publicKeyMultibase: + type: string + type: + type: string + type: object +host: resolver.cheqd.net +info: + contact: + name: Cheqd Foundation Limited + license: + name: Apache 2.0 + title: DID Resolver for did:cheqd method + version: "1.0" +paths: + /{did}: + get: + consumes: + - application/did+ld+json + - application/ld+json + - application/did+json + description: Fetch DID Document ("DIDDoc") from cheqd network + parameters: + - description: Full DID with unique identifier + in: path + name: did + required: true + type: string + - description: Service Type + in: query + name: service + type: string + - description: '#Fragment' + in: query + name: fragmentId + type: string + produces: + - application/did+ld+json + - application/ld+json + - application/did+json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/types.DidResolution' + "400": + description: Bad Request + schema: + $ref: '#/definitions/types.IdentityError' + "404": + description: Not Found + schema: + $ref: '#/definitions/types.IdentityError' + "406": + description: Not Acceptable + schema: + $ref: '#/definitions/types.IdentityError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/types.IdentityError' + summary: Resolve DID Document on did:cheqd + tags: + - DID Resolution + /{did}/resources/{resourceId}: + get: + consumes: + - '*/*' + description: Get specific Resource within a DID Resource Collection + parameters: + - description: Full DID with unique identifier + in: path + name: did + required: true + type: string + - description: Resource-specific unique-identifier + in: path + name: resourceId + required: true + type: string + produces: + - '*/*' + responses: + "200": + description: OK + schema: + items: + type: integer + type: array + "400": + description: Bad Request + schema: + $ref: '#/definitions/types.IdentityError' + "404": + description: Not Found + schema: + $ref: '#/definitions/types.IdentityError' + "406": + description: Not Acceptable + schema: + $ref: '#/definitions/types.IdentityError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/types.IdentityError' + summary: Fetch specific Resource + tags: + - Resource Resolution + /{did}/resources/{resourceId}/metadata: + get: + consumes: + - application/did+ld+json + - application/ld+json + - application/did+json + description: Get metadata for a specific Resource within a DID Resource Collection + parameters: + - description: Full DID with unique identifier + in: path + name: did + required: true + type: string + - description: Resource-specific unique identifier + in: path + name: resourceId + required: true + type: string + produces: + - application/did+ld+json + - application/ld+json + - application/did+json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/types.DidDereferencing' + "400": + description: Bad Request + schema: + $ref: '#/definitions/types.IdentityError' + "404": + description: Not Found + schema: + $ref: '#/definitions/types.IdentityError' + "406": + description: Not Acceptable + schema: + $ref: '#/definitions/types.IdentityError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/types.IdentityError' + summary: Fetch Resource-specific metadata + tags: + - Resource Resolution + /{did}/resources/all: + get: + consumes: + - application/did+ld+json + - application/ld+json + - application/did+json + description: Get metadata for all Resources within a DID Resource Collection + parameters: + - description: Full DID with unique identifier + in: path + name: did + required: true + type: string + produces: + - application/did+ld+json + - application/ld+json + - application/did+json + responses: + "200": + description: OK + schema: + $ref: '#/definitions/types.DidDereferencing' + "400": + description: Bad Request + schema: + $ref: '#/definitions/types.IdentityError' + "404": + description: Not Found + schema: + $ref: '#/definitions/types.IdentityError' + "406": + description: Not Acceptable + schema: + $ref: '#/definitions/types.IdentityError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/types.IdentityError' + summary: Fetch metadata for all Resources + tags: + - Resource Resolution +swagger: "2.0" diff --git a/go.mod b/go.mod index 9270abb8..7521426e 100644 --- a/go.mod +++ b/go.mod @@ -9,12 +9,20 @@ require ( github.com/spf13/cobra v1.6.1 github.com/spf13/viper v1.14.0 github.com/stretchr/testify v1.8.1 + github.com/swaggo/echo-swagger v1.3.5 + github.com/swaggo/swag v1.8.8 google.golang.org/grpc v1.51.0 ) +require ( + github.com/google/uuid v1.3.0 + google.golang.org/protobuf v1.28.1 // indirect +) + require ( filippo.io/edwards25519 v1.0.0-beta.2 // indirect github.com/DataDog/zstd v1.4.5 // indirect + github.com/KyleBanks/depth v1.2.1 // indirect github.com/armon/go-metrics v0.4.0 // indirect github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -34,11 +42,17 @@ require ( github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.20.0 // indirect + github.com/go-openapi/spec v0.20.7 // indirect + github.com/go-openapi/swag v0.22.3 // indirect github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect github.com/goccy/go-json v0.9.7 // indirect + github.com/gogo/protobuf v1.3.3 // indirect + github.com/golang-jwt/jwt v3.2.2+incompatible // indirect + github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.3 // indirect github.com/google/btree v1.0.0 // indirect - github.com/google/uuid v1.3.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gtank/merlin v0.1.1 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect @@ -46,6 +60,8 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/jmhodges/levigo v1.0.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/labstack/gommon v0.4.0 // indirect github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect github.com/lestrrat-go/blackmagic v1.0.0 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect @@ -54,6 +70,9 @@ require ( github.com/lestrrat-go/option v1.0.0 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/magiconair/properties v1.8.6 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect @@ -76,33 +95,25 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.4.1 // indirect + github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a // indirect github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca // indirect github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tendermint/tendermint v0.34.21 // indirect github.com/tendermint/tm-db v0.6.6 // indirect - go.etcd.io/bbolt v1.3.6 // indirect - google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect - google.golang.org/protobuf v1.28.1 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect -) - -require ( - github.com/gogo/protobuf v1.3.3 // indirect - github.com/golang-jwt/jwt v3.2.2+incompatible // indirect - github.com/golang/protobuf v1.5.2 // indirect - github.com/labstack/gommon v0.4.0 // indirect - github.com/mattn/go-colorable v0.1.12 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.1 // indirect - golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect + go.etcd.io/bbolt v1.3.6 // indirect + golang.org/x/crypto v0.0.0-20221012134737-56aed061732a // indirect golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect - golang.org/x/sys v0.0.0-20220908164124-27713097b956 // indirect + golang.org/x/sys v0.0.0-20221010170243-090e33056c14 // indirect golang.org/x/text v0.4.0 // indirect golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect + golang.org/x/tools v0.1.12 // indirect + google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect + gopkg.in/ini.v1 v1.67.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 5bb1369a..19d50b69 100644 --- a/go.sum +++ b/go.sum @@ -46,10 +46,15 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3 github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= +github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= +github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= +github.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -114,7 +119,9 @@ github.com/cosmos/iavl v0.19.3 h1:cESO0OwTTxQm5rmyESKW+zESheDUYI7CcZDWWDwnuxg= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -168,6 +175,19 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= +github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= +github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= +github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= +github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= +github.com/go-openapi/spec v0.20.7 h1:1Rlu/ZrOCCob0n+JKKJAWhNWMPW8bOZRg8FJaY+0SKI= +github.com/go-openapi/spec v0.20.7/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-ozzo/ozzo-validation/v4 v4.3.0 h1:byhDUpfEwjsVQb1vBunvIjh2BHQ9ead57VkAEY4V+Es= github.com/go-ozzo/ozzo-validation/v4 v4.3.0/go.mod h1:2NKgrcHl3z6cJs+3Oo940FPRiTzuqKbvfrL2RxCj6Ew= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -248,6 +268,7 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= @@ -281,6 +302,8 @@ github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLf github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -290,6 +313,7 @@ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= @@ -305,8 +329,11 @@ github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/labstack/echo/v4 v4.9.0/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= github.com/labstack/echo/v4 v4.9.1 h1:GliPYSpzGKlyOhqIbG8nmHBo3i1saKWFOgh41AN3b+Y= github.com/labstack/echo/v4 v4.9.1/go.mod h1:Pop5HLc+xoc4qhTZ1ip6C0RtP7Z+4VzRLWZZFKqbbjo= +github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/lestrrat-go/backoff/v2 v2.0.8 h1:oNb5E5isby2kiro9AgdHLv5N5tint1AnDVVf2E2un5A= @@ -326,11 +353,18 @@ github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QT github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= @@ -357,6 +391,7 @@ github.com/multiformats/go-multibase v0.1.1 h1:3ASCDsuLX8+j4kx58qnJ4YFq/JWTJpCyD github.com/multiformats/go-multibase v0.1.1/go.mod h1:ZEjHE+IsUrgp5mhlEAYjMtZwK1k4haNkcaPg9aoe1a8= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= @@ -368,6 +403,11 @@ github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1Cpa github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.22.0 h1:AIg2/OntwkBiCg5Tt1ayyiF1ArFrWFoCSMtMi/wdApk= +github.com/otiai10/copy v1.7.0/go.mod h1:rmRl6QPdJj6EiUqXQ/4Nn2lLXoNQjFCQbbNrxgc/t3U= +github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= +github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= +github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -423,12 +463,16 @@ github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.28.0 h1:MirSo27VyNi7RJYP3078AA1+Cyzd2GB66qy3aUHvsWY= github.com/rs/zerolog v1.28.0/go.mod h1:NILgTygv/Uej1ra5XxGf82ZFSLk58MFGAUS2o6usyD0= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa h1:0U2s5loxrTy6/VgfVoLuVLFJcURKLH49ie0zSch7gh4= github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -466,6 +510,13 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/swaggo/echo-swagger v1.3.5 h1:kCx1wvX5AKhjI6Ykt48l3PTsfL9UD40ZROOx/tYzWyY= +github.com/swaggo/echo-swagger v1.3.5/go.mod h1:3IMHd2Z8KftdWFEEjGmv6QpWj370LwMCOfovuh7vF34= +github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a h1:kAe4YSu0O0UFn1DowNo2MY5p6xzqtJ/wQ7LZynSvGaY= +github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a/go.mod h1:lKJPbtWzJ9JhsTN1k1gZgleJWY/cqq0psdoMmaThG3w= +github.com/swaggo/swag v1.8.1/go.mod h1:ugemnJsPZm/kRwFUnzBlbHRd0JY9zE1M4F+uy2pAaPQ= +github.com/swaggo/swag v1.8.8 h1:/GgJmrJ8/c0z4R4hoEPZ5UeEhVGdvsII4JbVDLbR7Xc= +github.com/swaggo/swag v1.8.8/go.mod h1:ezQVUUhly8dludpVk+/PuwJWvLLanB13ygV5Pr9enSk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= @@ -480,6 +531,7 @@ github.com/tendermint/tm-db v0.6.6 h1:EzhaOfR0bdKyATqcd5PNeyeq8r+V4bRPHBfyFdD9kG github.com/tendermint/tm-db v0.6.6/go.mod h1:wP8d49A85B7/erz/r4YbKssKw6ylsO/hKtFk7E1aWZI= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= @@ -489,6 +541,8 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zondax/hid v0.9.0 h1:eiT3P6vNxAEVxXMw66eZUAAnU2zD33JBkfG/EnfAKl8= go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= @@ -510,10 +564,13 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM= -golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20221012134737-56aed061732a h1:NmSIgad6KjE6VvHciPZuNRTKxGhlPfD6OA87W/PLkqg= +golang.org/x/crypto v0.0.0-20221012134737-56aed061732a/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -549,6 +606,9 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -585,10 +645,14 @@ golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -612,6 +676,7 @@ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -660,17 +725,23 @@ golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956 h1:XeJjHH1KiLpKGb6lvMiksZ9l0fVUh+AmGcm0nOMEBOY= +golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14 h1:k5II8e6QD8mITdi+okbbmR/cIyEbeXLBhy5Ha4nevyc= +golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc= @@ -687,6 +758,7 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220609170525-579cf78fd858 h1:Dpdu/EMxGMFgq0CeYMh4fazTD2vtlZRYE7wyynxJb9U= golang.org/x/time v0.0.0-20220609170525-579cf78fd858/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -695,6 +767,7 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -738,6 +811,10 @@ golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= +golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -847,8 +924,9 @@ google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= @@ -864,6 +942,7 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go index 1baaa77b..483e6963 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "github.com/cheqd/did-resolver/cmd" + _ "github.com/cheqd/did-resolver/docs" "github.com/spf13/cobra" ) @@ -23,6 +24,16 @@ func printVersion(cmd *cobra.Command, args []string) error { return nil } +// @title DID Resolver for did:cheqd method +// @version 1.0 +// @description Universal Resolver driver for did:cheqd method +// @contact.name Cheqd Foundation Limited +// @contact.url https://cheqd.io +// @license.name Apache 2.0 +// @license.url https://github.com/cheqd/did-resolver/blob/main/LICENSE +// @host resolver.cheqd.net +// @BasePath /1.0/identifiers +// @schemes https http func main() { rootCmd := cmd.GetRootCmd() rootCmd.AddCommand(getVersionCmd()) diff --git a/package-lock.json b/package-lock.json index 6f2b5f43..cc79fc58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1093,9 +1093,9 @@ } }, "node_modules/fastq": { - "version": "1.13.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", - "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.14.0.tgz", + "integrity": "sha512-eR2D+V9/ExcbF9ls441yIuN6TI2ED1Y2ZcA5BmMtJsOkWOFRJQ0Jt0g1UwqXJJVAb+V+umH5Dfr8oh4EVP7VVg==", "dev": true, "dependencies": { "reusify": "^1.0.4" diff --git a/services/diddoc_service.go b/services/diddoc_service.go index 97aca36d..d4e5a63e 100644 --- a/services/diddoc_service.go +++ b/services/diddoc_service.go @@ -62,7 +62,6 @@ func (dds DIDDocService) ProcessDIDRequest(did string, fragmentId string, querie return result, nil } -// https://w3c-ccg.github.io/did-resolution/#resolving func (dds DIDDocService) Resolve(did string, contentType types.ContentType) (*types.DidResolution, *types.IdentityError) { if !contentType.IsSupported() { return nil, types.NewRepresentationNotSupportedError(did, types.JSON, nil, false) @@ -98,7 +97,6 @@ func (dds DIDDocService) Resolve(did string, contentType types.ContentType) (*ty return &result, nil } -// https://w3c-ccg.github.io/did-resolution/#dereferencing func (dds DIDDocService) dereferenceSecondary(did string, fragmentId string, contentType types.ContentType) (*types.DidDereferencing, *types.IdentityError) { didResolution, err := dds.Resolve(did, contentType) if err != nil { diff --git a/services/ledger_service.go b/services/ledger_service.go index b5924f89..bf7f82d0 100644 --- a/services/ledger_service.go +++ b/services/ledger_service.go @@ -38,6 +38,22 @@ func NewLedgerService() LedgerService { return ls } +// QueryDIDDoc godoc +// +// @Summary Resolve DID Document on did:cheqd +// @Description Fetch DID Document ("DIDDoc") from cheqd network +// @Tags DID Resolution +// @Accept application/did+ld+json,application/ld+json,application/did+json +// @Produce application/did+ld+json,application/ld+json,application/did+json +// @Param did path string true "Full DID with unique identifier" +// @Param service query string false "Service Type" +// @Param fragmentId query string false "#Fragment" +// @Success 200 {object} types.DidResolution +// @Failure 400 {object} types.IdentityError +// @Failure 404 {object} types.IdentityError +// @Failure 406 {object} types.IdentityError +// @Failure 500 {object} types.IdentityError +// @Router /{did} [get] func (ls LedgerService) QueryDIDDoc(did string) (*cheqd.Did, *cheqd.Metadata, *types.IdentityError) { method, namespace, _, _ := cheqdUtils.TrySplitDID(did) serverAddr, namespaceFound := ls.ledgers[method+DELIMITER+namespace] @@ -63,6 +79,21 @@ func (ls LedgerService) QueryDIDDoc(did string) (*cheqd.Did, *cheqd.Metadata, *t return didDocResponse.Did, didDocResponse.Metadata, nil } +// QueryResource godoc +// +// @Summary Fetch specific Resource +// @Description Get specific Resource within a DID Resource Collection +// @Tags Resource Resolution +// @Accept */* +// @Produce */* +// @Param did path string true "Full DID with unique identifier" +// @Param resourceId path string true "Resource-specific unique-identifier" +// @Success 200 {object} []byte +// @Failure 400 {object} types.IdentityError +// @Failure 404 {object} types.IdentityError +// @Failure 406 {object} types.IdentityError +// @Failure 500 {object} types.IdentityError +// @Router /{did}/resources/{resourceId} [get] func (ls LedgerService) QueryResource(did string, resourceId string) (*resource.Resource, *types.IdentityError) { method, namespace, collectionId, _ := cheqdUtils.TrySplitDID(did) serverAddr, namespaceFound := ls.ledgers[method+DELIMITER+namespace] @@ -90,6 +121,20 @@ func (ls LedgerService) QueryResource(did string, resourceId string) (*resource. return resourceResponse.Resource, nil } +// QueryCollectionResources godoc +// +// @Summary Fetch metadata for all Resources +// @Description Get metadata for all Resources within a DID Resource Collection +// @Tags Resource Resolution +// @Accept application/did+ld+json,application/ld+json,application/did+json +// @Produce application/did+ld+json,application/ld+json,application/did+json +// @Param did path string true "Full DID with unique identifier" +// @Success 200 {object} types.DidDereferencing +// @Failure 400 {object} types.IdentityError +// @Failure 404 {object} types.IdentityError +// @Failure 406 {object} types.IdentityError +// @Failure 500 {object} types.IdentityError +// @Router /{did}/resources/all [get] func (ls LedgerService) QueryCollectionResources(did string) ([]*resource.ResourceHeader, *types.IdentityError) { method, namespace, collectionId, _ := cheqdUtils.TrySplitDID(did) serverAddr, namespaceFound := ls.ledgers[method+DELIMITER+namespace] diff --git a/services/request_service.go b/services/request_service.go index 0bbba6e0..29de0a63 100644 --- a/services/request_service.go +++ b/services/request_service.go @@ -26,11 +26,15 @@ func NewRequestService(didMethod string, ledgerService LedgerServiceI) RequestSe } func (rs RequestService) ResolveDIDDoc(c echo.Context) error { - splitedDID := strings.Split(c.Param("did"), "#") - did := splitedDID[0] + splitDID := strings.Split(c.Param("did"), "#") + requestedContentType := getContentType(c.Request().Header.Get(echo.HeaderAccept)) + did, err := url.QueryUnescape(splitDID[0]) + if err != nil { + return types.NewInvalidDIDUrlError(splitDID[0], requestedContentType, err, true) + } var fragmentId string - if len(splitedDID) == 2 { - fragmentId = splitedDID[1] + if len(splitDID) == 2 { + fragmentId = splitDID[1] } queryRaw, flag := prepareQueries(c) @@ -39,7 +43,6 @@ func (rs RequestService) ResolveDIDDoc(c echo.Context) error { return err } - requestedContentType := getContentType(c.Request().Header.Get(echo.HeaderAccept)) result, rErr := rs.didDocService.ProcessDIDRequest(did, fragmentId, queries, flag, requestedContentType) if rErr != nil { return rErr @@ -48,39 +51,63 @@ func (rs RequestService) ResolveDIDDoc(c echo.Context) error { return c.JSONPretty(http.StatusOK, result, " ") } +// DereferenceResourceMetadata godoc +// +// @Summary Fetch Resource-specific metadata +// @Description Get metadata for a specific Resource within a DID Resource Collection +// @Tags Resource Resolution +// @Accept application/did+ld+json,application/ld+json,application/did+json +// @Produce application/did+ld+json,application/ld+json,application/did+json +// @Param did path string true "Full DID with unique identifier" +// @Param resourceId path string true "Resource-specific unique identifier" +// @Success 200 {object} types.DidDereferencing +// @Failure 400 {object} types.IdentityError +// @Failure 404 {object} types.IdentityError +// @Failure 406 {object} types.IdentityError +// @Failure 500 {object} types.IdentityError +// @Router /{did}/resources/{resourceId}/metadata [get] func (rs RequestService) DereferenceResourceMetadata(c echo.Context) error { - did := c.Param("did") - resourceId := c.Param("resource") requestedContentType := getContentType(c.Request().Header.Get(echo.HeaderAccept)) - result, err := rs.resourceDereferenceService.DereferenceResourceMetadata(resourceId, did, requestedContentType) + did, err := getDidParam(c) if err != nil { - err.IsDereferencing = true - return err + return types.NewInvalidDIDUrlError(c.Param("did"), requestedContentType, err, true) + } + resourceId := c.Param("resource") + result, errI := rs.resourceDereferenceService.DereferenceResourceMetadata(resourceId, did, requestedContentType) + if errI != nil { + errI.IsDereferencing = true + return errI } c.Response().Header().Set(echo.HeaderContentType, result.GetContentType()) return c.JSONPretty(http.StatusOK, result, " ") } func (rs RequestService) DereferenceResourceData(c echo.Context) error { - did := c.Param("did") - resourceId := c.Param("resource") requestedContentType := getContentType(c.Request().Header.Get(echo.HeaderAccept)) - result, err := rs.resourceDereferenceService.DereferenceResourceData(resourceId, did, requestedContentType) + did, err := getDidParam(c) if err != nil { - err.IsDereferencing = true - return err + return types.NewInvalidDIDUrlError(c.Param("did"), requestedContentType, err, true) + } + resourceId := c.Param("resource") + result, errI := rs.resourceDereferenceService.DereferenceResourceData(resourceId, did, requestedContentType) + if errI != nil { + errI.IsDereferencing = true + return errI } c.Response().Header().Set(echo.HeaderContentType, result.GetContentType()) return c.Blob(http.StatusOK, result.GetContentType(), result.GetBytes()) } func (rs RequestService) DereferenceCollectionResources(c echo.Context) error { - did := c.Param("did") requestedContentType := getContentType(c.Request().Header.Get(echo.HeaderAccept)) - resolutionResponse, err := rs.resourceDereferenceService.DereferenceCollectionResources(did, requestedContentType) + did, err := getDidParam(c) if err != nil { - err.IsDereferencing = true - return err + return types.NewInvalidDIDUrlError(c.Param("did"), requestedContentType, err, true) + } + resolutionResponse, errI := rs.resourceDereferenceService.DereferenceCollectionResources(did, requestedContentType) + if errI != nil { + errI.IsDereferencing = true + return errI } c.Response().Header().Set(echo.HeaderContentType, resolutionResponse.GetContentType()) return c.JSONPretty(http.StatusOK, resolutionResponse, " ") @@ -109,3 +136,7 @@ func prepareQueries(c echo.Context) (rawQuery string, flag *string) { queryFlag := rawQuery[flagIndex:] return rawQuery[0:flagIndex], &queryFlag } + +func getDidParam(c echo.Context) (string, error) { + return url.QueryUnescape(c.Param("did")) +} diff --git a/tests/pytest/requirements.txt b/tests/pytest/requirements.txt index 3734659f..5c6cc7f5 100644 --- a/tests/pytest/requirements.txt +++ b/tests/pytest/requirements.txt @@ -1,3 +1,3 @@ -pytest==6.0.2 +pytest==6.2.5 pytest-asyncio==0.16.0 pexpect==4.8.0 \ No newline at end of file diff --git a/types/constants.go b/types/constants.go index 4ad438b9..798ed9db 100644 --- a/types/constants.go +++ b/types/constants.go @@ -27,4 +27,5 @@ const ( DID_METHOD = "cheqd" RESOLVER_PATH = "/1.0/identifiers/" RESOURCE_PATH = "/resources/" + SWAGGER_PATH = "/swagger/" ) diff --git a/types/dereferecing_metadata.go b/types/dereferecing_metadata.go index 253e1f86..e444df9d 100644 --- a/types/dereferecing_metadata.go +++ b/types/dereferecing_metadata.go @@ -3,7 +3,7 @@ package types type DereferencingMetadata ResolutionMetadata type DidDereferencing struct { - Context string `json:"@context,omitempty"` + Context string `json:"@context,omitempty" example:"https://w3id.org/did-resolution/v1"` DereferencingMetadata DereferencingMetadata `json:"dereferencingMetadata"` ContentStream ContentStreamI `json:"contentStream"` Metadata ResolutionDidDocMetadata `json:"contentMetadata"` diff --git a/types/dereferencing_content_stream.go b/types/dereferencing_content_stream.go index 38c8dc80..9f256942 100644 --- a/types/dereferencing_content_stream.go +++ b/types/dereferencing_content_stream.go @@ -3,16 +3,16 @@ package types import resource "github.com/cheqd/cheqd-node/x/resource/types" type DereferencedResource struct { - ResourceURI string `json:"resourceURI"` - CollectionId string `json:"resourceCollectionId"` - ResourceId string `json:"resourceId"` - Name string `json:"resourceName"` - ResourceType string `json:"resourceType"` - MediaType string `json:"mediaType"` - Created string `json:"created"` - Checksum string `json:"checksum"` - PreviousVersionId *string `json:"previousVersionId"` - NextVersionId *string `json:"nextVersionId"` + ResourceURI string `json:"resourceURI" example:"did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47/resources/398cee0a-efac-4643-9f4c-74c48c72a14b"` + CollectionId string `json:"resourceCollectionId" example:"55dbc8bf-fba3-4117-855c-1e0dc1d3bb47"` + ResourceId string `json:"resourceId" example:"398cee0a-efac-4643-9f4c-74c48c72a14b"` + Name string `json:"resourceName" example:"Image Resource"` + ResourceType string `json:"resourceType" example:"Image"` + MediaType string `json:"mediaType" example:"image/png"` + Created string `json:"created" example:"2021-09-01T12:00:00Z"` + Checksum string `json:"checksum" example:"a95380f460e63ad939541a57aecbfd795fcd37c6d78ee86c885340e33a91b559"` + PreviousVersionId *string `json:"previousVersionId" example:"ad7a8442-3531-46eb-a024-53953ec6e4ff"` + NextVersionId *string `json:"nextVersionId" example:"d4829ac7-4566-478c-a408-b44767eddadc"` } func NewDereferencedResource(did string, resource *resource.ResourceHeader) *DereferencedResource { diff --git a/types/did_doc.go b/types/did_doc.go index 7daba7db..492f8ab8 100644 --- a/types/did_doc.go +++ b/types/did_doc.go @@ -5,11 +5,11 @@ import ( ) type DidDoc struct { - Context []string `json:"@context,omitempty"` - Id string `json:"id,omitempty"` - Controller []string `json:"controller,omitempty"` + Context []string `json:"@context,omitempty" example:"https://www.w3.org/ns/did/v1"` + Id string `json:"id,omitempty" example:"did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47"` + Controller []string `json:"controller,omitempty" example:"did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47"` VerificationMethod []VerificationMethod `json:"verificationMethod,omitempty"` - Authentication []string `json:"authentication,omitempty"` + Authentication []string `json:"authentication,omitempty" example:"did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#key-1"` AssertionMethod []string `json:"assertionMethod,omitempty"` CapabilityInvocation []string `json:"capabilityInvocation,omitempty"` CapabilityDelegation []string `json:"capability_delegation,omitempty"` @@ -29,9 +29,9 @@ type VerificationMethod struct { type Service struct { Context []string `json:"@context,omitempty"` - Id string `json:"id,omitempty"` - Type string `json:"type,omitempty"` - ServiceEndpoint string `json:"serviceEndpoint,omitempty"` + Id string `json:"id,omitempty" example:"did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#service-1"` + Type string `json:"type,omitempty" example:"did-communication"` + ServiceEndpoint string `json:"serviceEndpoint,omitempty" example:"https://example.com/endpoint/8377464"` } func NewDidDoc(protoDidDoc cheqd.Did) DidDoc { diff --git a/types/did_doc_metadata.go b/types/did_doc_metadata.go index a306d915..ce90eba4 100644 --- a/types/did_doc_metadata.go +++ b/types/did_doc_metadata.go @@ -6,10 +6,10 @@ import ( ) type ResolutionDidDocMetadata struct { - Created string `json:"created,omitempty"` - Updated string `json:"updated,omitempty"` - Deactivated bool `json:"deactivated,omitempty"` - VersionId string `json:"versionId,omitempty"` + Created string `json:"created,omitempty" example:"2021-09-01T12:00:00Z"` + Updated string `json:"updated,omitempty" example:"2021-09-10T12:00:00Z"` + Deactivated bool `json:"deactivated,omitempty" example:"false"` + VersionId string `json:"versionId,omitempty" example:"4979BAF49599FEF0BAD5ED0849FDD708156761EBBC8EBE78D0907F8BECC9CB2E"` Resources []DereferencedResource `json:"linkedResourceMetadata,omitempty"` } diff --git a/types/resolution_metadata.go b/types/resolution_metadata.go index 1aaa26c7..e172daf4 100644 --- a/types/resolution_metadata.go +++ b/types/resolution_metadata.go @@ -7,9 +7,9 @@ import ( ) type ResolutionMetadata struct { - ContentType ContentType `json:"contentType,omitempty"` + ContentType ContentType `json:"contentType,omitempty" example:"application/did+ld+json"` ResolutionError string `json:"error,omitempty"` - Retrieved string `json:"retrieved,omitempty"` + Retrieved string `json:"retrieved,omitempty" example:"2021-09-01T12:00:00Z"` DidProperties DidProperties `json:"did,omitempty"` }