From 185b2653bf9e48bcbd4817df657143db73fa95e4 Mon Sep 17 00:00:00 2001 From: lenkan Date: Tue, 16 Jul 2024 10:56:59 +0200 Subject: [PATCH] pull in fixes from #267 --- .../integration-scripts/delegation.test.ts | 19 ++++++++------ src/keri/app/aiding.ts | 25 +++++++++++++++---- src/keri/app/delegating.ts | 2 +- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/examples/integration-scripts/delegation.test.ts b/examples/integration-scripts/delegation.test.ts index 54dc7b9f..82cd3a3b 100644 --- a/examples/integration-scripts/delegation.test.ts +++ b/examples/integration-scripts/delegation.test.ts @@ -8,7 +8,6 @@ import { } from './utils/test-util'; import { retry } from './utils/retry'; import { step } from './utils/test-step'; -import { getOrCreateContact } from './utils/test-setup'; const { url, bootUrl } = resolveEnvironment(); @@ -118,11 +117,15 @@ test('delegation', async () => { await waitOperation(client2, await rpyResult2.op()); const oobis = await client2.oobis().get('delegate'); - console.log(oobis); - const res = await getOrCreateContact( - client1, - 'delegate', - oobis.oobis[0].split('/agent/')[0] - ); - console.log(res); + const oobi = oobis.oobis[0].split('/agent/')[0]; + assert(typeof oobi === 'string'); + + const oobiOperation = await client1.oobis().resolve(oobi); + const oobiResult = await client1 + .operations() + .wait(oobiOperation, { signal: AbortSignal.timeout(10000) }); + + expect(oobiResult.response).toMatchObject({ + i: aid2.prefix, + }); }, 60000); diff --git a/src/keri/app/aiding.ts b/src/keri/app/aiding.ts index 094355ff..18074a19 100644 --- a/src/keri/app/aiding.ts +++ b/src/keri/app/aiding.ts @@ -233,8 +233,14 @@ export class Identifier { icp: serder.ked, sigs: sigs, proxy: proxy, - smids: states, - rmids: rstates ?? states, + smids: + states != undefined + ? states.map((state) => state.i) + : undefined, + rmids: + rstates != undefined + ? rstates.map((state) => state.i) + : undefined, }; jsondata[algo] = keeper.params(); @@ -251,7 +257,10 @@ export class Identifier { * @returns {Promise} A promise to the interaction event result */ async interact(name: string, data?: any): Promise { - let { serder, sigs, jsondata } = await this.createInteract(name, data); + const { serder, sigs, jsondata } = await this.createInteract( + name, + data + ); const res = await this.client.fetch( '/identifiers/' + name + '/events', @@ -372,8 +381,14 @@ export class Identifier { const jsondata: any = { rot: serder.ked, sigs: sigs, - smids: states, - rmids: rstates, + smids: + states != undefined + ? states.map((state) => state.i) + : undefined, + rmids: + rstates != undefined + ? rstates.map((state) => state.i) + : undefined, }; jsondata[keeper.algo] = keeper.params(); diff --git a/src/keri/app/delegating.ts b/src/keri/app/delegating.ts index b145a843..bbb1422b 100644 --- a/src/keri/app/delegating.ts +++ b/src/keri/app/delegating.ts @@ -19,7 +19,7 @@ export class Delegations { * @returns {Promise} A promise to the delegated approval result */ async approve(name: string, data?: any): Promise { - let { serder, sigs, jsondata } = await this.client + const { serder, sigs, jsondata } = await this.client .identifiers() .createInteract(name, data);