Skip to content

Commit 65af0ee

Browse files
fix after rebasing from parent branch
1 parent d984b3c commit 65af0ee

File tree

11 files changed

+283
-928
lines changed

11 files changed

+283
-928
lines changed

src/keri/app/clienting.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { Notifications } from './notifying.ts';
1818
const DEFAULT_BOOT_URL = 'http://localhost:3903';
1919

2020
// Export type outside the class
21-
export type AgentResourceResult = components["schemas"]["AgentResourceResult"];
21+
export type AgentResourceResult = components['schemas']['AgentResourceResult'];
2222

2323
class State {
2424
agent: any | null;

src/keri/app/coring.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,11 @@ export class KeyStates {
267267
* @param {any} [anchor] Optional anchor
268268
* @returns {Promise<Operation<any>>} A promise to the long-running operation
269269
*/
270-
async query(pre: string, sn?: string, anchor?: any): Promise<Operation<any>> {
270+
async query(
271+
pre: string,
272+
sn?: string,
273+
anchor?: any
274+
): Promise<Operation<any>> {
271275
const path = `/queries`;
272276
const data: any = {
273277
pre: pre,

src/keri/core/keeping.ts

Lines changed: 70 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -181,57 +181,82 @@ export class IdentifierManagerFactory {
181181
let kargs: any;
182182

183183
if (Algos.salty in aid) {
184-
return new SaltyIdentifierManager(
185-
this.salter,
186-
aid.salty.pidx,
187-
aid.salty.kidx,
188-
aid.salty.tier,
189-
aid.salty.transferable,
190-
aid.salty.stem,
191-
undefined,
192-
undefined,
193-
aid.salty.icodes,
194-
undefined,
195-
undefined,
196-
aid.salty.ncodes,
197-
aid.salty.dcode,
198-
undefined,
199-
aid.salty.sxlt
200-
);
184+
algo = Algos.salty;
185+
kargs = aid.salty;
201186
} else if (Algos.randy in aid) {
202-
return new RandyIdentifierManager(
203-
this.salter,
204-
undefined,
205-
undefined,
206-
undefined,
207-
new Prefixer({ qb64: aid['prefix'] }).transferable,
208-
undefined,
209-
undefined,
210-
[],
211-
undefined,
212-
aid.randy.prxs,
213-
aid.randy.nxts
214-
);
187+
algo = Algos.randy;
188+
kargs = aid.randy;
215189
} else if (Algos.group in aid) {
216-
return new GroupIdentifierManager(
217-
this,
218-
aid.group.mhab,
219-
undefined,
220-
undefined,
221-
aid.group.keys,
222-
aid.group.ndigs
223-
);
190+
algo = Algos.group;
191+
kargs = aid.group;
224192
} else if (Algos.extern in aid) {
225-
const typ = aid.extern.extern_type;
226-
if (typ in this.modules) {
227-
const mod = new this.modules[typ](aid.extern.pidx, aid.extern);
228-
return mod;
229-
} else {
230-
throw new Error(`unsupported external module type ${typ}`);
231-
}
193+
algo = Algos.extern;
194+
kargs = aid.extern;
232195
} else {
233196
throw new Error('No algo specified');
234197
}
198+
199+
if (!kargs) {
200+
throw new Error('No kargs found in HabState');
201+
}
202+
switch (algo) {
203+
case Algos.salty:
204+
kargs = kargs as SaltyKeyState;
205+
return new SaltyIdentifierManager(
206+
this.salter,
207+
kargs.pidx,
208+
kargs.kidx,
209+
kargs.tier,
210+
kargs.transferable,
211+
kargs.stem,
212+
undefined,
213+
undefined,
214+
kargs.icodes,
215+
undefined,
216+
undefined,
217+
kargs.ncodes,
218+
kargs.dcode,
219+
undefined,
220+
kargs.sxlt
221+
);
222+
case Algos.randy:
223+
kargs = kargs as RandyKeyState;
224+
return new RandyIdentifierManager(
225+
this.salter,
226+
undefined,
227+
undefined,
228+
undefined,
229+
new Prefixer({ qb64: aid['prefix'] }).transferable,
230+
undefined,
231+
undefined,
232+
[],
233+
undefined,
234+
kargs.prxs,
235+
kargs.nxts
236+
);
237+
case Algos.group:
238+
kargs = kargs as GroupKeyState;
239+
return new GroupIdentifierManager(
240+
this,
241+
kargs.mhab,
242+
undefined,
243+
undefined,
244+
kargs.keys,
245+
kargs.ndigs
246+
);
247+
case Algos.extern: {
248+
kargs = kargs as ExternState;
249+
const typ = kargs.extern_type;
250+
if (typ in this.modules) {
251+
const mod = new this.modules[typ](kargs.pidx, kargs);
252+
return mod;
253+
} else {
254+
throw new Error(`unsupported external module type ${typ}`);
255+
}
256+
}
257+
default:
258+
throw new Error('Algo not allowed yet');
259+
}
235260
}
236261
}
237262

src/keri/core/keyState.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,3 @@ export type HabState =
4545
| RandyHabState
4646
| GroupHabState
4747
| ExternHabState;
48-

src/keri/core/salter.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ import { Matter, MtrDex } from './matter.ts';
44
import { EmptyMaterialError } from './kering.ts';
55
import libsodium from 'libsodium-wrappers-sumo';
66
import { Tier } from '../../types/keria-api-schema.ts';
7-
8-
export { Tier } from '../../types/keria-api-schema.ts';
9-
107
export { Tier } from '../../types/keria-api-schema.ts';
118

129
interface SalterArgs {

0 commit comments

Comments
 (0)