Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/essr
Browse files Browse the repository at this point in the history
  • Loading branch information
iFergal committed Dec 30, 2024
2 parents 591d33e + f368351 commit 781362a
Show file tree
Hide file tree
Showing 18 changed files with 281 additions and 260 deletions.
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Bug report"
description: Bug report template
title: "Bug: short description"
labels: ["bug", "triage"]
body:
- type: input
id: version
attributes:
label: Version
validations:
required: true
- type: input
id: Evnironment
attributes:
label: Environment
description: (OS, Node.js version)
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
validations:
required: true
- type: textarea
id: actual-behavior
attributes:
label: Actual behavior
validations:
required: true
- type: textarea
id: steps-to-reproduce
attributes:
label: Steps to reproduce
validations:
required: true
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: "Feature request"
description: Feature request template
title: "Feature request: short description"
labels: ["feature request", "triage"]
body:
- type: textarea
id: desired-behavior
attributes:
label: Feature request description/rationale
validations:
required: true
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest']
keria-version: ['0.2.0-dev3']
keria-version: ['0.2.0-dev5']
node-version: ['20']
env:
KERIA_IMAGE_TAG: ${{ matrix.keria-version }}
Expand All @@ -76,7 +76,7 @@ jobs:
- name: Print docker compose config
run: docker compose config
- name: Start dependencies
run: docker compose up deps --pull always
run: docker compose up --wait --pull always
- name: Run integration test
run: npm run test:integration
- name: Print logs
Expand Down
41 changes: 29 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,31 @@ The code is built using Typescript and running code locally requires a Mac or Li
Typescript source files needs to be transpiled before running scripts or integration tests

- Build:

```bash
npm run build
```

- ready() must be called before library is useable. Example minimum viable client code.

