Skip to content

Commit

Permalink
feat!: Support v2 protos [DEV-1912] (#67)
Browse files Browse the repository at this point in the history
* feat: Support v2 protos

* fix: Remove local dependency

* fix: Test cases

* feat: Remove fixCheckSum helper

* build: Upgrade cheqd-node

* Update to latest cheqd-node package

* Update Dockerfile

* fix: Resolution metadata unittest

* feat: Support version query && fix Unit tests

* feat: Parse verification material in result

* feat: Support Migrated DIDs

* feat: Add query in swagger && fix unit test

* build: Upgrade cheqd-node

* fix: Modify publicKeyJWK type

* go mod tidy

* go mod tidy

* feat: Upgrade latest cheqd-node

* feat: Update verificationMethod resolution

* build: Upgrade latest cheqd-node

* fix: Error comparison

* Fix problem with integration tests

* Refactor unit tests

* Update RESOURCE_DATA variable

* Commit Mainnet DIDs in integration tests

* test: Add migrated DID tests

* feat: Add verificationKey contexts

* fix: Uint tests

* Add API for getting DIDDoc specific version

* Add integration test for testing API for getting specific DID version

* Add negative integration test for testing API getting specific DID version

* Add API for getting all DIDDoc versions

* Refactor code

* Add integration tests for testing get all DID versions API

* Change API for getting metadata for all resources in collection

* Remove not need integration tests

* We should use already implemented migrations functions instead of create own

---------

Co-authored-by: Ankur Banerjee <ankurdotb@users.noreply.github.com>
Co-authored-by: abdulla-ashurov <abdulla.ashurov@dsr-corporation.com>
  • Loading branch information
3 people committed Jan 30, 2023
1 parent 0f5651e commit 2ee30bd
Show file tree
Hide file tree
Showing 27 changed files with 664 additions and 415 deletions.
9 changes: 3 additions & 6 deletions cmd/serve.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cmd

import (
"net/http"

"github.com/cheqd/did-resolver/services"
"github.com/cheqd/did-resolver/types"
"github.com/cheqd/did-resolver/utils"
Expand Down Expand Up @@ -64,12 +62,11 @@ func serve() {
// Routes
e.GET(types.SWAGGER_PATH, echoSwagger.WrapHandler)
e.GET(types.RESOLVER_PATH+":did", requestService.ResolveDIDDoc)
e.GET(types.RESOLVER_PATH+":did"+types.DID_VERSION_PATH+":version", requestService.ResolveDIDDocVersion)
e.GET(types.RESOLVER_PATH+":did"+types.DID_VERSIONS_PATH, requestService.ResolveAllDidDocVersionsMetadata)
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)
e.GET(types.RESOLVER_PATH+":did"+types.RESOURCE_PATH+"all", requestService.DereferenceCollectionResources)
e.GET(types.RESOLVER_PATH+":did"+types.RESOURCE_PATH+"", func(c echo.Context) error {
return c.Redirect(http.StatusMovedPermanently, "all")
})
e.GET(types.RESOLVER_PATH+":did"+types.DID_METADATA, requestService.DereferenceCollectionResources)

log.Info().Msg("Starting listener")
log.Fatal().Err(e.Start(config.ResolverListener))
Expand Down
15 changes: 13 additions & 2 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ const docTemplate = `{
"description": "#Fragment",
"name": "fragmentId",
"in": "query"
},
{
"type": "string",
"description": "Version",
"name": "versionId",
"in": "query"
}
],
"responses": {
Expand Down Expand Up @@ -581,8 +587,13 @@ const docTemplate = `{
"example": "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#service-1"
},
"serviceEndpoint": {
"type": "string",
"example": "https://example.com/endpoint/8377464"
"type": "array",
"items": {
"type": "string"
},
"example": [
"https://example.com/endpoint/8377464"
]
},
"type": {
"type": "string",
Expand Down
15 changes: 13 additions & 2 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
"description": "#Fragment",
"name": "fragmentId",
"in": "query"
},
{
"type": "string",
"description": "Version",
"name": "versionId",
"in": "query"
}
],
"responses": {
Expand Down Expand Up @@ -573,8 +579,13 @@
"example": "did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#service-1"
},
"serviceEndpoint": {
"type": "string",
"example": "https://example.com/endpoint/8377464"
"type": "array",
"items": {
"type": "string"
},
"example": [
"https://example.com/endpoint/8377464"
]
},
"type": {
"type": "string",
Expand Down
11 changes: 9 additions & 2 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,11 @@ definitions:
example: did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#service-1
type: string
serviceEndpoint:
example: https://example.com/endpoint/8377464
type: string
example:
- https://example.com/endpoint/8377464
items:
type: string
type: array
type:
example: did-communication
type: string
Expand Down Expand Up @@ -254,6 +257,10 @@ paths:
in: query
name: fragmentId
type: string
- description: Version
in: query
name: versionId
type: string
produces:
- application/did+ld+json
- application/ld+json
Expand Down
68 changes: 37 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ module github.com/cheqd/did-resolver
go 1.18

require (
github.com/cheqd/cheqd-node v0.6.10
github.com/labstack/echo/v4 v4.10.0
github.com/cheqd/cheqd-node v1.2.2
github.com/labstack/echo/v4 v4.9.1
github.com/mr-tron/base58 v1.2.0
github.com/rs/zerolog v1.28.0
github.com/spf13/cobra v1.6.1
github.com/spf13/viper v1.14.0
Expand All @@ -14,28 +15,35 @@ require (
google.golang.org/grpc v1.51.0
)

require (
github.com/99designs/go-keychain v0.0.0-20160105221929-9cf53c87839c // indirect
github.com/cosmos/cosmos-proto v1.0.0-alpha8 // indirect
github.com/cosmos/gorocksdb v1.2.0 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/klauspost/compress v1.15.11 // indirect
)

require (
github.com/google/uuid v1.3.0
google.golang.org/protobuf v1.28.1 // indirect
google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 // indirect
)

require (
filippo.io/edwards25519 v1.0.0-beta.2 // indirect
github.com/DataDog/zstd v1.4.5 // indirect
filippo.io/edwards25519 v1.0.0-rc.1 // 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/armon/go-metrics v0.4.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd v0.22.1 // indirect
github.com/btcsuite/btcd v0.22.2 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/confio/ics23/go v0.7.0 // indirect
github.com/cosmos/btcutil v1.0.4 // indirect
github.com/cosmos/cosmos-sdk v0.45.9 // indirect
github.com/confio/ics23/go v0.9.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/cosmos-sdk v0.46.8 // indirect
github.com/cosmos/gogoproto v1.4.3 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d // indirect
github.com/dgraph-io/badger/v2 v2.2007.2 // indirect
github.com/dgraph-io/ristretto v0.0.3 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
github.com/dgraph-io/ristretto v0.1.0 // indirect
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
Expand All @@ -51,12 +59,12 @@ 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/golang/snappy v0.0.3 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.0.1 // indirect
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
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
Expand All @@ -74,9 +82,8 @@ require (
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/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mr-tron/base58 v1.1.0 // indirect
github.com/multiformats/go-base32 v0.0.3 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect
github.com/multiformats/go-multibase v0.1.1 // indirect
Expand All @@ -88,30 +95,29 @@ require (
github.com/prometheus/client_golang v1.12.2 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.34.0 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/sasha-s/go-deadlock v0.2.1-0.20190427202633-1595213edefa // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
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/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // 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
github.com/tendermint/tendermint v0.34.24 // indirect
github.com/tendermint/tm-db v0.6.7 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
golang.org/x/crypto v0.2.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
golang.org/x/time v0.2.0 // indirect
golang.org/x/tools v0.1.12 // indirect
google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
golang.org/x/tools v0.2.0 // indirect
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 // 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
Expand Down
Loading

0 comments on commit 2ee30bd

Please sign in to comment.