Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
lenkan committed Apr 12, 2024
2 parents e2345e8 + 4c0072f commit 334438c
Show file tree
Hide file tree
Showing 46 changed files with 2,386 additions and 427 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,34 @@ jobs:
run: npm run build

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

test:
name: Run integration test
runs-on: ubuntu-latest
name: Run integration test using keria:${{ matrix.keria-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest']
keria-version: ['latest']
node-version: ['20']
env:
KERIA_IMAGE_TAG: ${{ matrix.keria-version }}
steps:
- name: Checkout repo
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: install deps
run: npm ci
- name: Build
run: npm run build
- name: Print docker compose config
run: docker compose config
- name: Start dependencies
run: docker compose up deps --pull always
- name: Run integration test
Expand Down
6 changes: 2 additions & 4 deletions .jsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
"includePattern": ".ts$",
"excludePattern": "(node_modules/|docs|dist|examples|test)"
},
"plugins": [
"plugins/markdown"
],
"plugins": ["plugins/markdown"],
"templates": {
"cleverLinks": false,
"monospaceLinks": true,
Expand All @@ -24,4 +22,4 @@
"recurse": true,
"template": "./node_modules/minami"
}
}
}
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
diagrams/
docs/
package.json
package-lock.json
.github/
12 changes: 6 additions & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 4
}
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 4
}
37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Project Name: signify-ts

## Signify - KERI Signing at the Edge

Of the five functions in a KERI agent,
Of the five functions in a KERI agent,

1. Key generation
2. Encrypted key storage
Expand All @@ -19,20 +19,18 @@ Of the five functions in a KERI agent,

