Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse indy-node-container image #112

Closed
Show file tree
Hide file tree
Changes from 72 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
8b89763
did:indy resolver
domwoe Feb 21, 2022
233e050
new nym request
domwoe Feb 21, 2022
3d8b5fe
do not add resolver in legacy mode
domwoe Feb 21, 2022
a4fddcd
sync with IDunion/indy-did-resolver
domwoe Mar 8, 2022
98b088d
renaming Value to SJsonValue
domwoe Mar 8, 2022
9d993de
invert feature flag logic: legacy -> did_indy
domwoe Mar 8, 2022
a7c1dd5
format
domwoe Mar 8, 2022
37887ac
small fix in test dependencies
domwoe Mar 8, 2022
cfb948f
nym and get_nym + proxy. No wrappers
domwoe Mar 8, 2022
f52d3a0
adapt python wrapper
domwoe Mar 8, 2022
f71d03b
remove feature
domwoe Mar 8, 2022
01df1d8
minimal changes to nodejs wrapper
domwoe Mar 8, 2022
7e922c1
minimal changes to go wrapper
domwoe Mar 8, 2022
84aafbd
test build
domwoe Mar 8, 2022
8ed4a0f
format
domwoe Mar 8, 2022
d8427ed
fix nym builder in tests and try to fix go wrapper
domwoe Mar 8, 2022
e9c8ce2
another attempt to fix go wrapper
domwoe Mar 8, 2022
2c9d6c1
not working due to lifetimes
domwoe Mar 11, 2022
139c538
run tests
domwoe Mar 11, 2022
041fd8d
ffi resolver working for single request
domwoe Mar 14, 2022
581c00b
optional parameters in get_nym
domwoe Mar 15, 2022
71ca5d6
started clean up of ffi resolver
domwoe Mar 15, 2022
c478b5f
remove chrono dependency and use time-rs instead
domwoe Mar 15, 2022
af33d9c
simplifying module imports
domwoe Mar 15, 2022
8a73927
format
domwoe Mar 15, 2022
d6a5fb4
ffi without fetching legacy endpoint working
domwoe Mar 15, 2022
18b774f
fix query params in proxy
domwoe Mar 15, 2022
20798a4
format..
domwoe Mar 15, 2022
f7fe8d4
remove some unecessary code
domwoe Mar 15, 2022
49bf453
removed unecessary enum
domwoe Mar 15, 2022
6403f45
merge main
domwoe Mar 15, 2022
40c3625
add self-certification version. Try to fix wrappers
domwoe Mar 15, 2022
b2b50f2
fix integration tests
domwoe Mar 15, 2022
8c77dd5
fmt
domwoe Mar 15, 2022
6aab88f
add selfCertificationVersion to didDocumentMetadata
domwoe Mar 15, 2022
c81f034
Merge pull request #84 from domwoe/ffi-resolver
andrewwhitehead Mar 17, 2022
39537cb
nym with diddoc_Content integration test
domwoe Mar 15, 2022
d4f95c7
refactor
domwoe Mar 23, 2022
2e4fdea
add comments to go wrapper
domwoe Mar 23, 2022
b9f212f
multiple ledger support for proxy. Refresh not implemented
domwoe Mar 23, 2022
5eb5990
merge did-indy branch
domwoe Mar 23, 2022
76e75cf
refresh
domwoe Mar 23, 2022
b5e22c9
fmt
domwoe Mar 23, 2022
4101834
add get nym query parameters in readme
domwoe Mar 24, 2022
67c8058
Python wrapper with multi-ledger resolver
domwoe Mar 24, 2022
a611ca0
Merge pull request #86 from domwoe/feature/proxy-with-multiple-ledger…
domwoe Mar 24, 2022
30bfcb7
small cleanups
domwoe Mar 24, 2022
a7167fe
modify gitignore
domwoe Mar 24, 2022
816fb34
add a few more comments
domwoe Mar 24, 2022
22a9e04
remove print statement
domwoe Mar 24, 2022
cd58ab9
handle legacy endpoints on wrapper layer
domwoe Mar 25, 2022
974f595
disable enforcement of diddoc_content validation
domwoe Mar 25, 2022
9906f32
implement some of the clippy suggestions
domwoe Mar 28, 2022
c1bb498
formatting
domwoe Mar 28, 2022
28db57d
self-certification tests. Some uncommented because of indy-utils gene…
domwoe Mar 29, 2022
5d0fa6a
small fixes
domwoe Mar 29, 2022
f7585dd
Get attrib with optional seq_no and timestamp
domwoe Mar 30, 2022
390db9e
fix did with query parameters
domwoe Mar 30, 2022
7093808
update local_nodes_pool attrib tests
domwoe Apr 1, 2022
7a82ad4
remove debug loglevel
domwoe Apr 1, 2022
d3d684a
Merge branch 'feature/self-cert-version-tests' into feature/get-attri…
domwoe Apr 1, 2022
92d4311
Merge pull request #4 from domwoe/feature/get-attrib-versions
domwoe Apr 1, 2022
5e1e95a
attempt to harden resolver test
domwoe Apr 1, 2022
d1cf24e
fmt
domwoe Apr 1, 2022
f76735d
Merge pull request #87 from domwoe/feature/python-with-multiple-ledge…
andrewwhitehead Apr 7, 2022
f538397
fix readme for indy-vdr-proxy
domwoe Apr 12, 2022
1470f0d
Merge pull request #90 from domwoe/fix/flag-instead-arg
andrewwhitehead Jun 23, 2022
5161a25
Correctly use the networks folder of the repository
c2bo Oct 25, 2022
0544131
Merge pull request #105 from boschresearch/fix/repository-structure
andrewwhitehead Oct 25, 2022
f2483cf
fix verkey expansion
c2bo Oct 25, 2022
f1345bb
Merge pull request #104 from boschresearch/fix/expand-verkey
andrewwhitehead Nov 1, 2022
a8cc16e
Re-use indy-node-container images as base for system tests
c2bo Nov 10, 2022
17af328
Use new naming convention of indy-node-container
c2bo Jan 16, 2023
52c9216
extend the bash script for local testing
c2bo Feb 15, 2023
4345376
use new rc5 version for tests
c2bo Feb 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.git
target
github
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: "Indy-VDR"

