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

add in remaining QVI workflow with KERIA and SignifyTS #4

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 0 additions & 5 deletions qvi-workflow/kli-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ fi

# Set current working directory for all scripts that must access files
KLI1IMAGE="weboftrust/keri:1.1.29"
# KLI1IMAGE="kentbull/keri:1.1.27a"

# KLI2IMAGE="weboftrust/keri:1.2.0-rc1"
KLI2IMAGE="weboftrust/keri:1.2.2"
# KLI2IMAGE="weboftrust/keri:1.1.27"
# KLI2IMAGE="kentbull/keri:1.1.27a"

LOCAL_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
export KLI_DATA_DIR="${LOCAL_DIR}/data"
Expand Down
10 changes: 5 additions & 5 deletions qvi-workflow/package-lock.json

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

2 changes: 1 addition & 1 deletion qvi-workflow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"type": "module",
"private": true,
"dependencies": {
"signify-ts": "git://github.com/WebOfTrust/signify-ts.git#f368351f976ceeefc19082fc8351adbb359c4e77"
"signify-ts": "0.3.0-rc1"
},
"devDependencies": {
"@types/node": "^22.10.5",
Expand Down
388 changes: 228 additions & 160 deletions qvi-workflow/qvi-workflow-keria_signify_qvi.sh

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions qvi-workflow/qvi-workflow-kli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,28 @@ OOR_AUTH_SCHEMA=EKA57bKBKxr_kN7iN5i7lMUxpMG-s19dRcmov1iDxz-E
ECR_SCHEMA=EEy9PkikFcANV1l7EHukCeXqrzT1hNZjGlUk7wuMO5jw
OOR_SCHEMA=EBNaNu-M9P5cgrnfl2Fvymy4E_jvxxyjb70PRtiANlJy

function test_dependencies() {
# check that sally is installed and available on the PATH
command -v kli >/dev/null 2>&1 || { print_red "kli is not installed or not available on the PATH. Aborting."; exit 1; }
command -v tsx >/dev/null 2>&1 || { print_red "tsx is not installed or not available on the PATH. Aborting."; exit 1; }
command -v jq >/dev/null 2>&1 || { print_red "jq is not installed or not available on the PATH. Aborting."; exit 1; }
command -v sally >/dev/null 2>&1 || { print_red "sally is not installed or not available on the PATH. Aborting."; exit 1; }

curl ${WIT_HOST}/oobi/${WAN_PRE} >/dev/null 2>&1
status=$?
if [ $status -ne 0 ]; then
print_red "Witness server not running at ${WIT_HOST}"
cleanup
fi

curl ${SCHEMA_SERVER}/oobi/${QVI_SCHEMA} >/dev/null 2>&1
status=$?
if [ $status -ne 0 ]; then
print_red "Schema server not running at ${SCHEMA_SERVER}"
cleanup
fi
}
test_dependencies
# functions
temp_icp_config=""
function create_temp_icp_cfg() {
Expand Down
13 changes: 6 additions & 7 deletions qvi-workflow/signify_qvi/person-resolve-qvi-oobi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import { OobiInfo } from "./qvi-data";
// Pull in arguments from the command line and configuration
const args = process.argv.slice(2);
const env = args[0] as 'local' | 'docker';
const aidInfoArg = args[1];
const qviOobiArg = args[2];

const QVI_MS_NAME='QVI';
const multisigName = args[1];
const aidInfoArg = args[2];
const qviOobiArg = args[3];

// parse the OOBIs for the GEDA and GIDA multisig AIDs needed for delegation and then LE credential issuance
export function parseOobiInfo(oobiInfo: string) {
Expand All @@ -31,11 +30,11 @@ export function parseOobiInfo(oobiInfo: string) {
* @param qviOobi The QVI multisig OOBI
* @param environment the runtime environment to use for resolving environment variables
*/
async function resolveQVIOobi(aidInfo: string, qviOobi: string, environment: TestEnvironmentPreset) {
async function resolveQVIOobi(multisigName: string, aidInfo: string, qviOobi: string, environment: TestEnvironmentPreset) {
// create SignifyTS Clients
const {PERSON} = parseAidInfo(aidInfo);
const [PERSONClient] = await getOrCreateClients(1, [PERSON.salt], environment);
await getOrCreateContact(PERSONClient, QVI_MS_NAME, qviOobi);
await getOrCreateContact(PERSONClient, multisigName, qviOobi);
}
await resolveQVIOobi(aidInfoArg, qviOobiArg, env);
await resolveQVIOobi(multisigName, aidInfoArg, qviOobiArg, env);
console.log('Person resolved QVI OOBI ' + qviOobiArg);
46 changes: 0 additions & 46 deletions qvi-workflow/signify_qvi/qar-check-le-credential.ts

This file was deleted.

47 changes: 0 additions & 47 deletions qvi-workflow/signify_qvi/qar-check-qvi-credential.ts

This file was deleted.

16 changes: 16 additions & 0 deletions qvi-workflow/signify_qvi/qars/qar-check-issued-credential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {checkIssuedCredential, checkReceivedCredential} from "../qvi-operations.ts";

/*
Checks the specified multisig with the first QAR to see if a credential has been received
*/

// process arguments
const args = process.argv.slice(2);
const env = args[0] as 'local' | 'docker';
const multisigName = args[1]
const aidInfoArg = args[2]
const issueePre = args[3]
const schemaSAID = args[4]

const exists: string = await checkIssuedCredential(multisigName, aidInfoArg, schemaSAID, issueePre, env);
console.log(exists);
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import { HabState } from "signify-ts";
import { parseAidInfo } from "./create-aid";
import { getOrCreateClients } from "./keystore-creation";
import { TestEnvironmentPreset } from "./resolve-env";
import { parseAidInfo } from "../create-aid";
import { getOrCreateClients } from "../keystore-creation";
import { TestEnvironmentPreset } from "../resolve-env";

// process arguments
const args = process.argv.slice(2);
const env = args[0] as 'local' | 'docker';
const aidInfoArg = args[1]

const QVI_MS_NAME='QVI';
const multisigName = args[1]
const aidInfoArg = args[2]


/**
* Checks to see if the QVI multisig exists
*
*
* @param multisigName name of the multisig AID
* @param aidInfo A comma-separated list of AID information that is further separated by a pipe character for name, salt, and position
* @param environment the runtime environment to use for resolving environment variables
* @returns {Promise<string>} String true/false if QVI multisig AID exists or not
*/
async function checkQviMultisig(aidInfo: string, environment: TestEnvironmentPreset) {
async function checkQviMultisig(multisigName: string, aidInfo: string, environment: TestEnvironmentPreset) {
// get Clients
const {QAR1} = parseAidInfo(aidInfo);
const [QAR1Client] = await getOrCreateClients(1, [QAR1.salt], environment);

// Check to see if QVI multisig exists
let qar1Ms: HabState;
try {
qar1Ms = await QAR1Client.identifiers().get(QVI_MS_NAME);
qar1Ms = await QAR1Client.identifiers().get(multisigName);
} catch (e: any) {
return "false"
}
return "true"
}
const exists: string = await checkQviMultisig(aidInfoArg, env);
const exists: string = await checkQviMultisig(multisigName, aidInfoArg, env);
console.log(exists);
15 changes: 15 additions & 0 deletions qvi-workflow/signify_qvi/qars/qar-check-received-credential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import {checkReceivedCredential} from "../qvi-operations.ts";

/*
Checks the specified multisig with the first QAR to see if a credential has been received
*/

// process arguments
const args = process.argv.slice(2);
const env = args[0] as 'local' | 'docker';
const multisigName = args[1]
const aidInfoArg = args[2]
const credSAID = args[3]

const exists: string = await checkReceivedCredential(multisigName, aidInfoArg, credSAID, env);
console.log(exists);
11 changes: 11 additions & 0 deletions qvi-workflow/signify_qvi/qars/qars-admit-ecr-auth-credential.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {checkReceivedCredential} from "../qvi-operations.ts";

// process arguments
const args = process.argv.slice(2);
const env = args[0] as 'local' | 'docker';
const multisigName = args[1]
const aidInfoArg = args[2]
const credSAID = args[3]

const exists: string = await checkReceivedCredential(multisigName, aidInfoArg, credSAID, env);
console.log(exists);
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import fs from "fs";
import signify, { CreateIdentiferArgs, HabState } from "signify-ts";
import { createTimestamp, parseAidInfo } from "./create-aid";
import { getOrCreateAID, getOrCreateClients } from "./keystore-creation";
import { createAIDMultisig } from "./multisig-creation";
import { resolveEnvironment, TestEnvironmentPreset } from "./resolve-env";
import { admitMultisig, getReceivedCredential, waitForCredential } from "./credentials";
import { waitAndMarkNotification } from "./notifications";
import {createTimestamp, parseAidInfo} from "../create-aid";
import {getOrCreateAID, getOrCreateClients} from "../keystore-creation";
import {resolveEnvironment, TestEnvironmentPreset} from "../resolve-env";
import {admitMultisig, getReceivedCredential, waitForCredential} from "../credentials";
import {waitAndMarkNotification} from "../notifications";

// process arguments
const args = process.argv.slice(2);
const env = args[0] as 'local' | 'docker';
const aidInfoArg = args[1]
const gedaPrefix = args[2]
const qviCredSAID = args[3]
const multisigName = args[1]
const aidInfoArg = args[2]
const gedaPrefix = args[3]
const qviCredSAID = args[4]

// resolve witness IDs for QVI multisig AID configuration
const {witnessIds} = resolveEnvironment(env);
const QVI_MS_NAME='QVI';


/**
Expand All @@ -29,7 +26,7 @@ const QVI_MS_NAME='QVI';
* @param environment the runtime environment to use for resolving environment variables
* @returns {Promise<{qviMsOobi: string}>} Object containing the delegatee QVI multisig AID OOBI
*/
async function admitQviCredential(aidInfo: string, gedaPrefix: string, witnessIds: Array<string>, qviCredSAID: string, environment: TestEnvironmentPreset) {
async function admitQviCredential(multisigName: string, aidInfo: string, gedaPrefix: string, witnessIds: Array<string>, qviCredSAID: string, environment: TestEnvironmentPreset) {
// get Clients
const {QAR1, QAR2, QAR3} = parseAidInfo(aidInfo);
const [
Expand All @@ -54,7 +51,7 @@ async function admitQviCredential(aidInfo: string, gedaPrefix: string, witnessId
]);

// Get the QVI multisig AID
const qar1Ms = await QAR1Client.identifiers().get(QVI_MS_NAME);
const qar1Ms = await QAR1Client.identifiers().get(multisigName);
// Skip if a QVI AID has already been incepted.

let qviCredbyQAR1 = await getReceivedCredential(QAR1Client, qviCredSAID);
Expand Down Expand Up @@ -99,6 +96,6 @@ async function admitQviCredential(aidInfo: string, gedaPrefix: string, witnessId
}

}
const admitResult: any = await admitQviCredential(aidInfoArg, gedaPrefix, witnessIds, qviCredSAID, env);
const admitResult: any = await admitQviCredential(multisigName, aidInfoArg, gedaPrefix, witnessIds, qviCredSAID, env);

console.log("QVI credential admitted");
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getOrCreateContact } from "./agent-contacts";
import { getOrCreateAID, getOrCreateClients} from "./keystore-creation";
import { resolveOobi } from "./oobis";
import { resolveEnvironment, TestEnvironmentPreset } from "./resolve-env";
import { parseAidInfo } from "./create-aid";
import { getOrCreateContact } from "../agent-contacts";
import { getOrCreateAID, getOrCreateClients} from "../keystore-creation";
import { resolveOobi } from "../oobis";
import { resolveEnvironment, TestEnvironmentPreset } from "../resolve-env";
import { parseAidInfo } from "../create-aid";
import fs from 'fs';

/**
Expand Down Expand Up @@ -167,9 +167,4 @@ async function setupQVIAndPerson(aidInfoArg: string, environment: TestEnvironmen
}
}
const clientInfo: any = await setupQVIAndPerson(aidInfoArg, env);
await fs.writeFile(`${dataDir}/qars-and-person-info.json`, JSON.stringify(clientInfo), (err) => {
if (err) {
console.log(`error writing client info to file: ${err}`);
return
}
});
await fs.promises.writeFile(`${dataDir}/qars-and-person-info.json`, JSON.stringify(clientInfo));
Loading