Skip to content

Commit

Permalink
add test step for oobi resolution from delegator
Browse files Browse the repository at this point in the history
  • Loading branch information
lenkan committed Aug 12, 2024
1 parent 850af59 commit 8aad049
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 25 deletions.
7 changes: 6 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ services:
- 3903:3903

witness-demo:
image: weboftrust/keri-witness-demo:1.1.0
image: weboftrust/keri:1.1.12
environment:
- PYTHONUNBUFFERED=1
- PYTHONIOENCODING=UTF-8
Expand All @@ -67,6 +67,11 @@ services:
timeout: 3s
retries: 5
start_period: 2s
entrypoint:
- kli
command:
- witness
- demo
volumes:
- ./config/witness-demo:/keripy/scripts/keri/cf/main
ports:
Expand Down
8 changes: 4 additions & 4 deletions examples/integration-scripts/delegation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import signify from 'signify-ts';
import { resolveEnvironment } from './utils/resolve-env';
import {
assertOperations,
getOrCreateContact,
resolveOobi,
waitOperation,
} 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 @@ -119,10 +119,10 @@ test('delegation', async () => {
const oobis = await client2.oobis().get('delegate');

console.log(oobis);
await getOrCreateContact(
const res = await getOrCreateContact(
client1,
'delegate',
oobis.oobis[0].split('/agent/')[0]
);
// console.log(res);
}, 600000);
console.log(res);
}, 60000);
8 changes: 5 additions & 3 deletions examples/integration-scripts/utils/test-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,18 @@ export async function getOrCreateContact(
oobi: string
): Promise<string> {
const list = await client.contacts().list(undefined, 'alias', `^${name}$`);
// console.log("contacts.list", list);
if (list.length > 0) {
const contact = list[0];
if (contact.oobi === oobi) {
// console.log("contacts.id", contact.id);
console.log('OOBI Already found', oobi);
return contact.id;
}
}
let op = await client.oobis().resolve(oobi, name);
op = await waitOperation(client, op);
// console.log("oobis.resolve", op);
console.dir(op, { depth: 100 });
const id = op.response.i;

await client.contacts().get(id);
return op.response.i;
}
21 changes: 4 additions & 17 deletions src/keri/app/aiding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { MtrDex } from '../core/matter';
import { Serder } from '../core/serder';
import { parseRangeHeaders } from '../core/httping';
import { KeyManager } from '../core/keeping';
import { Operation } from './coring';
import { HabState } from '../core/state';

/** Arguments required to create an identfier */
Expand Down Expand Up @@ -234,14 +233,8 @@ export class Identifier {
icp: serder.ked,
sigs: sigs,
proxy: proxy,
smids:
states != undefined
? states.map((state) => state.i)
: undefined,
rmids:
rstates != undefined
? rstates.map((state) => state.i)
: undefined,
smids: states,
rmids: rstates ?? states,
};
jsondata[algo] = keeper.params();

Expand Down Expand Up @@ -379,14 +372,8 @@ export class Identifier {
const jsondata: any = {
rot: serder.ked,
sigs: sigs,
smids:
states != undefined
? states.map((state) => state.i)
: undefined,
rmids:
rstates != undefined
? rstates.map((state) => state.i)
: undefined,
smids: states,
rmids: rstates,
};
jsondata[keeper.algo] = keeper.params();

Expand Down

0 comments on commit 8aad049

Please sign in to comment.