on:
push:
branches: [main]
branches: [main, did-indy]
pull_request:
branches: [main]
branches: [main, did-indy]
release:
types: [created]
workflow_dispatch:
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --manifest-path libindy_vdr/Cargo.toml --features local_nodes_pool
args: --manifest-path libindy_vdr/Cargo.toml --features local_nodes_pool,local_nodes_pool_did_indy

build-manylinux:
name: Build Library (Manylinux)
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ node_modules
Podfile.lock
.vscode
coverage
github
networks
58 changes: 40 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,49 @@ At a later stage it should be possible to install a precompiled 'wheel' package

## Proxy Server

The `indy-vdr-proxy` executable can be used to provide a simple REST API for interacting with the ledger. Command line options can be inspected by running `indy-vdr-proxy --help`.
The `indy-vdr-proxy` executable can be used to provide a simple REST API for interacting with one or more Indy ledgers. Command line options can be inspected by running `indy-vdr-proxy --help`.

Responses can be formatted in either HTML or JSON formats. HTML formatting is selected when the `text/html` content type is requested according to the Accept header (as sent by web browsers) or the request query string is set to `?html`. JSON formatting is selected otherwise, and may be explitly selected by using the query string `?raw`. For most ledger requests, JSON responses include information regarding which nodes were contacted is returned in the `X-Requests` header.
To start the proxy server for a single ledger use the following command:
```
indy-vdr-proxy -p <PORT> (-g <OPTIONAL_PATH_TO_GENESIS_FILE>)
```

To start the proxy server with the standard configuration of indy ledgers use the following command:
`indy-vdr-proxy -p <PORT> -- --multiple-ledgers`
This will get the ledger configuration from `https://github.com/IDunion/indy-did-networks`

Sending prepared requests to the ledger is performed by delivering a POST request to the `/submit` endpoint, where the body of the request is the JSON-formatted payload. Additional endpoints are provided as shortcuts for ledger read transactions:

