Skip to content

Commit

Permalink
refactor: align object names with KERIpy and add function docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kentbull committed Jan 27, 2025
1 parent 1e451d1 commit 482c023
Show file tree
Hide file tree
Showing 28 changed files with 601 additions and 271 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ The integration tests depends on a local instance of KERIA, vLEI-Server and Witn
docker compose up --wait
```
If successful, it should print someting like this:
If successful, it should print something like this:
```bash
$ docker compose up --wait
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ services:
- 7723:7723

keria:
image: ${KERIA_IMAGE:-weboftrust/keria}:${KERIA_IMAGE_TAG:-0.2.0-dev6}
image: ${KERIA_IMAGE:-weboftrust/keria}:${KERIA_IMAGE_TAG:-0.2.0-rc1}
environment:
KERI_AGENT_CORS: 1
<<: *python-env
Expand Down
8 changes: 4 additions & 4 deletions examples/integration-scripts/modules/bip39_shim.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mnemonicToSeedSync, generateMnemonic } from 'bip39';
import { Diger, Signer, MtrDex, Keeper, KeeperResult, Algos } from 'signify-ts';
import { Diger, Signer, MtrDex, IdentifierManager, IdentifierManagerResult, Algos } from 'signify-ts';

export class BIP39Shim implements Keeper {
export class BIP39Shim implements IdentifierManager {
private icount: number;
private ncount: number;
private dcode: string | undefined;
Expand Down Expand Up @@ -49,7 +49,7 @@ export class BIP39Shim implements Keeper {
return keys;
}

async incept(transferable: boolean): Promise<KeeperResult> {
async incept(transferable: boolean): Promise<IdentifierManagerResult> {
const signers = this.keys(this.icount, this.kidx, transferable);
const verfers = signers.map((signer) => signer.verfer.qb64);

Expand All @@ -70,7 +70,7 @@ export class BIP39Shim implements Keeper {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
count: any, //number,
transferable: boolean
): Promise<KeeperResult> {
): Promise<IdentifierManagerResult> {
const signers = this.keys(
this.ncount,
this.kidx + this.icount,
Expand Down
3 changes: 2 additions & 1 deletion examples/integration-scripts/multisig-join.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ describe('multisig-join', () => {
waitOperation(client3, opOobi5),
]);

// rotate single sig
const [rotateResult1, rotateResult2] = await Promise.all([
client1.identifiers().rotate(nameMember1),
client2.identifiers().rotate(nameMember2),
Expand Down Expand Up @@ -309,7 +310,7 @@ describe('multisig-join', () => {
.exchanges()
.send(
nameMember1,
nameMultisig,
'multisig',
aid1,
'/multisig/rot',
{ gid: serder1.pre, smids, rmids },
Expand Down
2 changes: 1 addition & 1 deletion examples/integration-scripts/utils/multisig-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import signify, {
messagize,
} from 'signify-ts';
import { getStates, waitAndMarkNotification } from './test-util';
import { HabState } from '../../../src/keri/core/state';
import { HabState } from '../../../src/keri/core/keyState';
import assert from 'assert';

export interface AcceptMultisigInceptArgs {
Expand Down
2 changes: 1 addition & 1 deletion examples/integration-scripts/utils/test-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import signify, {
Tier,
} from 'signify-ts';
import { RetryOptions, retry } from './retry';
import { HabState } from '../../../src/keri/core/state';
import { HabState } from '../../../src/keri/core/keyState';
import assert from 'assert';
import { resolveEnvironment } from './resolve-env';

Expand Down
2 changes: 1 addition & 1 deletion src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ export * from './keri/core/signer';
export * from './keri/core/tholder';
export * from './keri/core/utils';
export * from './keri/core/verfer';
export * from './keri/core/state';
export * from './keri/core/keyState.ts';

export * from './keri/end/ending';
12 changes: 6 additions & 6 deletions src/keri/app/aiding.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Tier } from '../core/salter';
import { Algos } from '../core/manager';
import { incept, interact, reply, rotate } from '../core/eventing';
import { b, Ilks, Serials, Versionage } from '../core/core';
import { b, Ilks, Serials, Vrsn_1_0 } from '../core/core';
import { Tholder } from '../core/tholder';
import { MtrDex } from '../core/matter';
import { Serder } from '../core/serder';
import { parseRangeHeaders } from '../core/httping';
import { KeyManager } from '../core/keeping';
import { HabState } from '../core/state';
import { IdentifierManagerFactory } from '../core/keeping';
import { HabState } from '../core/keyState.ts';

/** Arguments required to create an identfier */
export interface CreateIdentiferArgs {
Expand Down Expand Up @@ -63,7 +63,7 @@ export interface IdentifierDeps {
headers?: Headers
): Promise<Response>;
pidx: number;
manager: KeyManager | null;
manager: IdentifierManagerFactory | null;
}

/**
Expand Down Expand Up @@ -225,7 +225,7 @@ export class Identifier {
wits: wits,
cnfg: [],
data: data,
version: Versionage,
version: Vrsn_1_0,
kind: Serials.JSON,
code: dcode,
intive: false,
Expand All @@ -240,7 +240,7 @@ export class Identifier {
wits: wits,
cnfg: [],
data: data,
version: Versionage,
version: Vrsn_1_0,
kind: Serials.JSON,
code: dcode,
intive: false,
Expand Down
11 changes: 7 additions & 4 deletions src/keri/app/clienting.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Authenticater } from '../core/authing';
import { HEADER_SIG_TIME } from '../core/httping';
import { ExternalModule, KeyManager } from '../core/keeping';
import { ExternalModule, IdentifierManagerFactory } from '../core/keeping';
import { Tier } from '../core/salter';

import { Identifier } from './aiding';
Expand Down Expand Up @@ -30,15 +30,18 @@ class State {
}
}

/** SignifyClient */
/**
* An in-memory key manager that can connect to a KERIA Agent and use it to
* receive messages and act as a proxy for multi-signature operations and delegation operations.
*/
export class SignifyClient {
public controller: Controller;
public url: string;
public bran: string;
public pidx: number;
public agent: Agent | null;
public authn: Authenticater | null;
public manager: KeyManager | null;
public manager: IdentifierManagerFactory | null;
public tier: Tier;
public bootUrl: string;
public exteralModules: ExternalModule[];
Expand Down Expand Up @@ -147,7 +150,7 @@ export class SignifyClient {
if (this.controller.serder.ked.s == 0) {
await this.approveDelegation();
}
this.manager = new KeyManager(
this.manager = new IdentifierManagerFactory(
this.controller.salter,
this.exteralModules
);
Expand Down
4 changes: 2 additions & 2 deletions src/keri/app/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Diger } from '../core/diger';
import { incept, rotate, interact } from '../core/eventing';
import { Serder } from '../core/serder';
import { Tholder } from '../core/tholder';
import { Ilks, b, Serials, Versionage } from '../core/core';
import { Ilks, b, Serials, Vrsn_1_0 } from '../core/core';
import { Verfer } from '../core/verfer';
import { Encrypter } from '../core/encrypter';
import { Decrypter } from '../core/decrypter';
Expand Down Expand Up @@ -173,7 +173,7 @@ export class Controller {
dig: this.serder.ked['d'],
sn: sn,
data: [anchor],
version: Versionage,
version: Vrsn_1_0,
kind: Serials.JSON,
});
return [this.signer.sign(this.serder.raw, 0).qb64];
Expand Down
14 changes: 7 additions & 7 deletions src/keri/app/credentialing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import {
b,
d,
Dict,
Ident,
Protocols,
Ilks,
Serials,
versify,
Versionage,
Vrsn_1_0,
} from '../core/core';
import { Saider } from '../core/saider';
import { Serder } from '../core/serder';
Expand All @@ -20,7 +20,7 @@ import {
serializeIssExnAttachment,
} from '../core/utils';
import { Operation } from './coring';
import { HabState } from '../core/state';
import { HabState } from '../core/keyState.ts';

/** Types of credentials */
export class CredentialTypes {
Expand Down Expand Up @@ -357,7 +357,7 @@ export class Credentials {
});

const [, acdc] = Saider.saidify({
v: versify(Ident.ACDC, undefined, Serials.JSON, 0),
v: versify(Protocols.ACDC, undefined, Serials.JSON, 0),
d: '',
u: args.u,
i: args.i ?? hab.prefix,
Expand All @@ -369,7 +369,7 @@ export class Credentials {
});

const [, iss] = Saider.saidify({
v: versify(Ident.KERI, undefined, Serials.JSON, 0),
v: versify(Protocols.KERI, undefined, Serials.JSON, 0),
t: Ilks.iss,
d: '',
i: acdc.d,
Expand Down Expand Up @@ -437,7 +437,7 @@ export class Credentials {
const hab = await this.client.identifiers().get(name);
const pre: string = hab.prefix;

const vs = versify(Ident.KERI, undefined, Serials.JSON, 0);
const vs = versify(Protocols.KERI, undefined, Serials.JSON, 0);
const dt =
datetime ?? new Date().toISOString().replace('Z', '000+00:00');

Expand Down Expand Up @@ -641,7 +641,7 @@ export class Registries {
sn: sn + 1,
data: data,
dig: dig,
version: Versionage,
version: Vrsn_1_0,
kind: Serials.JSON,
});
const keeper = this.client.manager!.get(hab);
Expand Down
6 changes: 3 additions & 3 deletions src/keri/app/exchanging.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { SignifyClient } from './clienting';
import { b, d, Dict, Ident, Ilks, Serials, versify } from '../core/core';
import { b, d, Dict, Protocols, Ilks, Serials, versify } from '../core/core';
import { Serder } from '../core/serder';
import { nowUTC } from '../core/utils';
import { Pather } from '../core/pather';
import { Counter, CtrDex } from '../core/counter';
import { Saider } from '../core/saider';
import { HabState } from '../core/state';
import { HabState } from '../core/keyState.ts';

/**
* Exchanges
Expand Down Expand Up @@ -155,7 +155,7 @@ export function exchange(
modifiers?: Dict<any>,
embeds?: Dict<any>
): [Serder, Uint8Array] {
const vs = versify(Ident.KERI, undefined, Serials.JSON, 0);
const vs = versify(Protocols.KERI, undefined, Serials.JSON, 0);
const ilk = Ilks.exn;
const dt =
date !== undefined
Expand Down
Loading

0 comments on commit 482c023

Please sign in to comment.