generated from cheqd/.github
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from cheqd/dev-1074-did-resolver
DEV-1074: Add DID resolution implementation
- Loading branch information
Showing
18 changed files
with
2,507 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: "Build" | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
|
||
check-building: | ||
name: "Check binary building" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.17' | ||
|
||
- name: Run Golang build | ||
run: go build main.go | ||
|
||
try-docker-build: | ||
name: "Check docker building" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Check docker building | ||
working-directory: . | ||
run: docker build -f docker/Dockerfile . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: "Workflow Dispatch" | ||
on: push | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
|
||
jobs: | ||
|
||
call-lint: | ||
name: "Lint" | ||
uses: ./.github/workflows/markdown-lint.yml | ||
|
||
call-build: | ||
name: "Build" | ||
needs: call-lint | ||
uses: ./.github/workflows/build.yml | ||
|
||
call-test: | ||
name: "Tests" | ||
needs: call-build | ||
uses: ./.github/workflows/test.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
name: Markdown quality control | ||
|
||
on: | ||
on: | ||
workflow_call: | ||
push: | ||
paths: | ||
- '**.md' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: "Test" | ||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
|
||
go-unit-tests: | ||
name: "Golang unit tests" | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.17' | ||
|
||
- name: Run Golang unit tests | ||
run: go test -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
method: cheqd | ||
listener: 0.0.0.0:1313 | ||
path: "/1.0/identifiers/:did" | ||
ledgerTimeout: 5s | ||
loglevel: debug | ||
|
||
networks: | ||
mainnet: rpc.cheqd.net:443 | ||
testnet: 159.89.208.88:443 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Port which will be used for incoming requests on resolver side | ||
RESOLVER_PORT="1313" | ||
|
||
# Drivers port for application side. | ||
# For example, if you application will send requests to http://localhost/ | ||
# then port should be 80 | ||
REDIRECTED_PORT="80" | ||
|
||
# Local address which is used by user application | ||
LOCAL_REDIRECT_FROM=localhost:80 | ||
|
||
# Address with port of external Cheqd-DID-Resolver. | ||
EXTERNAL_REDIRECT_TO=http://localhost:1313 | ||
|
||
|
||
CHEQD_RESOLVER_HOME_DIR="/home/cheqd-resolver" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
############################################################### | ||
### STAGE 1: Build cheqd-did-resolver binary pre-requisites ### | ||
############################################################### | ||
|
||
FROM golang:1.17.8-buster as builder | ||
|
||
WORKDIR /root | ||
|
||
COPY types ./types | ||
COPY services ./services | ||
COPY go.mod . | ||
COPY go.sum . | ||
COPY main.go . | ||
|
||
# Make cheqd-did-resolver binary | ||
RUN go build -o cheqd-did-resolver main.go | ||
|
||
############################################################### | ||
### STAGE 2: Build cheqd-did-resolver runner ### | ||
############################################################### | ||
|
||
FROM ubuntu:focal AS runner | ||
LABEL org.opencontainers.image.description "Cheqd DID-Resolver runner" | ||
LABEL org.opencontainers.image.source "https://github.com/cheqd/cheqd-did-resolver" | ||
ENV CHEQD_RESOLVER_HOME_DIR="/home/cheqd-resolver" | ||
|
||
# Set user directory and details | ||
ARG UID=1000 | ||
ARG GID=1000 | ||
# Add cheqd user to use in the container | ||
RUN groupadd --system --gid $GID cheqd-resolver \ | ||
&& useradd --system --create-home --home-dir ${CHEQD_RESOLVER_HOME_DIR} --shell /bin/bash --gid cheqd-resolver --uid $UID cheqd-resolver | ||
|
||
# Copy compiled cheqd-did-resolver binary from Stage 1 | ||
COPY --from=builder /root /bin | ||
|
||
# Copy base config.yaml | ||
WORKDIR ${CHEQD_RESOLVER_HOME_DIR} | ||
|
||
USER cheqd-resolver | ||
EXPOSE 1313 | ||
ENTRYPOINT ["cheqd-did-resolver"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
version: '3.7' | ||
|
||
|
||
services: | ||
did_resolver: | ||
build: | ||
dockerfile: docker/Dockerfile | ||
context: ../ | ||
configs: | ||
- source: config | ||
target: ${CHEQD_RESOLVER_HOME_DIR}/config.yaml | ||
expose: | ||
- ${RESOLVER_PORT} | ||
ports: | ||
- "${RESOLVER_PORT}:${RESOLVER_PORT}" | ||
profiles: | ||
- full | ||
|
||
redirect: | ||
image: morbz/docker-web-redirect | ||
restart: always | ||
ports: | ||
- "${REDIRECTED_PORT}:${REDIRECTED_PORT}" | ||
environment: | ||
- VIRTUAL_HOST={LOCAL_REDIRECT_FROM} | ||
- REDIRECT_TARGET=${EXTERNAL_REDIRECT_TO} | ||
profiles: | ||
- light | ||
|
||
configs: | ||
config: | ||
file: ../config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
module github.com/cheqd/cheqd-did-resolver | ||
|
||
go 1.17 | ||
|
||
require ( | ||
github.com/cheqd/cheqd-node v0.5.0 | ||
github.com/labstack/echo/v4 v4.7.2 | ||
github.com/stretchr/testify v1.7.1 | ||
google.golang.org/grpc v1.45.0 | ||
) | ||
|
||
require ( | ||
filippo.io/edwards25519 v1.0.0-beta.2 // indirect | ||
github.com/DataDog/zstd v1.4.5 // indirect | ||
github.com/armon/go-metrics v0.3.10 // indirect | ||
github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 // indirect | ||
github.com/beorn7/perks v1.0.1 // indirect | ||
github.com/btcsuite/btcd v0.22.0-beta // 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.1 // 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/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect | ||
github.com/dustin/go-humanize v1.0.0 // indirect | ||
github.com/fsnotify/fsnotify v1.5.1 // indirect | ||
github.com/go-kit/kit v0.12.0 // indirect | ||
github.com/go-kit/log v0.2.0 // indirect | ||
github.com/go-logfmt/logfmt v0.5.1 // indirect | ||
github.com/go-ozzo/ozzo-validation/v4 v4.3.0 // indirect | ||
github.com/goccy/go-json v0.9.4 // indirect | ||
github.com/golang/snappy v0.0.3 // indirect | ||
github.com/google/btree v1.0.0 // 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/hcl v1.0.0 // indirect | ||
github.com/inconshreveable/mousetrap v1.0.0 // indirect | ||
github.com/jmhodges/levigo v1.0.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.0 // indirect | ||
github.com/lestrrat-go/iter v1.0.1 // indirect | ||
github.com/lestrrat-go/jwx v1.2.20 // indirect | ||
github.com/lestrrat-go/option v1.0.0 // indirect | ||
github.com/libp2p/go-buffer-pool v0.0.2 // indirect | ||
github.com/magiconair/properties v1.8.6 // indirect | ||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect | ||
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 // indirect | ||
github.com/mitchellh/mapstructure v1.4.3 // 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.0.3 // indirect | ||
github.com/pelletier/go-toml v1.9.4 // indirect | ||
github.com/pelletier/go-toml/v2 v2.0.0-beta.8 // indirect | ||
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
github.com/prometheus/client_golang v1.11.0 // indirect | ||
github.com/prometheus/client_model v0.2.0 // indirect | ||
github.com/prometheus/common v0.30.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/spf13/afero v1.8.2 // indirect | ||
github.com/spf13/cast v1.4.1 // indirect | ||
github.com/spf13/cobra v1.2.1 // indirect | ||
github.com/spf13/jwalterweatherman v1.1.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/spf13/viper v1.11.0 // indirect | ||
github.com/subosito/gotenv v1.2.0 // 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.15 // 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-20220407144326-9054f6ed7bac // indirect | ||
google.golang.org/protobuf v1.28.0 // indirect | ||
gopkg.in/ini.v1 v1.66.4 // indirect | ||
gopkg.in/yaml.v2 v2.4.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // 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 | ||
github.com/labstack/gommon v0.3.1 // 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-20220411220226-7b82a4e95df4 // indirect | ||
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect | ||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect | ||
golang.org/x/text v0.3.7 // indirect | ||
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect | ||
) | ||
|
||
replace ( | ||
// Fix upstream GHSA-h395-qcrw-5vmq vulnerability. | ||
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0 | ||
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 | ||
) |
Oops, something went wrong.