Skip to content

Commit 482c023

Browse files
committed
refactor: align object names with KERIpy and add function docs
1 parent 1e451d1 commit 482c023

28 files changed

+601
-271
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ The integration tests depends on a local instance of KERIA, vLEI-Server and Witn
8181
docker compose up --wait
8282
```
8383
84-
If successful, it should print someting like this:
84+
If successful, it should print something like this:
8585
8686
```bash
8787
$ docker compose up --wait

docker-compose.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ services:
2121
- 7723:7723
2222

2323
keria:
24-
image: ${KERIA_IMAGE:-weboftrust/keria}:${KERIA_IMAGE_TAG:-0.2.0-dev6}
24+
image: ${KERIA_IMAGE:-weboftrust/keria}:${KERIA_IMAGE_TAG:-0.2.0-rc1}
2525
environment:
2626
KERI_AGENT_CORS: 1
2727
<<: *python-env

examples/integration-scripts/modules/bip39_shim.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { mnemonicToSeedSync, generateMnemonic } from 'bip39';
2-
import { Diger, Signer, MtrDex, Keeper, KeeperResult, Algos } from 'signify-ts';
2+
import { Diger, Signer, MtrDex, IdentifierManager, IdentifierManagerResult, Algos } from 'signify-ts';
33

4-
export class BIP39Shim implements Keeper {
4+
export class BIP39Shim implements IdentifierManager {
55
private icount: number;
66
private ncount: number;
77
private dcode: string | undefined;
@@ -49,7 +49,7 @@ export class BIP39Shim implements Keeper {
4949
return keys;
5050
}
5151

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

@@ -70,7 +70,7 @@ export class BIP39Shim implements Keeper {
7070
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7171
count: any, //number,
7272
transferable: boolean
73-
): Promise<KeeperResult> {
73+
): Promise<IdentifierManagerResult> {
7474
const signers = this.keys(
7575
this.ncount,
7676
this.kidx + this.icount,

examples/integration-scripts/multisig-join.test.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ describe('multisig-join', () => {
164164
waitOperation(client3, opOobi5),
165165
]);
166166

167+
// rotate single sig
167168
const [rotateResult1, rotateResult2] = await Promise.all([
168169
client1.identifiers().rotate(nameMember1),
169170
client2.identifiers().rotate(nameMember2),
@@ -309,7 +310,7 @@ describe('multisig-join', () => {
309310
.exchanges()
310311
.send(
311312
nameMember1,
312-
nameMultisig,
313+
'multisig',
313314
aid1,
314315
'/multisig/rot',
315316
{ gid: serder1.pre, smids, rmids },

examples/integration-scripts/utils/multisig-utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import signify, {
99
messagize,
1010
} from 'signify-ts';
1111
import { getStates, waitAndMarkNotification } from './test-util';
12-
import { HabState } from '../../../src/keri/core/state';
12+
import { HabState } from '../../../src/keri/core/keyState';
1313
import assert from 'assert';
1414

1515
export interface AcceptMultisigInceptArgs {

examples/integration-scripts/utils/test-util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import signify, {
99
Tier,
1010
} from 'signify-ts';
1111
import { RetryOptions, retry } from './retry';
12-
import { HabState } from '../../../src/keri/core/state';
12+
import { HabState } from '../../../src/keri/core/keyState';
1313
import assert from 'assert';
1414
import { resolveEnvironment } from './resolve-env';
1515

src/exports.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ export * from './keri/core/signer';
3939
export * from './keri/core/tholder';
4040
export * from './keri/core/utils';
4141
export * from './keri/core/verfer';
42-
export * from './keri/core/state';
42+
export * from './keri/core/keyState.ts';
4343

4444
export * from './keri/end/ending';

src/keri/app/aiding.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { Tier } from '../core/salter';
22
import { Algos } from '../core/manager';
33
import { incept, interact, reply, rotate } from '../core/eventing';
4-
import { b, Ilks, Serials, Versionage } from '../core/core';
4+
import { b, Ilks, Serials, Vrsn_1_0 } from '../core/core';
55
import { Tholder } from '../core/tholder';
66
import { MtrDex } from '../core/matter';
77
import { Serder } from '../core/serder';
88
import { parseRangeHeaders } from '../core/httping';
9-
import { KeyManager } from '../core/keeping';
10-
import { HabState } from '../core/state';
9+
import { IdentifierManagerFactory } from '../core/keeping';
10+
import { HabState } from '../core/keyState.ts';
1111

1212
/** Arguments required to create an identfier */
1313
export interface CreateIdentiferArgs {
@@ -63,7 +63,7 @@ export interface IdentifierDeps {
6363
headers?: Headers
6464
): Promise<Response>;
6565
pidx: number;
66-
manager: KeyManager | null;
66+
manager: IdentifierManagerFactory | null;
6767
}
6868

6969
/**
@@ -225,7 +225,7 @@ export class Identifier {
225225
wits: wits,
226226
cnfg: [],
227227
data: data,
228-
version: Versionage,
228+
version: Vrsn_1_0,
229229
kind: Serials.JSON,
230230
code: dcode,
231231
intive: false,
@@ -240,7 +240,7 @@ export class Identifier {
240240
wits: wits,
241241
cnfg: [],
242242
data: data,
243-
version: Versionage,
243+
version: Vrsn_1_0,
244244
kind: Serials.JSON,
245245
code: dcode,
246246
intive: false,

src/keri/app/clienting.ts

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Authenticater } from '../core/authing';
22
import { HEADER_SIG_TIME } from '../core/httping';
3-
import { ExternalModule, KeyManager } from '../core/keeping';
3+
import { ExternalModule, IdentifierManagerFactory } from '../core/keeping';
44
import { Tier } from '../core/salter';
55

66
import { Identifier } from './aiding';
@@ -30,15 +30,18 @@ class State {
3030
}
3131
}
3232

33-
/** SignifyClient */
33+
/**
34+
* An in-memory key manager that can connect to a KERIA Agent and use it to
35+
* receive messages and act as a proxy for multi-signature operations and delegation operations.
36+
*/
3437
export class SignifyClient {
3538
public controller: Controller;
3639
public url: string;
3740
public bran: string;
3841
public pidx: number;
3942
public agent: Agent | null;
4043
public authn: Authenticater | null;
41-
public manager: KeyManager | null;
44+
public manager: IdentifierManagerFactory | null;
4245
public tier: Tier;
4346
public bootUrl: string;
4447
public exteralModules: ExternalModule[];
@@ -147,7 +150,7 @@ export class SignifyClient {
147150
if (this.controller.serder.ked.s == 0) {
148151
await this.approveDelegation();
149152
}
150-
this.manager = new KeyManager(
153+
this.manager = new IdentifierManagerFactory(
151154
this.controller.salter,
152155
this.exteralModules
153156
);

src/keri/app/controller.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Diger } from '../core/diger';
55
import { incept, rotate, interact } from '../core/eventing';
66
import { Serder } from '../core/serder';
77
import { Tholder } from '../core/tholder';
8-
import { Ilks, b, Serials, Versionage } from '../core/core';
8+
import { Ilks, b, Serials, Vrsn_1_0 } from '../core/core';
99
import { Verfer } from '../core/verfer';
1010
import { Encrypter } from '../core/encrypter';
1111
import { Decrypter } from '../core/decrypter';
@@ -173,7 +173,7 @@ export class Controller {
173173
dig: this.serder.ked['d'],
174174
sn: sn,
175175
data: [anchor],
176-
version: Versionage,
176+
version: Vrsn_1_0,
177177
kind: Serials.JSON,
178178
});
179179
return [this.signer.sign(this.serder.raw, 0).qb64];

src/keri/app/credentialing.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import {
55
b,
66
d,
77
Dict,
8-
Ident,
8+
Protocols,
99
Ilks,
1010
Serials,
1111
versify,
12-
Versionage,
12+
Vrsn_1_0,
1313
} from '../core/core';
1414
import { Saider } from '../core/saider';
1515
import { Serder } from '../core/serder';
@@ -20,7 +20,7 @@ import {
2020
serializeIssExnAttachment,
2121
} from '../core/utils';
2222
import { Operation } from './coring';
23-
import { HabState } from '../core/state';
23+
import { HabState } from '../core/keyState.ts';
2424

2525
/** Types of credentials */
2626
export class CredentialTypes {
@@ -357,7 +357,7 @@ export class Credentials {
357357
});
358358

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

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

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

@@ -641,7 +641,7 @@ export class Registries {
641641
sn: sn + 1,
642642
data: data,
643643
dig: dig,
644-
version: Versionage,
644+
version: Vrsn_1_0,
645645
kind: Serials.JSON,
646646
});
647647
const keeper = this.client.manager!.get(hab);

src/keri/app/exchanging.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { SignifyClient } from './clienting';
2-
import { b, d, Dict, Ident, Ilks, Serials, versify } from '../core/core';
2+
import { b, d, Dict, Protocols, Ilks, Serials, versify } from '../core/core';
33
import { Serder } from '../core/serder';
44
import { nowUTC } from '../core/utils';
55
import { Pather } from '../core/pather';
66
import { Counter, CtrDex } from '../core/counter';
77
import { Saider } from '../core/saider';
8-
import { HabState } from '../core/state';
8+
import { HabState } from '../core/keyState.ts';
99

1010
/**
1111
* Exchanges
@@ -155,7 +155,7 @@ export function exchange(
155155
modifiers?: Dict<any>,
156156
embeds?: Dict<any>
157157
): [Serder, Uint8Array] {
158-
const vs = versify(Ident.KERI, undefined, Serials.JSON, 0);
158+
const vs = versify(Protocols.KERI, undefined, Serials.JSON, 0);
159159
const ilk = Ilks.exn;
160160
const dt =
161161
date !== undefined

0 commit comments

Comments
 (0)