```javascript
import { randomPasscode, ready, SignifyClient, Tier } from 'signify-ts';
await ready();
const bran = randomPasscode();
const url = 'http://127.0.0.1:3901';
const boot_url = 'http://127.0.0.1:3903';
const actualSignifyClient = new SignifyClient(
url,
bran,
Tier.low,
boot_url
);
console.log(actualSignifyClient);
```
### Unit testing
To run unit tests
Expand All @@ -57,38 +78,34 @@ npm test
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
docker compose up --wait
```
If successful, it should print someting like this:
```bash
$ docker compose up deps
[+] Running 5/4
$ docker compose up --wait
[+] Running 4/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
✔ Container signify-ts-vlei-server-1 Healthy 5.7s
✔ Container signify-ts-keria-1 Healthy 6.2s
✔ Container signify-ts-witness-demo-1 Healthy 6.2s
```
It is possible to change the keria image by using environment variables. For example, to use weboftrust/keria:0.1.3, do:
```bash
export KERIA_IMAGE_TAG=0.1.3
docker compose pull
docker compose up deps
docker compose up --wait
```
To use another repository, you can do:
```bash
export KERIA_IMAGE=gleif/keria
docker compose pull
docker compose up deps
docker compose up --wait
```
**Important!** The integration tests runs on the build output in `dist/` directory. Make sure to run build before running the integration tests.
Expand Down
81 changes: 23 additions & 58 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,56 +1,36 @@
x-healthcheck: &healthcheck
interval: 2s
timeout: 3s
retries: 5
start_period: 2s

x-python-env: &python-env
PYTHONUNBUFFERED: 1
PYTHONIOENCODING: UTF-8

services:
vlei-server:
image: gleif/vlei
environment:
- PYTHONUNBUFFERED=1
- PYTHONIOENCODING=UTF-8
command:
- vLEI-server
- -s
- ./schema/acdc
- -c
- ./samples/acdc/
- -o
- ./samples/oobis/
<<: *python-env
command: vLEI-server -s ./schema/acdc -c ./samples/acdc/ -o ./samples/oobis/
healthcheck:
test:
- CMD
- curl
- -f
- http://localhost:7723/oobi/EBfdlu8R27Fbx-ehrqwImnK-8Cm79sqbAQ4MmvEAYqao
interval: 2s
timeout: 3s
retries: 5
start_period: 2s
test: curl -f http://localhost:7723/oobi/EBfdlu8R27Fbx-ehrqwImnK-8Cm79sqbAQ4MmvEAYqao
<<: *healthcheck
ports:
- 7723:7723

keria:
image: ${KERIA_IMAGE:-weboftrust/keria}:${KERIA_IMAGE_TAG:-0.2.0-dev3}
image: ${KERIA_IMAGE:-weboftrust/keria}:${KERIA_IMAGE_TAG:-0.2.0-dev5}
environment:
- KERI_AGENT_CORS=1
- KERI_URL=http://keria:3902
- PYTHONUNBUFFERED=1
- PYTHONIOENCODING=UTF-8
KERI_AGENT_CORS: 1
<<: *python-env
volumes:
- ./config/keria.json:/keria/config/keri/cf/keria.json
entrypoint:
[
'keria',
'start',
'--config-dir',
'/keria/config',
'--config-file',
'keria',
'--name',
'agent',
]
command: --config-dir /keria/config --config-file keria --name agent
healthcheck:
test: ['CMD', 'wget', '--spider', 'http://keria:3902/spec.yaml']
interval: 2s
timeout: 3s
retries: 5
start_period: 2s
test: wget --spider http://keria:3902/spec.yaml
<<: *healthcheck
ports:
- 3901:3901
- 3902:3902
Expand All @@ -59,28 +39,13 @@ services:
witness-demo:
image: weboftrust/keri-witness-demo:1.1.0
environment:
- PYTHONUNBUFFERED=1
- PYTHONIOENCODING=UTF-8
<<: *python-env
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:5642/oobi']
interval: 2s
timeout: 3s
retries: 5
start_period: 2s
test: curl -f http://localhost:5642/oobi
<<: *healthcheck
volumes:
- ./config/witness-demo:/keripy/scripts/keri/cf/main
ports:
- 5642:5642
- 5643:5643
- 5644:5644

deps:
image: alpine
command: ['echo', 'Dependencies running']
depends_on:
vlei-server:
condition: service_healthy
keria:
condition: service_healthy
witness-demo:
condition: service_healthy
14 changes: 13 additions & 1 deletion examples/integration-scripts/credentials.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { strict as assert } from 'assert';
import { Saider, Serder, SignifyClient } from 'signify-ts';
import { Ilks, Saider, Serder, SignifyClient } from 'signify-ts';
import { resolveEnvironment } from './utils/resolve-env';
import {
assertNotifications,
Expand Down Expand Up @@ -248,6 +248,18 @@ test('single signature credentials', async () => {
await waitOperation(issuerClient, op);
});

await step(
'holder can get the credential status before or without holding',
async () => {
const state = await retry(async () =>
holderClient.credentials().state(registry.regk, qviCredentialId)
);
assert.equal(state.i, qviCredentialId);
assert.equal(state.ri, registry.regk);
assert.equal(state.et, Ilks.iss);
}
);

await step('holder IPEX admit', async () => {
const holderNotifications = await waitForNotifications(
holderClient,
Expand Down
9 changes: 9 additions & 0 deletions examples/integration-scripts/salty.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,5 +168,14 @@ test('salty', async () => {

await assertOperations(client1);

aid = await client1.identifiers().update('aid3', { name: 'aid4' });
assert.equal(aid.name, 'aid4');
aid = await client1.identifiers().get('aid4');
assert.equal(aid.name, 'aid4');
aids = await client1.identifiers().list(2, 2);
assert.equal(aids.aids.length, 1);
aid = aids.aids[0];
assert.equal(aid.name, 'aid4');

console.log('Salty test passed');
}, 30000);
2 changes: 1 addition & 1 deletion examples/integration-scripts/singlesig-drt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('singlesig-drt', () => {
kargs = {};
result = await delegate.identifiers().rotate('delegate1', kargs);
op = await result.op();
expect(op.name).toEqual(`delegation.${delegate1.prefix}`);
expect(op.name).toEqual(`delegation.${result.serder.ked.d}`);

// delegator approves delegate
delegate1 = await delegate.identifiers().get('delegate1');
Expand Down
29 changes: 29 additions & 0 deletions examples/integration-scripts/test-setup-single-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ describe('test-setup-single-client', () => {
'EB3UGWwIMq7ppzcQ697ImQIuXlBG5jzh-baSx-YG3-tY'
);
});

test('step2', async () => {
const env = resolveEnvironment();
const oobi = await client.oobis().get('name1', 'witness');
Expand Down Expand Up @@ -62,4 +63,32 @@ describe('test-setup-single-client', () => {
break;
}
});

test('validate config', async () => {
const env = resolveEnvironment();
const config = await client.config().get();
switch (env.preset) {
case 'local':
expect(config).toEqual({
iurls: [
'http://127.0.0.1:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller?name=Wan&tag=witness',
'http://127.0.0.1:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller?name=Wes&tag=witness',
'http://127.0.0.1:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller?name=Wil&tag=witness',
],
});
break;
case 'docker':
expect(config).toEqual({
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',
],
});
break;
}
});
});
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 781362a

Please sign in to comment.