Skip to content

Commit

Permalink
pull in fixes from #267
Browse files Browse the repository at this point in the history
  • Loading branch information
lenkan committed Aug 12, 2024
1 parent 8aad049 commit 185b265
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
19 changes: 11 additions & 8 deletions examples/integration-scripts/delegation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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);
25 changes: 20 additions & 5 deletions src/keri/app/aiding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -251,7 +257,10 @@ export class Identifier {
* @returns {Promise<EventResult>} A promise to the interaction event result
*/
async interact(name: string, data?: any): Promise<EventResult> {
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',
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/keri/app/delegating.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class Delegations {
* @returns {Promise<EventResult>} A promise to the delegated approval result
*/
async approve(name: string, data?: any): Promise<EventResult> {
let { serder, sigs, jsondata } = await this.client
const { serder, sigs, jsondata } = await this.client
.identifiers()
.createInteract(name, data);

Expand Down

0 comments on commit 185b265

Please sign in to comment.