Skip to content

Commit

Permalink
Merge branch 'WebOfTrust:development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
daidoji authored Jan 29, 2024
2 parents a6a28ad + 67dacd6 commit d7ee5e8
Show file tree
Hide file tree
Showing 358 changed files with 29,655 additions and 40,310 deletions.
21 changes: 21 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"rules": {
"prefer-const": "warn",
"no-var": "warn",
"no-self-assign": "warn",
"no-case-declarations": "warn",
"no-constant-condition": "warn",
"no-empty": "warn",
"@typescript-eslint/no-non-null-asserted-optional-chain": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-namespace": "warn",
"@typescript-eslint/ban-types": "warn",
"@typescript-eslint/no-unused-vars": "warn"
}
}
63 changes: 55 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Run Tests
on:
push:
branches:
Expand All @@ -11,12 +11,12 @@ on:
workflow_dispatch:
jobs:
build:
name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}
name: Build, lint, and test on Node 18.12.1 and ${{ matrix.os }}

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macOS-latest]
os: [macOS-latest, ubuntu-latest]

steps:
- name: Checkout repo
Expand All @@ -27,15 +27,62 @@ jobs:
node-version: '18.12.1'
cache: 'npm'

- name: build
- name: Install dependencies
run: |
npm cache clean --force
npm set registry https://registry.npmjs.org/
npm i
npm test -- --coverage=true
npm run build
npm ci
- name: Check formatting
run: npm run pretty:check

- name: Lint
run: npm run lint

- name: Test
run: npm test -- --coverage=true

- name: Build
run: npm run build

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

test:
name: Run integration test
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '18.12.1'
cache: 'npm'
- name: install deps
run: npm ci
- name: Build
run: npm run build
- name: Start dependencies
run: docker compose up deps --pull always
- name: Run integration test
run: npm run test:integration
- name: Print logs
run: docker compose logs
if: always()

audit:
name: Find vulnerabilities
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '18.12.1'
cache: 'npm'
- name: Run audit
run: npm audit
38 changes: 38 additions & 0 deletions .github/workflows/update-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Documentation
on:
push:
branches:
- 'main'
workflow_dispatch:
jobs:
update:
name: Updater documentation

runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: '18.12.1'
cache: 'npm'

- name: build
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git checkout docs
npm cache clean --force
npm set registry https://registry.npmjs.org/
npm i
npx typedoc src/index.ts
git add .
git commit -a -m "Update documentation"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 4
}
74 changes: 74 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Project Name: signify-ts
[![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.png?v=101)](https://github.com/ellerbrock/typescript-badges/)
[![Tests](https://github.com/WebOfTrust/signify-ts/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/WebOfTrust/signify-ts/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/WebOfTrust/signify-ts/branch/main/graph/badge.svg?token=K3GK7MCYVW)](https://codecov.io/gh/WebOfTrust/signify-ts)
[![Documentation](https://img.shields.io/badge/documentation-grey?)](https://weboftrust.github.io/signify-ts/)

## Signify - KERI Signing at the Edge

Expand Down Expand Up @@ -38,6 +39,79 @@ The code is built using Typescript and running code locally requires a Mac or Li
npm install
```

Typescript source files needs to be transpiled before running scripts or integration tests

- Build:
```bash
npm run build
```

### Unit testing

To run unit tests

```bash
npm test
```

### Integration testing

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:

```bash
docker compose up deps
```

If successful, it should print someting like this:

```bash
$ docker compose up deps
[+] Running 5/4
✔ Network signify-ts_default Created 0.0s
✔ Container signify-ts-vlei-server-1 Created 0.1s
✔ Container signify-ts-keria-1 Created 0.1s
✔ Container signify-ts-witness-demo-1 Created 0.1s
✔ Container signify-ts-deps-1 Created 0.0s
Attaching to signify-ts-deps-1
signify-ts-deps-1 | Dependencies running
signify-ts-deps-1 exited with code 0
```

**Important!** The integration tests runs on the build output in `dist/` directory. Make sure to run build before running the integration tests.

```bash
npm run build
```

Use the npm script "test:integration" to run all integration tests in sequence:

```bash
npm run test:integration
```

Or, use execute `jest` directly to run a specific integration test, for example:

```bash
npx jest examples/integration-scripts/credentials.test.ts
```

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:

```
TEST_ENVIRONMENT=local npx jest examples/integration-scripts/credentials.test.ts
```
This changes the discovery urls to use `localhost` instead of the hostnames inside the docker network.
### Old integration scripts
To run any of the old integration scripts that has not yet been converted to an integration test. Use `ts-node-esm`
```bash
npx ts-node-esm examples/integration-scripts/challenge.ts
```

# Diagrams

Account Creation Workflow

Expand Down
17 changes: 17 additions & 0 deletions config/keria.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"dt": "2023-12-01T10:05:25.062609+00:00",
"keria": {
"dt": "2023-12-01T10:05:25.062609+00:00",
"curls": [
"http://keria:3902/"
]
},
"iurls": [
"http://witness-demo:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller",
"http://witness-demo:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller",
"http://witness-demo:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller",
"http://witness-demo:5645/oobi/BM35JN8XeJSEfpxopjn5jr7tAHCE5749f0OobhMLCorE/controller",
"http://witness-demo:5646/oobi/BIj15u5V11bkbtAxMA7gcNJZcax-7TgaBMLsQnMHpYHP/controller",
"http://witness-demo:5647/oobi/BF2rZTW79z4IXocYRQnjjsOuvFUQv-ptCf8Yltd7PfsM/controller"
]
}
8 changes: 8 additions & 0 deletions config/witness-demo/wan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"dt": "2022-01-20T12:57:59.823350+00:00",
"wan": {
"dt": "2022-01-20T12:57:59.823350+00:00",
"curls": ["tcp://witness-demo:5632/", "http://witness-demo:5642/"]
},
"iurls": []
}
8 changes: 8 additions & 0 deletions config/witness-demo/wes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"wes": {
"dt": "2022-01-20T12:57:59.823350+00:00",
"curls": ["tcp://witness-demo:5634/", "http://witness-demo:5644/"]
},
"dt": "2022-01-20T12:57:59.823350+00:00",
"iurls": []
}
8 changes: 8 additions & 0 deletions config/witness-demo/wil.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"wil": {
"dt": "2022-01-20T12:57:59.823350+00:00",
"curls": ["tcp://witness-demo:5633/", "http://witness-demo:5643/"]
},
"dt": "2022-01-20T12:57:59.823350+00:00",
"iurls": []
}
8 changes: 8 additions & 0 deletions config/witness-demo/wit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"wit": {
"dt": "2022-01-20T12:57:59.823350+00:00",
"curls": ["tcp://witness-demo:5635/", "http://witness-demo:5645/"]
},
"dt": "2022-01-20T12:57:59.823350+00:00",
"iurls": []
}
8 changes: 8 additions & 0 deletions config/witness-demo/wub.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"wub": {
"dt": "2022-01-20T12:57:59.823350+00:00",
"curls": ["tcp://witness-demo:5636/", "http://witness-demo:5646/"]
},
"dt": "2022-01-20T12:57:59.823350+00:00",
"iurls": []
}
8 changes: 8 additions & 0 deletions config/witness-demo/wyz.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"wyz": {
"dt": "2022-01-20T12:57:59.823350+00:00",
"curls": ["tcp://witness-demo:5637/", "http://witness-demo:5647/"]
},
"dt": "2022-01-20T12:57:59.823350+00:00",
"iurls": []
}
Loading

0 comments on commit d7ee5e8

Please sign in to comment.