signify-ts 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -90,6 +90,12 @@ export interface IssueCredentialResult {
|
|
|
90
90
|
op: Operation;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
export interface RevokeCredentialResult {
|
|
94
|
+
anc: Serder;
|
|
95
|
+
rev: Serder;
|
|
96
|
+
op: Operation;
|
|
97
|
+
}
|
|
98
|
+
|
|
93
99
|
export interface IpexGrantArgs {
|
|
94
100
|
/**
|
|
95
101
|
* Alias for the IPEX sender AID
|
|
@@ -272,14 +278,20 @@ export class Credentials {
|
|
|
272
278
|
* @async
|
|
273
279
|
* @param {string} name Name or alias of the identifier
|
|
274
280
|
* @param {string} said SAID of the credential
|
|
281
|
+
* @param {string} datetime date time of revocation
|
|
275
282
|
* @returns {Promise<any>} A promise to the long-running operation
|
|
276
283
|
*/
|
|
277
|
-
async revoke(
|
|
284
|
+
async revoke(
|
|
285
|
+
name: string,
|
|
286
|
+
said: string,
|
|
287
|
+
datetime?: string
|
|
288
|
+
): Promise<RevokeCredentialResult> {
|
|
278
289
|
const hab = await this.client.identifiers().get(name);
|
|
279
290
|
const pre: string = hab.prefix;
|
|
280
291
|
|
|
281
292
|
const vs = versify(Ident.KERI, undefined, Serials.JSON, 0);
|
|
282
|
-
const dt =
|
|
293
|
+
const dt =
|
|
294
|
+
datetime ?? new Date().toISOString().replace('Z', '000+00:00');
|
|
283
295
|
|
|
284
296
|
const cred = await this.get(said);
|
|
285
297
|
|
|
@@ -318,6 +330,9 @@ export class Credentials {
|
|
|
318
330
|
d: rev.d,
|
|
319
331
|
},
|
|
320
332
|
];
|
|
333
|
+
|
|
334
|
+
const keeper = this.client!.manager!.get(hab);
|
|
335
|
+
|
|
321
336
|
if (estOnly) {
|
|
322
337
|
// TODO implement rotation event
|
|
323
338
|
throw new Error('Establishment only not implemented');
|
|
@@ -330,7 +345,6 @@ export class Credentials {
|
|
|
330
345
|
version: undefined,
|
|
331
346
|
kind: undefined,
|
|
332
347
|
});
|
|
333
|
-
const keeper = this.client!.manager!.get(hab);
|
|
334
348
|
sigs = await keeper.sign(b(serder.raw));
|
|
335
349
|
ixn = serder.ked;
|
|
336
350
|
}
|
|
@@ -339,6 +353,7 @@ export class Credentials {
|
|
|
339
353
|
rev: rev,
|
|
340
354
|
ixn: ixn,
|
|
341
355
|
sigs: sigs,
|
|
356
|
+
[keeper.algo]: keeper.params(),
|
|
342
357
|
};
|
|
343
358
|
|
|
344
359
|
const path = `/identifiers/${name}/credentials/${said}`;
|
|
@@ -347,7 +362,13 @@ export class Credentials {
|
|
|
347
362
|
Accept: 'application/json+cesr',
|
|
348
363
|
});
|
|
349
364
|
const res = await this.client.fetch(path, method, body, headers);
|
|
350
|
-
|
|
365
|
+
const op = await res.json();
|
|
366
|
+
|
|
367
|
+
return {
|
|
368
|
+
rev: new Serder(rev),
|
|
369
|
+
anc: new Serder(ixn),
|
|
370
|
+
op,
|
|
371
|
+
};
|
|
351
372
|
}
|
|
352
373
|
|
|
353
374
|
/**
|