From 2b6a2fd4d08f185a37ba790a43b8a82b2baa96cd Mon Sep 17 00:00:00 2001 From: Lance <2byrds@gmail.com> Date: Wed, 8 May 2024 09:03:04 -0400 Subject: [PATCH] fix credentialing field ordering and related singlesig-vlei-issuance test (#254) * testing again vlei verification service Signed-off-by: 2byrds <2byrds@gmail.com> * Fixes for cd '/Users/meenyleeny/VSCode/signify-ts' Signed-off-by: 2byrds <2byrds@gmail.com> * make signedFetch generic so the caller can control contentType and data. This is a breaking change Signed-off-by: 2byrds <2byrds@gmail.com> * CI/CD can't run the vlei verification integration test, so commenting out Signed-off-by: 2byrds <2byrds@gmail.com> * CI/CD can't run the vlei verification integration test, so commenting out Signed-off-by: 2byrds <2byrds@gmail.com> * formatting fixes Signed-off-by: 2byrds <2byrds@gmail.com> * prettier formatting fixes Signed-off-by: 2byrds <2byrds@gmail.com> * Align signedFetch with fetch api. Signed-off-by: 2byrds <2byrds@gmail.com> * improved reliability of singlesig-vlei-issuance with retries Signed-off-by: 2byrds <2byrds@gmail.com> * restore original package-lock.json Signed-off-by: 2byrds <2byrds@gmail.com> * prettier formatting Signed-off-by: 2byrds <2byrds@gmail.com> * removed unnecessary imports Signed-off-by: 2byrds <2byrds@gmail.com> * even prettier formatting Signed-off-by: 2byrds <2byrds@gmail.com> * fixed signedFetch documentation Signed-off-by: 2byrds <2byrds@gmail.com> * set retry options Signed-off-by: 2byrds <2byrds@gmail.com> * format code Signed-off-by: 2byrds <2byrds@gmail.com> * restore asserts Signed-off-by: 2byrds <2byrds@gmail.com> * restore asserts Signed-off-by: 2byrds <2byrds@gmail.com> * better naming Signed-off-by: 2byrds <2byrds@gmail.com> * restore check Signed-off-by: 2byrds <2byrds@gmail.com> * removed unnecessary re-ordering Signed-off-by: 2byrds <2byrds@gmail.com> * separating pr functionality Signed-off-by: 2byrds <2byrds@gmail.com> * separating pr functionality Signed-off-by: 2byrds <2byrds@gmail.com> --------- Signed-off-by: 2byrds <2byrds@gmail.com> --- .../singlesig-vlei-issuance.test.ts | 28 ++++++++++++++----- src/keri/app/credentialing.ts | 6 +++- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/examples/integration-scripts/singlesig-vlei-issuance.test.ts b/examples/integration-scripts/singlesig-vlei-issuance.test.ts index 6aacbc51..6734d68a 100644 --- a/examples/integration-scripts/singlesig-vlei-issuance.test.ts +++ b/examples/integration-scripts/singlesig-vlei-issuance.test.ts @@ -106,6 +106,13 @@ const ECR_AUTH_RULES = Saider.saidify({ const OOR_RULES = LE_RULES; const OOR_AUTH_RULES = LE_RULES; +const CRED_RETRY_DEFAULTS = { + maxSleep: 1000, + minSleep: 10, + maxRetries: 5, + timeout: 10000, +}; + interface Aid { name: string; prefix: string; @@ -193,8 +200,9 @@ test('singlesig-vlei-issuance', async function run() { const cred = await getGrantedCredential(qviClient, qviCred.sad.d); assert(cred !== undefined); return cred; - }); + }, CRED_RETRY_DEFAULTS); } + assert.equal(qviCredHolder.sad.d, qviCred.sad.d); assert.equal(qviCredHolder.sad.s, QVI_SCHEMA_SAID); assert.equal(qviCredHolder.sad.i, gleifAid.prefix); @@ -232,8 +240,9 @@ test('singlesig-vlei-issuance', async function run() { const cred = await getGrantedCredential(leClient, leCred.sad.d); assert(cred !== undefined); return cred; - }); + }, CRED_RETRY_DEFAULTS); } + assert.equal(leCredHolder.sad.d, leCred.sad.d); assert.equal(leCredHolder.sad.s, LE_SCHEMA_SAID); assert.equal(leCredHolder.sad.i, qviAid.prefix); @@ -273,8 +282,9 @@ test('singlesig-vlei-issuance', async function run() { const cred = await getGrantedCredential(roleClient, ecrCred.sad.d); assert(cred !== undefined); return cred; - }); + }, CRED_RETRY_DEFAULTS); } + assert.equal(ecrCredHolder.sad.d, ecrCred.sad.d); assert.equal(ecrCredHolder.sad.s, ECR_SCHEMA_SAID); assert.equal(ecrCredHolder.sad.i, leAid.prefix); @@ -320,8 +330,9 @@ test('singlesig-vlei-issuance', async function run() { ); assert(cred !== undefined); return cred; - }); + }, CRED_RETRY_DEFAULTS); } + assert.equal(ecrAuthCredHolder.sad.d, ecrAuthCred.sad.d); assert.equal(ecrAuthCredHolder.sad.s, ECR_AUTH_SCHEMA_SAID); assert.equal(ecrAuthCredHolder.sad.i, leAid.prefix); @@ -363,8 +374,9 @@ test('singlesig-vlei-issuance', async function run() { const cred = await getGrantedCredential(roleClient, ecrCred2.sad.d); assert(cred !== undefined); return cred; - }); + }, CRED_RETRY_DEFAULTS); } + assert.equal(ecrCredHolder2.sad.d, ecrCred2.sad.d); assert.equal(ecrCredHolder2.sad.s, ECR_SCHEMA_SAID); assert.equal(ecrCredHolder2.sad.i, qviAid.prefix); @@ -409,8 +421,9 @@ test('singlesig-vlei-issuance', async function run() { ); assert(cred !== undefined); return cred; - }); + }, CRED_RETRY_DEFAULTS); } + assert.equal(oorAuthCredHolder.sad.d, oorAuthCred.sad.d); assert.equal(oorAuthCredHolder.sad.s, OOR_AUTH_SCHEMA_SAID); assert.equal(oorAuthCredHolder.sad.i, leAid.prefix); @@ -451,8 +464,9 @@ test('singlesig-vlei-issuance', async function run() { const cred = await getGrantedCredential(roleClient, oorCred.sad.d); assert(cred !== undefined); return cred; - }); + }, CRED_RETRY_DEFAULTS); } + assert.equal(oorCredHolder.sad.d, oorCred.sad.d); assert.equal(oorCredHolder.sad.s, OOR_SCHEMA_SAID); assert.equal(oorCredHolder.sad.i, qviAid.prefix); diff --git a/src/keri/app/credentialing.ts b/src/keri/app/credentialing.ts index ca08a9ab..44cd637f 100644 --- a/src/keri/app/credentialing.ts +++ b/src/keri/app/credentialing.ts @@ -211,9 +211,13 @@ export class Credentials { const [, acdc] = Saider.saidify({ v: versify(Ident.ACDC, undefined, Serials.JSON, 0), d: '', + u: args.u, i: args.i ?? hab.prefix, - ...args, + ri: args.ri, + s: args.s, a: subject, + e: args.e, + r: args.r, }); const [, iss] = Saider.saidify({