Skip to content

Commit

Permalink
fix: rotate should use the next threshold as default value for rotate
Browse files Browse the repository at this point in the history
  • Loading branch information
lenkan committed Feb 4, 2024
1 parent b98dd02 commit 1be8989
Show file tree
Hide file tree
Showing 4 changed files with 387 additions and 285 deletions.
33 changes: 25 additions & 8 deletions src/keri/app/aiding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,23 @@ export interface RotateIdentifierArgs {
rstates?: any[];
}

/**
* Reducing the SignifyClient dependencies used by Identifier class
*/
export type IdentifierSignifyClient = Pick<
SignifyClient,
'fetch' | 'pidx' | 'manager'
>;

/** Identifier */
export class Identifier {
public client: SignifyClient;
public client: IdentifierSignifyClient;

/**
* Identifier
* @param {SignifyClient} client
* @param {IdentifierSignifyClient} client
*/
constructor(client: SignifyClient) {
constructor(client: IdentifierSignifyClient) {
this.client = client;
}

Expand Down Expand Up @@ -263,7 +272,7 @@ export class Identifier {
};
jsondata[keeper.algo] = keeper.params();

const res = this.client.fetch(
const res = await this.client.fetch(
'/identifiers/' + name + '?type=ixn',
'PUT',
jsondata
Expand Down Expand Up @@ -294,7 +303,7 @@ export class Identifier {
const dig = state.d;
const ridx = Number(state.s) + 1;
const wits = state.b;
let isith = state.kt;
let isith = state.nt;

let nsith = kargs.nsith ?? isith;

Expand Down Expand Up @@ -361,7 +370,11 @@ export class Identifier {
};
jsondata[keeper.algo] = keeper.params();

const res = this.client.fetch('/identifiers/' + name, 'PUT', jsondata);
const res = await this.client.fetch(
'/identifiers/' + name,
'PUT',
jsondata
);
return new EventResult(serder, sigs, res);
}

Expand Down Expand Up @@ -447,9 +460,13 @@ export class Identifier {
export class EventResult {
private readonly _serder: Serder;
private readonly _sigs: string[];
private readonly promise: Promise<Response>;
private readonly promise: Promise<Response> | Response;

constructor(serder: Serder, sigs: string[], promise: Promise<Response>) {
constructor(
serder: Serder,
sigs: string[],
promise: Promise<Response> | Response
) {
this._serder = serder;
this._sigs = sigs;
this.promise = promise;
Expand Down
2 changes: 0 additions & 2 deletions src/keri/app/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,6 @@ export class Controller {
for (const aid of aids) {
const pre: string = aid['prefix'] as string;
if ('salty' in aid) {
console.log('salty aid to rotate');
console.log(aid);
const salty: any = aid['salty'];
const cipher = new Cipher({ qb64: salty['sxlt'] });
const dnxt = decrypter.decrypt(null, cipher).qb64;
Expand Down
Loading

0 comments on commit 1be8989

Please sign in to comment.