Skip to content

Commit 84657cd

Browse files
committed
Merge branch 'release-0.2.0'
2 parents ee3df3e + 972d509 commit 84657cd

File tree

210 files changed

+23614
-39760
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+23614
-39760
lines changed

.eslintrc

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"extends": [
3+
"eslint:recommended",
4+
"plugin:@typescript-eslint/recommended",
5+
"prettier"
6+
],
7+
"parser": "@typescript-eslint/parser",
8+
"rules": {
9+
"prefer-const": "warn",
10+
"no-var": "warn",
11+
"no-self-assign": "warn",
12+
"no-case-declarations": "warn",
13+
"no-constant-condition": "warn",
14+
"no-empty": "warn",
15+
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
16+
"@typescript-eslint/no-explicit-any": "warn",
17+
"@typescript-eslint/no-namespace": "warn",
18+
"@typescript-eslint/ban-types": "warn",
19+
"@typescript-eslint/no-unused-vars": "warn"
20+
}
21+
}

.github/workflows/main.yml

+58-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Run Tests
22
on:
33
push:
44
branches:
@@ -11,31 +11,79 @@ on:
1111
workflow_dispatch:
1212
jobs:
1313
build:
14-
name: Build, lint, and test on Node 18.12.1 and ${{ matrix.os }}
14+
name: Build, lint, and test on Node ${{ matrix.node-version }} and ${{ matrix.os }}
1515

1616
runs-on: ${{ matrix.os }}
1717
strategy:
1818
matrix:
19-
os: [ macOS-latest, ubuntu-latest]
19+
os: [macOS-latest, ubuntu-latest]
20+
node-version: ['18', '20']
2021

2122
steps:
2223
- name: Checkout repo
23-
uses: actions/checkout@v2
24+
uses: actions/checkout@v4
2425

25-
- uses: actions/setup-node@v2
26+
- uses: actions/setup-node@v4
2627
with:
27-
node-version: '18.12.1'
28+
node-version: ${{ matrix.node-version }}
2829
cache: 'npm'
2930

30-
- name: build
31+
- name: Install dependencies
3132
run: |
3233
npm cache clean --force
3334
npm set registry https://registry.npmjs.org/
34-
npm i
35-
npm test -- --coverage=true
36-
npm run build
35+
npm ci
36+
37+
- name: Check formatting
38+
run: npm run pretty:check
39+
40+
- name: Lint
41+
run: npm run lint
42+
43+
- name: Test
44+
run: npm test -- --coverage=true
45+
46+
- name: Build
47+
run: npm run build
3748

3849
- name: Upload coverage reports to Codecov
3950
uses: codecov/codecov-action@v3
4051
env:
4152
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
53+
54+
test:
55+
name: Run integration test
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Checkout repo
59+
uses: actions/checkout@v4
60+
61+
- uses: actions/setup-node@v4
62+
with:
63+
node-version: '18'
64+
cache: 'npm'
65+
- name: install deps
66+
run: npm ci
67+
- name: Build
68+
run: npm run build
69+
- name: Start dependencies
70+
run: docker compose up deps --pull always
71+
- name: Run integration test
72+
run: npm run test:integration
73+
- name: Print logs
74+
run: docker compose logs
75+
if: always()
76+
77+
audit:
78+
name: Find vulnerabilities
79+
runs-on: ubuntu-latest
80+
steps:
81+
- name: Checkout repo
82+
uses: actions/checkout@v4
83+
84+
- uses: actions/setup-node@v4
85+
with:
86+
node-version: '20'
87+
cache: 'npm'
88+
- name: Run audit
89+
run: npm audit

.github/workflows/update-documentation.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Publish Documentation
22
on:
33
push:
44
branches:
@@ -21,17 +21,16 @@ jobs:
2121

2222
- name: build
2323
run: |
24+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
25+
git config --local user.name "github-actions[bot]"
26+
git checkout docs
2427
npm cache clean --force
2528
npm set registry https://registry.npmjs.org/
2629
npm i
2730
npx typedoc src/index.ts
31+
git add .
32+
git commit -a -m "Update documentation"
2833
29-
- name: Commit files
30-
run: |
31-
git config --local user.email "github-actions[bot]@users.noreply.github.com"
32-
git config --local user.name "github-actions[bot]"
33-
git add .
34-
git commit -a -m "Update documentation"
3534
- name: Push changes
3635
uses: ad-m/github-push-action@master
3736
with:

.prettierrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 80,
6+
"tabWidth": 4
7+
}

README.md

+73
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,79 @@ The code is built using Typescript and running code locally requires a Mac or Li
3939
npm install
4040
```
4141

42+
Typescript source files needs to be transpiled before running scripts or integration tests
43+
44+
- Build:
45+
```bash
46+
npm run build
47+
```
48+
49+
### Unit testing
50+
51+
To run unit tests
52+
53+
```bash
54+
npm test
55+
```
56+
57+
### Integration testing
58+
59+
The integration tests depends on a local instance of KERIA, vLEI-Server and Witness Demo. These are specified in the [Docker Compose](./docker-compose.yaml) file. To start the dependencies, use docker compose:
60+
61+
```bash
62+
docker compose up deps
63+
```
64+
65+
If successful, it should print someting like this:
66+
67+
```bash
68+
$ docker compose up deps
69+
[+] Running 5/4
70+
✔ Network signify-ts_default Created 0.0s
71+
✔ Container signify-ts-vlei-server-1 Created 0.1s
72+
✔ Container signify-ts-keria-1 Created 0.1s
73+
✔ Container signify-ts-witness-demo-1 Created 0.1s
74+
✔ Container signify-ts-deps-1 Created 0.0s
75+
Attaching to signify-ts-deps-1
76+
signify-ts-deps-1 | Dependencies running
77+
signify-ts-deps-1 exited with code 0
78+
```
79+
80+
**Important!** The integration tests runs on the build output in `dist/` directory. Make sure to run build before running the integration tests.
81+
82+
```bash
83+
npm run build
84+
```
85+
86+
Use the npm script "test:integration" to run all integration tests in sequence:
87+
88+
```bash
89+
npm run test:integration
90+
```
91+
92+
Or, use execute `jest` directly to run a specific integration test, for example:
93+
94+
```bash
95+
npx jest examples/integration-scripts/credentials.test.ts
96+
```
97+
98+
It is also possible to run the tests using local instances of vLEI, Keria, and witness network. Set the environment variable `TEST_ENVIRONMENT` to `local`, e.g:
99+
100+
```
101+
TEST_ENVIRONMENT=local npx jest examples/integration-scripts/credentials.test.ts
102+
```
103+
104+
This changes the discovery urls to use `localhost` instead of the hostnames inside the docker network.
105+
106+
### Old integration scripts
107+
108+
To run any of the old integration scripts that has not yet been converted to an integration test. Use `ts-node-esm`
109+
110+
```bash
111+
npx ts-node-esm examples/integration-scripts/challenge.ts
112+
```
113+
114+
# Diagrams
42115

43116
Account Creation Workflow
44117

config/keria.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"dt": "2023-12-01T10:05:25.062609+00:00",
3+
"keria": {
4+
"dt": "2023-12-01T10:05:25.062609+00:00",
5+
"curls": [
6+
"http://keria:3902/"
7+
]
8+
},
9+
"iurls": [
10+
"http://witness-demo:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller",
11+
"http://witness-demo:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller",
12+
"http://witness-demo:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller",
13+
"http://witness-demo:5645/oobi/BM35JN8XeJSEfpxopjn5jr7tAHCE5749f0OobhMLCorE/controller",
14+
"http://witness-demo:5646/oobi/BIj15u5V11bkbtAxMA7gcNJZcax-7TgaBMLsQnMHpYHP/controller",
15+
"http://witness-demo:5647/oobi/BF2rZTW79z4IXocYRQnjjsOuvFUQv-ptCf8Yltd7PfsM/controller"
16+
]
17+
}

config/witness-demo/wan.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"dt": "2022-01-20T12:57:59.823350+00:00",
3+
"wan": {
4+
"dt": "2022-01-20T12:57:59.823350+00:00",
5+
"curls": ["tcp://witness-demo:5632/", "http://witness-demo:5642/"]
6+
},
7+
"iurls": []
8+
}

config/witness-demo/wes.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"wes": {
3+
"dt": "2022-01-20T12:57:59.823350+00:00",
4+
"curls": ["tcp://witness-demo:5634/", "http://witness-demo:5644/"]
5+
},
6+
"dt": "2022-01-20T12:57:59.823350+00:00",
7+
"iurls": []
8+
}

config/witness-demo/wil.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"wil": {
3+
"dt": "2022-01-20T12:57:59.823350+00:00",
4+
"curls": ["tcp://witness-demo:5633/", "http://witness-demo:5643/"]
5+
},
6+
"dt": "2022-01-20T12:57:59.823350+00:00",
7+
"iurls": []
8+
}

config/witness-demo/wit.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"wit": {
3+
"dt": "2022-01-20T12:57:59.823350+00:00",
4+
"curls": ["tcp://witness-demo:5635/", "http://witness-demo:5645/"]
5+
},
6+
"dt": "2022-01-20T12:57:59.823350+00:00",
7+
"iurls": []
8+
}

config/witness-demo/wub.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"wub": {
3+
"dt": "2022-01-20T12:57:59.823350+00:00",
4+
"curls": ["tcp://witness-demo:5636/", "http://witness-demo:5646/"]
5+
},
6+
"dt": "2022-01-20T12:57:59.823350+00:00",
7+
"iurls": []
8+
}

config/witness-demo/wyz.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"wyz": {
3+
"dt": "2022-01-20T12:57:59.823350+00:00",
4+
"curls": ["tcp://witness-demo:5637/", "http://witness-demo:5647/"]
5+
},
6+
"dt": "2022-01-20T12:57:59.823350+00:00",
7+
"iurls": []
8+
}

docker-compose.yaml

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
services:
2+
vlei-server:
3+
image: gleif/vlei
4+
environment:
5+
- PYTHONUNBUFFERED=1
6+
- PYTHONIOENCODING=UTF-8
7+
command:
8+
- vLEI-server
9+
- -s
10+
- ./schema/acdc
11+
- -c
12+
- ./samples/acdc/
13+
- -o
14+
- ./samples/oobis/
15+
healthcheck:
16+
test:
17+
- CMD
18+
- curl
19+
- -f
20+
- http://localhost:7723/oobi/EBfdlu8R27Fbx-ehrqwImnK-8Cm79sqbAQ4MmvEAYqao
21+
interval: 2s
22+
timeout: 3s
23+
retries: 5
24+
start_period: 2s
25+
ports:
26+
- 7723:7723
27+
28+
keria:
29+
image: weboftrust/keria:latest
30+
environment:
31+
- KERI_AGENT_CORS=1
32+
- KERI_URL=http://keria:3902
33+
- PYTHONUNBUFFERED=1
34+
- PYTHONIOENCODING=UTF-8
35+
volumes:
36+
- ./config/keria.json:/keria/config/keri/cf/keria.json
37+
entrypoint: keria
38+
command:
39+
- start
40+
- --config-dir
41+
- /keria/config
42+
- --config-file
43+
- keria
44+
- --name
45+
- agent
46+
healthcheck:
47+
test: ['CMD', 'curl', '-f', 'http://localhost:3902/spec.yaml']
48+
interval: 2s
49+
timeout: 3s
50+
retries: 5
51+
start_period: 2s
52+
ports:
53+
- 3901:3901
54+
- 3902:3902
55+
- 3903:3903
56+
57+
witness-demo:
58+
image: weboftrust/keri-witness-demo:1.1.0
59+
environment:
60+
- PYTHONUNBUFFERED=1
61+
- PYTHONIOENCODING=UTF-8
62+
healthcheck:
63+
test: ['CMD', 'curl', '-f', 'http://localhost:5642/oobi']
64+
interval: 2s
65+
timeout: 3s
66+
retries: 5
67+
start_period: 2s
68+
volumes:
69+
- ./config/witness-demo:/keripy/scripts/keri/cf/main
70+
ports:
71+
- 5642:5642
72+
- 5643:5643
73+
- 5644:5644
74+
75+
deps:
76+
image: alpine
77+
command: ['echo', 'Dependencies running']
78+
depends_on:
79+
vlei-server:
80+
condition: service_healthy
81+
keria:
82+
condition: service_healthy
83+
witness-demo:
84+
condition: service_healthy

0 commit comments

Comments
 (0)