- `/` The root path shows basic status information about the server and the ledger pool
- `/genesis` Return the current set of genesis transactions
- `/taa` Fetch the current ledger Transaction Author Agreement
- `/aml` Fetch the current ledger Acceptance Methods List (for the TAA)
- `/nym/{DID}` Fetch the NYM transaction associated with a DID
- `/attrib/{DID}/endpoint` Fetch the registered endpoint for a DID
- `/schema/{SCHEMA_ID}` Fetch a schema by its identifier
- `/cred_def/{CRED_DEF_ID}` Fetch a credential definition by its identifier
- `/rev_reg/{REV_REG_ID}` Fetch a revocation registry by its identifier
- `/rev_reg_def/{REV_REG_ID}` Fetch a revocation registry definition by its registry identifier
- `/rev_reg_delta/{REV_REG_ID}` Fetch a revocation registry delta by its registry identifier
- `/auth` Fetch all AUTH rules for the ledger
- `/auth/{TXN_TYPE}/{ADD|EDIT}` Fetch the AUTH rule for a specific transaction type and action
- `/txn/{SUBLEDGER}/{SEQ_NO}` Fetch a specific transaction by subledger identifier (0-2, or one of `pool`, `domain`, or `config`) and sequence number.
A custom ledger configuration can be provided either by specificing a Github repo or a local folder:
```
indy-vdr-proxy -p <PORT> -g <GITHUB_URL or PATH_TO_FOLDER> -- --multiple-ledgers
```
The structure needs to be as follows `<NAMESPACE>/OPTIONAL<SUB_NAMESPACE>/pool_transactions_genesis.json`, e.g. `/sovrin/staging/pool_transactions_genesis.json`

Responses can be formatted in either HTML or JSON formats. HTML formatting is selected when the `text/html` content type is requested according to the Accept header (as sent by web browsers) or the request query string is set to `?html`. JSON formatting is selected otherwise, and may be explitly selected by using the query string `?raw`. For most ledger requests, JSON responses include information regarding which nodes were contacted is returned in the `X-Requests` header.

Sending prepared requests to the ledger is performed by delivering a POST request to the `{LEDGER}/submit` endpoint, where the body of the request is the JSON-formatted payload. Additional endpoints are provided as shortcuts for ledger read transactions:
- `/` Return configured ledgers
- `{LEDGER}/` Basic status information about the server and the ledger pool
- `{LEDGER}/genesis` Return the current set of genesis transactions
- `{LEDGER}/taa` Fetch the current ledger Transaction Author Agreement
- `{LEDGER}/aml` Fetch the current ledger Acceptance Methods List (for the TAA)
- `{LEDGER}/nym/{DID}` Fetch the NYM transaction associated with an unqualified DID. Can be used with `timestamp` or `seq_no` query parameters to fetch specific versions
- `{LEDGER}/attrib/{DID}/endpoint` Fetch the registered endpoint for an unqualified DID
- `{LEDGER}/schema/{SCHEMA_ID}` Fetch a schema by its identifier
- `{LEDGER}/cred_def/{CRED_DEF_ID}` Fetch a credential definition by its identifier
- `{LEDGER}/rev_reg/{REV_REG_ID}` Fetch a revocation registry by its identifier
- `{LEDGER}/rev_reg_def/{REV_REG_ID}` Fetch a revocation registry definition by its registry identifier
- `{LEDGER}/rev_reg_delta/{REV_REG_ID}` Fetch a revocation registry delta by its registry identifier
- `{LEDGER}/auth` Fetch all AUTH rules for the ledger
- `{LEDGER}/auth/{TXN_TYPE}/{ADD|EDIT}` Fetch the AUTH rule for a specific transaction type and action
- `{LEDGER}/txn/{SUBLEDGER}/{SEQ_NO}` Fetch a specific transaction by subledger identifier (0-2, or one of `pool`, `domain`, or `config`) and sequence number.

If the proxy server is used with a single ledger, the `{LEDGER}` part of the path must be omitted.

### DID:Indy Resolver

