Skip to content

Commit

Permalink
Add custom did methods and IPFS gateway to config (#10)
Browse files Browse the repository at this point in the history
add custom did methods and ipfs gateway in config
  • Loading branch information
daveroga authored Apr 26, 2024
1 parent ee38326 commit 1e14c78
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 107 deletions.
10 changes: 7 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
IPFS_URL="<IPFS_URL>"
SUPPORTED_RPC="<CHAIN_ID=RPC_URL>"
SUPPORTED_STATE_CONTRACTS="80001=0x134B1BE34911E39A8397ec6289782989729807a4"
SUPPORTED_ISSUERS="<ISSUER_DID|*=ISSUER_NODE_URL>"
IPFS_GATEWAY_URL="<IPFS_GATEWAY_URL>"
SERVER_HOST="<SERVER_HOST>"
HTTP_CONFIG_PATH="<PATH_TO_HTTP_CONFIGURATION>"
SUPPORTED_RPC="<CHAIN_ID=RPC_URL>"
SUPPORTED_STATE_CONTRACTS="80002=0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124"
CIRCUITS_FOLDER_PATH="<PATH_TO_FOLDER_WITH_CIRCUITS>"
ISSUERS_BASIC_AUTH="<ISSUER_DID|*=user:password>"
SUPPORTED_CUSTOM_DID_METHODS='[{"blockchain":"linea","network":"testnet","networkFlag":"0b01000001","chainID":59140}]'
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ It is **important to note** that the refresh service imposes a constraint on non

To run this service, users should manage two configurations: one in a `.env` file and another in `config.yaml`. `.env` configuration is used for configure the server, `config.yaml` configuration is used for configure HTTP data provider.
1. `.env` file:
```
SUPPORTED_ISSUERS - A list of supported issuers in the format `issuerDID=issuerNodeURL`. You can also use `*` to set a default node.
IPFS_URL - The URL of the IPFS node.
SERVER_PORT - The server port. The default is 8002.
HTTP_CONFIG_PATH - The path to the HTTP configuration.
SUPPORTED_RPC - Supported RPC in the format `chainID=URL`.
SUPPORTED_STATE_CONTRACTS - Supported state contracts in the format `chainID=contractAddress`.
CIRCUITS_FOLDER_PATH - The path to the circuits folder.
ISSUERS_BASIC_AUTH - Basic auth for issuer int the format `issuerDID=user:password`. You can also use `*` to set the basic auth for all issuers.
```

| Config Name | Description | Required | Default Value | Format | Example |
|----------------------------|-----------------------------------------------------------------------------------------------|----------|---------------------|----------|-------------------------------------------------------------------|
| SUPPORTED_ISSUERS | A list of supported issuers with their corresponding node URLs. | Yes | - | `issuerDID=issuerNodeURL,...` | `did:example:issuer1=https://issuer1.com,did:example:issuer2=https://issuer2.com`<br/>or<br/>`*=https://common.issuer.com>` |
| IPFS_GATEWAY_URL | The URL of the IPFS gateway. | No | https://ipfs.io | URL | `https://ipfs.example.com` |
| SERVER_HOST | The server host. | No | localhost:8002 | Host:Port | `localhost:8002` |
| HTTP_CONFIG_PATH | The path to the HTTP provider configuration. | No | config.yaml | Path | `/path/to/http/config` |
| SUPPORTED_RPC | Supported RPC endpoints for different blockchain chains. | Yes | - | `chainID=RPC_URL,...` | `80002=https://amoy.infura,137=https://main.infura` |
| SUPPORTED_STATE_CONTRACTS | Supported state contracts for different blockchain chains. | Yes | - | `chainID=contractAddress,...` | `80002=0x123abc...,137=0x456def...` |
| CIRCUITS_FOLDER_PATH | The path to the circuits folder. | No | keys | Path | `/path/to/circuits` |
| ISSUERS_BASIC_AUTH | Basic authentication credentials for issuer nodes. | No | - | `issuerDID=user:password,...` | `did:example:issuer1=admin:pass123,did:example:issuer2=guest:pass321`<br/>or<br/>`*=common:pass987` |
| SUPPORTED_CUSTOM_DID_METHODS | Register custom networks for DID methods. | No | - | JSON Array | `[{"blockchain":"linea","network":"testnet","networkFlag":"0b01000001","chainID":59140}]` |

2. `config.yaml` for configure HTTP request to data providers:
Example:
```yml
Expand Down Expand Up @@ -65,11 +68,7 @@ Example:
```

## How to run:
1. Build the docker container:
```bash
docker build -t refresh-service:local .
```
2. Run the docker container:
1. Run docker-compose file:
```bash
docker run --env-file .env -v ./config.yaml:/app/config.yaml .
docker-compose up -d
```
12 changes: 12 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3'
services:
refresh-service:
build:
context: .
dockerfile: Dockerfile
volumes:
- ./config.yaml:/app/config.yaml:ro
ports:
- 8002:8002
env_file:
- .env
33 changes: 9 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ require (
github.com/google/uuid v1.3.0
github.com/iden3/contracts-abi/state/go/abi v1.0.1
github.com/iden3/go-circuits/v2 v2.0.0
github.com/iden3/go-iden3-core/v2 v2.0.3
github.com/iden3/go-iden3-core/v2 v2.1.1
github.com/iden3/go-jwz/v2 v2.0.0
github.com/iden3/go-schema-processor/v2 v2.2.0
github.com/iden3/iden3comm/v2 v2.0.1-0.20231030214854-7a0511d0e7cc
github.com/ipfs/go-ipfs-api v0.6.0
github.com/kelseyhightower/envconfig v1.4.0
github.com/piprate/json-gold v0.5.1-0.20230111113000-6ddbe6e6f19f
github.com/pkg/errors v0.9.1
Expand All @@ -25,12 +24,10 @@ require (
require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/bits-and-blooms/bitset v1.5.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.10.0 // indirect
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 // indirect
github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dchest/blake512 v1.0.0 // indirect
Expand All @@ -42,6 +39,7 @@ require (
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/iden3/go-iden3-crypto v0.0.15 // indirect
Expand All @@ -51,51 +49,38 @@ require (
github.com/iden3/go-rapidsnark/verifier v0.0.5 // indirect
github.com/iden3/go-rapidsnark/witness/v2 v2.0.0 // indirect
github.com/iden3/go-rapidsnark/witness/wazero v0.0.0-20230524142950-0986cf057d4e // indirect
github.com/ipfs/boxo v0.8.0 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/lestrrat-go/blackmagic v1.0.1 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/httprc v1.0.4 // indirect
github.com/lestrrat-go/iter v1.0.2 // indirect
github.com/lestrrat-go/jwx/v2 v2.0.12 // indirect
github.com/lestrrat-go/option v1.0.1 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-flow-metrics v0.1.0 // indirect
github.com/libp2p/go-libp2p v0.28.1 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multiaddr v0.9.0 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multicodec v0.9.0 // indirect
github.com/multiformats/go-multihash v0.2.2 // indirect
github.com/multiformats/go-multistream v0.4.1 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.3.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/tetratelabs/wazero v1.1.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/whyrusleeping/tar-utils v0.0.0-20201201191210-20a61371de5b // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/goleak v1.1.12 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/tools v0.9.1 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/go-jose/go-jose.v2 v2.6.1 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading

0 comments on commit 1e14c78

Please sign in to comment.