Signify-TS splits off two, key generation and event signing into a TypeScript library to provide "signing at the edge".
It accomplishes this by using [libsodium](https://doc.libsodium.org/) to generate ed25519 key pairs for signing and x25519 key pairs for encrypting the
private keys, next public keys and salts used to generate the private keys. The encrypted private key and salts are then stored on a
remote cloud agent that never has access to the decryption keys. New key pair sets (current and next) will be generated
private keys, next public keys and salts used to generate the private keys. The encrypted private key and salts are then stored on a
remote cloud agent that never has access to the decryption keys. New key pair sets (current and next) will be generated
for inception and rotation events with only the public keys and blake3 hash of the next keys made available to the agent.

The communication protocol between a Signify client and [KERI](https://github.com/WebOfTrust/keri) agent will encode all cryptographic primitives as CESR base64
encoded strings for the initial implementation. Support for binary CESR can be added in the future.

encoded strings for the initial implementation. Support for binary CESR can be added in the future.

### Environment Setup

The code is built using Typescript and running code locally requires a Mac or Linux OS.

- Install [Node.js](https://nodejs.org)

- Install [Node.js](https://nodejs.org)

- Install dependencies:
```bash
Expand Down Expand Up @@ -77,6 +75,22 @@ signify-ts-deps-1 | Dependencies running
signify-ts-deps-1 exited with code 0
```

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
```

To use another repository, you can do:

```bash
export KERIA_IMAGE=gleif/keria
docker compose pull
docker compose up deps
```

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

```bash
Expand All @@ -103,19 +117,10 @@ 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
![Account Creation](/diagrams/account-creation-workflow.png)

![Account Creation Webpage](/diagrams/account-creation-webpage-workflow.png)
18 changes: 9 additions & 9 deletions codecov.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
coverage:
status:
project:
default:
target: 55
paths: ["src"]
patch:
default:
target: 75
paths: ["src"]
status:
project:
default:
target: 55
paths: ['src']
patch:
default:
target: 75
paths: ['src']
20 changes: 9 additions & 11 deletions config/keria.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
"dt": "2023-12-01T10:05:25.062609+00:00",
"keria": {
"dt": "2023-12-01T10:05:25.062609+00:00",
"curls": [
"http://keria:3902/"
]
"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"
"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"
]
}
}
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ services:
- 7723:7723

keria:
image: weboftrust/keria:latest
image: ${KERIA_IMAGE:-weboftrust/keria}:${KERIA_IMAGE_TAG:-latest}
environment:
- KERI_AGENT_CORS=1
- KERI_URL=http://keria:3902
Expand Down
66 changes: 35 additions & 31 deletions examples/integration-scripts/credentials.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,16 @@ test('single signature credentials', async () => {
LEI: '5493001KJTIIGC8Y1R17',
};

const issResult = await issuerClient.credentials().issue({
issuerName: issuerAid.name,
registryId: registry.regk,
schemaId: QVI_SCHEMA_SAID,
recipient: holderAid.prefix,
data: vcdata,
});
const issResult = await issuerClient
.credentials()
.issue(issuerAid.name, {
ri: registry.regk,
s: QVI_SCHEMA_SAID,
a: {
i: holderAid.prefix,
...vcdata,
},
});

await waitOperation(issuerClient, issResult.op);
return issResult.acdc.ked.d as string;
Expand Down Expand Up @@ -385,31 +388,32 @@ test('single signature credentials', async () => {
.credentials()
.get(qviCredentialId);

const result = await holderClient.credentials().issue({
issuerName: holderAid.name,
recipient: legalEntityAid.prefix,
registryId: holderRegistry.regk,
schemaId: LE_SCHEMA_SAID,
data: {
LEI: '5493001KJTIIGC8Y1R17',
},
rules: Saider.saidify({
d: '',
usageDisclaimer: {
l: 'Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled.',
},
issuanceDisclaimer: {
l: 'All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework.',
},
})[1],
source: Saider.saidify({
d: '',
qvi: {
n: qviCredential.sad.d,
s: qviCredential.sad.s,
const result = await holderClient
.credentials()
.issue(holderAid.name, {
a: {
i: legalEntityAid.prefix,
LEI: '5493001KJTIIGC8Y1R17',
},
})[1],
});
ri: holderRegistry.regk,
s: LE_SCHEMA_SAID,
r: Saider.saidify({
d: '',
usageDisclaimer: {
l: 'Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled.',
},
issuanceDisclaimer: {
l: 'All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework.',
},
})[1],
e: Saider.saidify({
d: '',
qvi: {
n: qviCredential.sad.d,
s: qviCredential.sad.s,
},
})[1],
});

await waitOperation(holderClient, result.op);
return result.acdc.ked.d;
Expand Down
32 changes: 14 additions & 18 deletions examples/integration-scripts/multisig-holder.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { strict as assert } from 'assert';
import signify, {
SignifyClient,
IssueCredentialArgs,
Operation,
} from 'signify-ts';
import signify, { SignifyClient, Operation, CredentialData } from 'signify-ts';
import { resolveEnvironment } from './utils/resolve-env';
import {
assertOperations,
Expand Down Expand Up @@ -354,12 +350,11 @@ test('multisig', async function run() {

console.log(`Issuer starting credential issuance to holder...`);
const registires = await client3.registries().list('issuer');
await issueCredential(client3, {
issuerName: 'issuer',
registryId: registires[0].regk,
schemaId: SCHEMA_SAID,
recipient: holderAid['prefix'],
data: {
await issueCredential(client3, 'issuer', {
ri: registires[0].regk,
s: SCHEMA_SAID,
a: {
i: holderAid['prefix'],
LEI: '5493001KJTIIGC8Y1R17',
},
});
Expand Down Expand Up @@ -476,23 +471,24 @@ async function createRegistry(

async function issueCredential(
client: SignifyClient,
args: IssueCredentialArgs
name: string,
data: CredentialData
) {
const result = await client.credentials().issue(args);
const result = await client.credentials().issue(name, data);

await waitOperation(client, result.op);

const creds = await client.credentials().list();
assert.equal(creds.length, 1);
assert.equal(creds[0].sad.s, args.schemaId);
assert.equal(creds[0].sad.s, data.s);
assert.equal(creds[0].status.s, '0');

const dt = createTimestamp();

if (args.recipient) {
if (data.a.i) {
const [grant, gsigs, end] = await client.ipex().grant({
senderName: args.issuerName,
recipient: args.recipient,
senderName: name,
recipient: data.a.i,
datetime: dt,
acdc: result.acdc,
anc: result.anc,
Expand All @@ -501,7 +497,7 @@ async function issueCredential(

let op = await client
.ipex()
.submitGrant(args.issuerName, grant, gsigs, end, [args.recipient]);
.submitGrant(name, grant, gsigs, end, [data.a.i]);
op = await waitOperation(client, op);
}

Expand Down
Loading

0 comments on commit 334438c

Please sign in to comment.