Indy VDR contains a DID Resolver to resolve DIDs and dereference DID Urls to ledger objects from configured ledgers according to the [did:indy specification](https://hyperledger.github.io/indy-did-method/).

`GET /1.0/identifiers/{DID or DID_URL}`
## Connecting to a Ledger

Whether using the library or the proxy server, you will need a `genesis.txn` file containing the set of pool genesis transactions. You can run a local pool in Docker using [VON-Network](https://github.com/bcgov/von-network) or follow the [Indy-SDK instructions](https://github.com/hyperledger/indy-sdk#how-to-start-local-nodes-pool-with-docker).
Expand Down
46 changes: 2 additions & 44 deletions ci/indy-pool.dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,7 @@
FROM ubuntu:16.04

ARG uid=1000

# Install environment
RUN apt-get update -y && apt-get install -y \
git \
wget \
python3.5 \
python3-nacl \
python3-pip \
python3-setuptools \
apt-transport-https \
ca-certificates \
software-properties-common

RUN pip3 install -U \
"pip~=9.0" \
"setuptools~=50.0" \
"supervisor~=4.2"

RUN add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu xenial main universe" && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CE7709D068DB5E88
ARG indy_stream=master
RUN add-apt-repository "deb https://repo.sovrin.org/deb xenial ${indy_stream}" && \
add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial stable"

RUN useradd -ms /bin/bash -u $uid indy

ARG indy_plenum_ver=1.13.0.dev1032
ARG indy_node_ver=1.13.0.dev1221

RUN apt-get update -y && apt-get install -y \
libsodium18 \
libbz2-dev \
zlib1g-dev \
liblz4-dev \
libsnappy-dev \
rocksdb=5.8.8 \
libindy \
ursa \
vim
FROM ghcr.io/hyperledger/indy-node-container/indy_node:main-ubuntu20

RUN pip3 install \
indy-plenum==${indy_plenum_ver} \
indy-node==${indy_node_ver}
"supervisor~=4.2"

RUN echo "[supervisord]\n\
logfile = /tmp/supervisord.log\n\
Expand Down
6 changes: 5 additions & 1 deletion indy-vdr-proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ default = ["fetch", "zmq_vendored"]
[dependencies]
clap = "3.1"
env_logger = "0.9"
futures-executor = "0.3"
futures-util = "0.3"
indy-vdr = { version = "0.4", path = "../libindy_vdr", default-features = false, features = ["log"] }
git2 = "0.14.2"
hyper = { version = "0.14", features = ["http1", "http2", "server"] }
hyper-tls = { version = "0.5", optional = true }
log = "0.4.8"
percent-encoding = "2"
regex = "1.5.4"
serde_json = "1.0"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "signal"] }
indy-vdr = { version = "0.4", path = "../libindy_vdr", default-features = false, features = ["log"] }
url = "2.2.2"

[target.'cfg(unix)'.dependencies]
hyper-unix-connector = "0.2"
Expand Down
27 changes: 22 additions & 5 deletions indy-vdr-proxy/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ extern crate clap;
use clap::{Arg, Command};

pub struct Config {
pub genesis: String,
pub genesis: Option<String>,
pub namespace: String,
#[cfg(unix)]
pub socket: Option<String>,
pub host: Option<String>,
pub port: Option<u16>,
pub init_refresh: bool,
pub interval_refresh: u32,
pub is_multiple: bool,
}

pub fn load_config() -> Result<Config, String> {
Expand All @@ -24,6 +26,18 @@ pub fn load_config() -> Result<Config, String> {
.value_name("GENESIS")
.help("Path to the ledger genesis transactions")
)
.arg(
Arg::new("name")
.short('n')
.long("name")
.takes_value(true)
.value_name("NAMESPACE")
.help("Namespace of ledger for DID resolution. Only needed if not multiple-ledgers")
)
.arg(
Arg::new("multiple-ledgers")
.help("Support multiple ledgers")
)
.arg(
Arg::new("host")
.short('h')
Expand Down Expand Up @@ -68,10 +82,11 @@ pub fn load_config() -> Result<Config, String> {

let matches = app.get_matches();

let genesis = matches
.value_of("genesis")
.unwrap_or("genesis.txn")
.to_owned();
let genesis = matches.value_of("genesis").map(|v| v.to_owned());

let namespace = matches.value_of("name").unwrap_or("test").to_owned();

let is_multiple = matches.is_present("multiple-ledgers");

if matches.occurrences_of("socket") > 0 {
if matches.occurrences_of("host") > 0 {
Expand Down Expand Up @@ -101,11 +116,13 @@ pub fn load_config() -> Result<Config, String> {

Ok(Config {
genesis,
namespace,
#[cfg(unix)]
socket,
host,
port,
init_refresh,
interval_refresh,
is_multiple,
})
}
Loading