signify-ts 0.2.1 → 0.3.0-dev.e31e78d
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/README.md +104 -34
- package/dist/exports.d.ts +40 -40
- package/dist/exports.js +40 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +3 -8
- package/dist/keri/app/aiding.d.ts +54 -18
- package/{src/keri/app/aiding.ts → dist/keri/app/aiding.js} +130 -236
- package/dist/keri/app/clienting.d.ts +59 -22
- package/{src/keri/app/clienting.ts → dist/keri/app/clienting.js} +146 -235
- package/dist/keri/app/contacting.d.ts +30 -23
- package/{src/keri/app/contacting.ts → dist/keri/app/contacting.js} +26 -63
- package/dist/keri/app/controller.d.ts +49 -6
- package/{src/keri/app/controller.ts → dist/keri/app/controller.js} +80 -186
- package/dist/keri/app/coring.d.ts +134 -25
- package/{src/keri/app/coring.ts → dist/keri/app/coring.js} +83 -56
- package/dist/keri/app/credentialing.d.ts +187 -69
- package/dist/keri/app/credentialing.js +540 -0
- package/dist/keri/app/delegating.d.ts +18 -0
- package/dist/keri/app/delegating.js +24 -0
- package/dist/keri/app/escrowing.d.ts +5 -3
- package/{src/keri/app/escrowing.ts → dist/keri/app/escrowing.js} +3 -9
- package/dist/keri/app/exchanging.d.ts +243 -11
- package/dist/keri/app/exchanging.js +242 -0
- package/dist/keri/app/grouping.d.ts +11 -9
- package/{src/keri/app/grouping.ts → dist/keri/app/grouping.js} +10 -29
- package/dist/keri/app/habery.d.ts +2 -2
- package/dist/keri/app/habery.js +117 -0
- package/dist/keri/app/notifying.d.ts +2 -2
- package/{src/keri/app/notifying.ts → dist/keri/app/notifying.js} +7 -17
- package/dist/keri/core/authing.d.ts +2 -2
- package/{src/keri/core/authing.ts → dist/keri/core/authing.js} +26 -42
- package/dist/keri/core/base64.d.ts +2 -0
- package/dist/keri/core/base64.js +16 -0
- package/dist/keri/core/bexter.d.ts +1 -1
- package/{src/keri/core/bexter.ts → dist/keri/core/bexter.js} +18 -32
- package/dist/keri/core/cigar.d.ts +2 -2
- package/dist/keri/core/cigar.js +13 -0
- package/dist/keri/core/cipher.d.ts +1 -1
- package/{src/keri/core/cipher.ts → dist/keri/core/cipher.js} +10 -19
- package/dist/keri/core/core.d.ts +117 -9
- package/dist/keri/core/core.js +385 -0
- package/dist/keri/core/counter.d.ts +2 -2
- package/dist/keri/core/counter.js +221 -0
- package/dist/keri/core/decrypter.d.ts +4 -4
- package/{src/keri/core/decrypter.ts → dist/keri/core/decrypter.js} +23 -40
- package/dist/keri/core/diger.d.ts +3 -3
- package/{src/keri/core/diger.ts → dist/keri/core/diger.js} +18 -33
- package/dist/keri/core/encrypter.d.ts +2 -2
- package/{src/keri/core/encrypter.ts → dist/keri/core/encrypter.js} +18 -38
- package/dist/keri/core/eventing.d.ts +6 -6
- package/dist/keri/core/eventing.js +383 -0
- package/dist/keri/core/httping.d.ts +11 -4
- package/{src/keri/core/httping.ts → dist/keri/core/httping.js} +36 -101
- package/dist/keri/core/indexer.d.ts +1 -1
- package/dist/keri/core/indexer.js +407 -0
- package/dist/keri/core/keeping.d.ts +113 -46
- package/dist/keri/core/keeping.js +347 -0
- package/{src/keri/core/kering.ts → dist/keri/core/kering.js} +1 -3
- package/dist/keri/core/keyState.d.ts +98 -0
- package/dist/keri/core/manager.d.ts +147 -12
- package/dist/keri/core/manager.js +880 -0
- package/dist/keri/core/matter.d.ts +1 -1
- package/dist/keri/core/matter.js +460 -0
- package/dist/keri/core/number.d.ts +2 -2
- package/{src/keri/core/number.ts → dist/keri/core/number.js} +26 -32
- package/dist/keri/core/pather.d.ts +2 -2
- package/{src/keri/core/pather.ts → dist/keri/core/pather.js} +12 -27
- package/dist/keri/core/prefixer.d.ts +10 -10
- package/dist/keri/core/prefixer.js +182 -0
- package/dist/keri/core/saider.d.ts +2 -12
- package/dist/keri/core/saider.js +107 -0
- package/dist/keri/core/salter.d.ts +44 -9
- package/dist/keri/core/salter.js +110 -0
- package/dist/keri/core/seqner.d.ts +1 -1
- package/{src/keri/core/seqner.ts → dist/keri/core/seqner.js} +20 -21
- package/dist/keri/core/serder.d.ts +25 -12
- package/dist/keri/core/serder.js +133 -0
- package/dist/keri/core/siger.d.ts +2 -2
- package/{src/keri/core/siger.ts → dist/keri/core/siger.js} +4 -14
- package/dist/keri/core/signer.d.ts +4 -4
- package/dist/keri/core/signer.js +84 -0
- package/{src/keri/core/tholder.ts → dist/keri/core/tholder.js} +69 -94
- package/dist/keri/core/utils.d.ts +1 -1
- package/{src/keri/core/utils.ts → dist/keri/core/utils.js} +30 -60
- package/dist/keri/core/vdring.d.ts +2 -2
- package/dist/keri/core/vdring.js +61 -0
- package/dist/keri/core/verfer.d.ts +2 -6
- package/dist/keri/core/verfer.js +37 -0
- package/dist/keri/end/ending.d.ts +10 -8
- package/dist/keri/end/ending.js +136 -0
- package/{src/ready.ts → dist/ready.js} +1 -2
- package/dist/types/keria-api-schema.d.ts +1158 -0
- package/dist/types/keria-api-schema.js +34 -0
- package/package.json +53 -52
- package/dist/math.d.ts +0 -1
- package/dist/signify-ts.cjs +0 -7842
- package/dist/signify-ts.cjs.development.js +0 -9501
- package/dist/signify-ts.cjs.development.js.map +0 -1
- package/dist/signify-ts.cjs.map +0 -7
- package/dist/signify-ts.cjs.production.min.js +0 -2
- package/dist/signify-ts.cjs.production.min.js.map +0 -1
- package/dist/signify-ts.esm.js +0 -9345
- package/dist/signify-ts.esm.js.map +0 -1
- package/dist/signify-ts.mjs +0 -7818
- package/dist/signify-ts.mjs.map +0 -7
- package/src/buffer-polyfill.ts +0 -5
- package/src/exports.ts +0 -44
- package/src/index.ts +0 -4
- package/src/keri/app/credentialing.ts +0 -841
- package/src/keri/app/exchanging.ts +0 -220
- package/src/keri/app/habery.ts +0 -185
- package/src/keri/core/cigar.ts +0 -18
- package/src/keri/core/core.ts +0 -326
- package/src/keri/core/counter.ts +0 -273
- package/src/keri/core/eventing.ts +0 -581
- package/src/keri/core/indexer.ts +0 -509
- package/src/keri/core/keeping.ts +0 -684
- package/src/keri/core/manager.ts +0 -1183
- package/src/keri/core/matter.ts +0 -521
- package/src/keri/core/prefixer.ts +0 -233
- package/src/keri/core/saider.ts +0 -186
- package/src/keri/core/salter.ts +0 -120
- package/src/keri/core/serder.ts +0 -163
- package/src/keri/core/signer.ts +0 -133
- package/src/keri/core/vdring.ts +0 -94
- package/src/keri/core/verfer.ts +0 -47
- package/src/keri/end/ending.ts +0 -170
- package/src/math.ts +0 -3
- /package/dist/{buffer-polyfill.d.ts → keri/core/keyState.js} +0 -0
|
@@ -1,54 +1,47 @@
|
|
|
1
|
-
import { SignifyClient } from './clienting';
|
|
2
1
|
import libsodium from 'libsodium-wrappers-sumo';
|
|
3
|
-
import { Salter } from
|
|
4
|
-
import { Matter, MtrDex } from
|
|
5
|
-
|
|
6
|
-
export function randomPasscode(): string {
|
|
2
|
+
import { Salter } from "../core/salter.js";
|
|
3
|
+
import { Matter, MtrDex } from "../core/matter.js";
|
|
4
|
+
export function randomPasscode() {
|
|
7
5
|
const raw = libsodium.randombytes_buf(16);
|
|
8
6
|
const salter = new Salter({ raw: raw });
|
|
9
|
-
|
|
10
|
-
return salter.qb64.substring(2);
|
|
7
|
+
// https://github.com/WebOfTrust/signify-ts/issues/242
|
|
8
|
+
return salter.qb64.substring(2, 23);
|
|
11
9
|
}
|
|
12
|
-
|
|
13
|
-
export function randomNonce(): string {
|
|
10
|
+
export function randomNonce() {
|
|
14
11
|
const seed = libsodium.randombytes_buf(libsodium.crypto_sign_SEEDBYTES);
|
|
15
12
|
const seedqb64 = new Matter({ raw: seed, code: MtrDex.Ed25519_Seed });
|
|
16
13
|
return seedqb64.qb64;
|
|
17
14
|
}
|
|
18
|
-
|
|
19
15
|
export class Oobis {
|
|
20
|
-
public client: SignifyClient;
|
|
21
16
|
/**
|
|
22
17
|
* Oobis
|
|
23
18
|
* @param {SignifyClient} client
|
|
24
19
|
*/
|
|
25
|
-
constructor(client
|
|
20
|
+
constructor(client) {
|
|
26
21
|
this.client = client;
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
/**
|
|
30
24
|
* Get the OOBI(s) for a managed indentifier for a given role
|
|
31
25
|
* @param {string} name Name or alias of the identifier
|
|
32
26
|
* @param {string} role Authorized role
|
|
33
|
-
* @returns {Promise<
|
|
27
|
+
* @returns {Promise<OOBI>} A promise to the OOBI(s)
|
|
34
28
|
*/
|
|
35
|
-
async get(name
|
|
29
|
+
async get(name, role = 'agent') {
|
|
36
30
|
const path = `/identifiers/${name}/oobis?role=${role}`;
|
|
37
31
|
const method = 'GET';
|
|
38
32
|
const res = await this.client.fetch(path, method, null);
|
|
39
33
|
return await res.json();
|
|
40
34
|
}
|
|
41
|
-
|
|
42
35
|
/**
|
|
43
36
|
* Resolve an OOBI
|
|
44
37
|
* @async
|
|
45
38
|
* @param {string} oobi The OOBI to be resolver
|
|
46
39
|
* @param {string} [alias] Optional name or alias to link the OOBI resolution to a contact
|
|
47
|
-
* @returns {Promise<
|
|
40
|
+
* @returns {Promise<OOBIOperation>} A promise to the long-running operation
|
|
48
41
|
*/
|
|
49
|
-
async resolve(oobi
|
|
42
|
+
async resolve(oobi, alias) {
|
|
50
43
|
const path = `/oobis`;
|
|
51
|
-
const data
|
|
44
|
+
const data = {
|
|
52
45
|
url: oobi,
|
|
53
46
|
};
|
|
54
47
|
if (alias !== undefined) {
|
|
@@ -59,40 +52,41 @@ export class Oobis {
|
|
|
59
52
|
return await res.json();
|
|
60
53
|
}
|
|
61
54
|
}
|
|
62
|
-
|
|
63
|
-
export interface Operation<T = unknown> {
|
|
64
|
-
name: string;
|
|
65
|
-
metadata?: {
|
|
66
|
-
depends?: Operation;
|
|
67
|
-
[property: string]: any;
|
|
68
|
-
};
|
|
69
|
-
done?: boolean;
|
|
70
|
-
error?: any;
|
|
71
|
-
response?: T;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
55
|
/**
|
|
75
56
|
* Operations
|
|
76
57
|
* @remarks
|
|
77
58
|
* Operations represent the status and result of long running tasks performed by KERIA agent
|
|
78
59
|
*/
|
|
79
60
|
export class Operations {
|
|
80
|
-
public client: SignifyClient;
|
|
81
61
|
/**
|
|
82
62
|
* Operations
|
|
83
63
|
* @param {SignifyClient} client
|
|
84
64
|
*/
|
|
85
|
-
constructor(client
|
|
65
|
+
constructor(client) {
|
|
86
66
|
this.client = client;
|
|
87
67
|
}
|
|
88
|
-
|
|
68
|
+
hasDepends(op) {
|
|
69
|
+
return op.metadata !== undefined && 'depends' in op.metadata;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Check if operation failed and throw error with details
|
|
73
|
+
* @throws {Error} If operation has an error
|
|
74
|
+
*/
|
|
75
|
+
throwIfFailed(op) {
|
|
76
|
+
if ('error' in op && op.error !== null) {
|
|
77
|
+
const details = op.error.details
|
|
78
|
+
? ` Details: ${JSON.stringify(op.error.details)}`
|
|
79
|
+
: '';
|
|
80
|
+
throw new Error(`Operation '${op.name}' failed [Code ${op.error.code}]: ${op.error.message}${details}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
89
83
|
/**
|
|
90
84
|
* Get operation status
|
|
91
85
|
* @async
|
|
92
86
|
* @param {string} name Name of the operation
|
|
93
87
|
* @returns {Promise<Operation>} A promise to the status of the operation
|
|
94
88
|
*/
|
|
95
|
-
async get
|
|
89
|
+
async get(name) {
|
|
96
90
|
const path = `/operations/${name}`;
|
|
97
91
|
const data = null;
|
|
98
92
|
const method = 'GET';
|
|
@@ -105,7 +99,7 @@ export class Operations {
|
|
|
105
99
|
* @param {string} type Select operations by type
|
|
106
100
|
* @returns {Promise<Operation[]>} A list of operations
|
|
107
101
|
*/
|
|
108
|
-
async list(type
|
|
102
|
+
async list(type) {
|
|
109
103
|
const params = new URLSearchParams();
|
|
110
104
|
if (type !== undefined) {
|
|
111
105
|
params.append('type', type);
|
|
@@ -121,34 +115,58 @@ export class Operations {
|
|
|
121
115
|
* @async
|
|
122
116
|
* @param {string} name Name of the operation
|
|
123
117
|
*/
|
|
124
|
-
async delete(name
|
|
118
|
+
async delete(name) {
|
|
125
119
|
const path = `/operations/${name}`;
|
|
126
120
|
const data = null;
|
|
127
121
|
const method = 'DELETE';
|
|
128
122
|
await this.client.fetch(path, method, data);
|
|
129
123
|
}
|
|
124
|
+
async wait(op, options = {}) {
|
|
125
|
+
var _a, _b, _c, _d;
|
|
126
|
+
const minSleep = (_a = options.minSleep) !== null && _a !== void 0 ? _a : 10;
|
|
127
|
+
const maxSleep = (_b = options.maxSleep) !== null && _b !== void 0 ? _b : 10000;
|
|
128
|
+
const increaseFactor = (_c = options.increaseFactor) !== null && _c !== void 0 ? _c : 50;
|
|
129
|
+
if (this.hasDepends(op) &&
|
|
130
|
+
op.metadata.depends &&
|
|
131
|
+
!op.metadata.depends.done) {
|
|
132
|
+
await this.wait(op.metadata.depends, options);
|
|
133
|
+
}
|
|
134
|
+
if (op.done === true) {
|
|
135
|
+
this.throwIfFailed(op);
|
|
136
|
+
return op;
|
|
137
|
+
}
|
|
138
|
+
let retries = 0;
|
|
139
|
+
while (true) {
|
|
140
|
+
op = await this.get(op.name);
|
|
141
|
+
if (op.done === true) {
|
|
142
|
+
this.throwIfFailed(op);
|
|
143
|
+
return op;
|
|
144
|
+
}
|
|
145
|
+
const delay = Math.max(minSleep, Math.min(maxSleep, 2 ** retries * increaseFactor));
|
|
146
|
+
retries++;
|
|
147
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
148
|
+
(_d = options.signal) === null || _d === void 0 ? void 0 : _d.throwIfAborted();
|
|
149
|
+
}
|
|
150
|
+
}
|
|
130
151
|
}
|
|
131
|
-
|
|
132
152
|
/**
|
|
133
153
|
* KeyEvents
|
|
134
154
|
*/
|
|
135
155
|
export class KeyEvents {
|
|
136
|
-
public client: SignifyClient;
|
|
137
156
|
/**
|
|
138
157
|
* KeyEvents
|
|
139
158
|
* @param {SignifyClient} client
|
|
140
159
|
*/
|
|
141
|
-
constructor(client
|
|
160
|
+
constructor(client) {
|
|
142
161
|
this.client = client;
|
|
143
162
|
}
|
|
144
|
-
|
|
145
163
|
/**
|
|
146
164
|
* Retrieve key events for an identifier
|
|
147
165
|
* @async
|
|
148
166
|
* @param {string} pre Identifier prefix
|
|
149
|
-
* @returns {Promise<
|
|
167
|
+
* @returns {Promise<KeyEventRecord[]>} A promise to the key events
|
|
150
168
|
*/
|
|
151
|
-
async get(pre
|
|
169
|
+
async get(pre) {
|
|
152
170
|
const path = `/events?pre=${pre}`;
|
|
153
171
|
const data = null;
|
|
154
172
|
const method = 'GET';
|
|
@@ -156,59 +174,54 @@ export class KeyEvents {
|
|
|
156
174
|
return await res.json();
|
|
157
175
|
}
|
|
158
176
|
}
|
|
159
|
-
|
|
160
177
|
/**
|
|
161
178
|
* KeyStates
|
|
162
179
|
*/
|
|
163
180
|
export class KeyStates {
|
|
164
|
-
public client: SignifyClient;
|
|
165
181
|
/**
|
|
166
182
|
* KeyStates
|
|
167
183
|
* @param {SignifyClient} client
|
|
168
184
|
*/
|
|
169
|
-
constructor(client
|
|
185
|
+
constructor(client) {
|
|
170
186
|
this.client = client;
|
|
171
187
|
}
|
|
172
|
-
|
|
173
188
|
/**
|
|
174
189
|
* Retriene the key state for an identifier
|
|
175
190
|
* @async
|
|
176
191
|
* @param {string} pre Identifier prefix
|
|
177
|
-
* @returns {Promise<
|
|
192
|
+
* @returns {Promise<KeyState[]>} A promise to the key states
|
|
178
193
|
*/
|
|
179
|
-
async get(pre
|
|
194
|
+
async get(pre) {
|
|
180
195
|
const path = `/states?pre=${pre}`;
|
|
181
196
|
const data = null;
|
|
182
197
|
const method = 'GET';
|
|
183
198
|
const res = await this.client.fetch(path, method, data);
|
|
184
199
|
return await res.json();
|
|
185
200
|
}
|
|
186
|
-
|
|
187
201
|
/**
|
|
188
202
|
* Retrieve the key state for a list of identifiers
|
|
189
203
|
* @async
|
|
190
204
|
* @param {Array<string>} pres List of identifier prefixes
|
|
191
205
|
* @returns {Promise<any>} A promise to the key states
|
|
192
206
|
*/
|
|
193
|
-
async list(pres
|
|
207
|
+
async list(pres) {
|
|
194
208
|
const path = `/states?${pres.map((pre) => `pre=${pre}`).join('&')}`;
|
|
195
209
|
const data = null;
|
|
196
210
|
const method = 'GET';
|
|
197
211
|
const res = await this.client.fetch(path, method, data);
|
|
198
212
|
return await res.json();
|
|
199
213
|
}
|
|
200
|
-
|
|
201
214
|
/**
|
|
202
215
|
* Query the key state of an identifier for a given sequence number or anchor
|
|
203
216
|
* @async
|
|
204
217
|
* @param {string} pre Identifier prefix
|
|
205
218
|
* @param {number} [sn] Optional sequence number
|
|
206
219
|
* @param {any} [anchor] Optional anchor
|
|
207
|
-
* @returns {Promise<
|
|
220
|
+
* @returns {Promise<QueryOperation>} A promise to the long-running operation
|
|
208
221
|
*/
|
|
209
|
-
async query(pre
|
|
222
|
+
async query(pre, sn, anchor) {
|
|
210
223
|
const path = `/queries`;
|
|
211
|
-
const data
|
|
224
|
+
const data = {
|
|
212
225
|
pre: pre,
|
|
213
226
|
};
|
|
214
227
|
if (sn !== undefined) {
|
|
@@ -217,9 +230,23 @@ export class KeyStates {
|
|
|
217
230
|
if (anchor !== undefined) {
|
|
218
231
|
data.anchor = anchor;
|
|
219
232
|
}
|
|
220
|
-
|
|
221
233
|
const method = 'POST';
|
|
222
234
|
const res = await this.client.fetch(path, method, data);
|
|
223
235
|
return await res.json();
|
|
224
236
|
}
|
|
225
237
|
}
|
|
238
|
+
export class Config {
|
|
239
|
+
/**
|
|
240
|
+
* Config
|
|
241
|
+
* @param {SignifyClient} client
|
|
242
|
+
*/
|
|
243
|
+
constructor(client) {
|
|
244
|
+
this.client = client;
|
|
245
|
+
}
|
|
246
|
+
async get() {
|
|
247
|
+
const path = `/config`;
|
|
248
|
+
const method = 'GET';
|
|
249
|
+
const res = await this.client.fetch(path, method, null);
|
|
250
|
+
return await res.json();
|
|
251
|
+
}
|
|
252
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { SignifyClient } from './clienting';
|
|
2
|
-
import { Dict } from '../core/core';
|
|
3
|
-
import { Serder } from '../core/serder';
|
|
4
|
-
import {
|
|
1
|
+
import { SignifyClient } from './clienting.ts';
|
|
2
|
+
import { Dict } from '../core/core.ts';
|
|
3
|
+
import { Serder } from '../core/serder.ts';
|
|
4
|
+
import { ExchangeOperation, CredentialOperation, GroupOperation, DelegationOperation, WitnessOperation, DoneOperation, HabState, RegistryOperation } from '../core/keyState.ts';
|
|
5
|
+
import { components } from '../../types/keria-api-schema.ts';
|
|
6
|
+
export type CredentialResult = components['schemas']['Credential'];
|
|
7
|
+
export type Registry = components['schemas']['Registry'];
|
|
8
|
+
export type Schema = components['schemas']['Schema'];
|
|
5
9
|
/** Types of credentials */
|
|
6
10
|
export declare class CredentialTypes {
|
|
7
11
|
static issued: string;
|
|
@@ -14,54 +18,132 @@ export interface CredentialFilter {
|
|
|
14
18
|
skip?: number;
|
|
15
19
|
limit?: number;
|
|
16
20
|
}
|
|
17
|
-
export interface
|
|
21
|
+
export interface CredentialSubject {
|
|
18
22
|
/**
|
|
19
|
-
*
|
|
23
|
+
* Issuee, or holder of the credential.
|
|
20
24
|
*/
|
|
21
|
-
|
|
25
|
+
i?: string;
|
|
22
26
|
/**
|
|
23
|
-
*
|
|
27
|
+
* Timestamp of issuance.
|
|
24
28
|
*/
|
|
25
|
-
|
|
29
|
+
dt?: string;
|
|
26
30
|
/**
|
|
27
|
-
*
|
|
31
|
+
* Privacy salt
|
|
28
32
|
*/
|
|
29
|
-
|
|
33
|
+
u?: string;
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
}
|
|
36
|
+
export interface CredentialData {
|
|
37
|
+
v?: string;
|
|
38
|
+
d?: string;
|
|
30
39
|
/**
|
|
31
|
-
*
|
|
40
|
+
* Privacy salt
|
|
32
41
|
*/
|
|
33
|
-
|
|
42
|
+
u?: string;
|
|
34
43
|
/**
|
|
35
|
-
*
|
|
44
|
+
* Issuer of the credential.
|
|
36
45
|
*/
|
|
37
|
-
|
|
46
|
+
i?: string;
|
|
38
47
|
/**
|
|
39
|
-
*
|
|
48
|
+
* Registry id.
|
|
40
49
|
*/
|
|
41
|
-
|
|
50
|
+
ri?: string;
|
|
42
51
|
/**
|
|
43
|
-
*
|
|
52
|
+
* Schema id
|
|
44
53
|
*/
|
|
45
|
-
|
|
54
|
+
s?: string;
|
|
46
55
|
/**
|
|
47
|
-
*
|
|
56
|
+
* Credential subject data
|
|
48
57
|
*/
|
|
49
|
-
|
|
58
|
+
a: CredentialSubject;
|
|
59
|
+
/**
|
|
60
|
+
* Credential source section
|
|
61
|
+
*/
|
|
62
|
+
e?: {
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
};
|
|
50
65
|
/**
|
|
51
|
-
*
|
|
66
|
+
* Credential rules section
|
|
52
67
|
*/
|
|
53
|
-
|
|
68
|
+
r?: {
|
|
69
|
+
[key: string]: unknown;
|
|
70
|
+
};
|
|
54
71
|
}
|
|
55
72
|
export interface IssueCredentialResult {
|
|
56
73
|
acdc: Serder;
|
|
57
74
|
anc: Serder;
|
|
58
75
|
iss: Serder;
|
|
59
|
-
op:
|
|
76
|
+
op: CredentialOperation;
|
|
60
77
|
}
|
|
61
78
|
export interface RevokeCredentialResult {
|
|
62
79
|
anc: Serder;
|
|
63
80
|
rev: Serder;
|
|
64
|
-
op:
|
|
81
|
+
op: GroupOperation | DelegationOperation | WitnessOperation | DoneOperation;
|
|
82
|
+
}
|
|
83
|
+
export interface IpexApplyArgs {
|
|
84
|
+
/**
|
|
85
|
+
* Alias for the IPEX sender AID
|
|
86
|
+
*/
|
|
87
|
+
senderName: string;
|
|
88
|
+
/**
|
|
89
|
+
* Prefix of the IPEX recipient AID
|
|
90
|
+
*/
|
|
91
|
+
recipient: string;
|
|
92
|
+
/**
|
|
93
|
+
* Message to send
|
|
94
|
+
*/
|
|
95
|
+
message?: string;
|
|
96
|
+
/**
|
|
97
|
+
* SAID of schema to apply for
|
|
98
|
+
*/
|
|
99
|
+
schemaSaid: string;
|
|
100
|
+
/**
|
|
101
|
+
* Optional attributes for selective disclosure
|
|
102
|
+
*/
|
|
103
|
+
attributes?: Record<string, unknown>;
|
|
104
|
+
datetime?: string;
|
|
105
|
+
}
|
|
106
|
+
export interface IpexOfferArgs {
|
|
107
|
+
/**
|
|
108
|
+
* Alias for the IPEX sender AID
|
|
109
|
+
*/
|
|
110
|
+
senderName: string;
|
|
111
|
+
/**
|
|
112
|
+
* Prefix of the IPEX recipient AID
|
|
113
|
+
*/
|
|
114
|
+
recipient: string;
|
|
115
|
+
/**
|
|
116
|
+
* Message to send
|
|
117
|
+
*/
|
|
118
|
+
message?: string;
|
|
119
|
+
/**
|
|
120
|
+
* ACDC to offer
|
|
121
|
+
*/
|
|
122
|
+
acdc: Serder;
|
|
123
|
+
/**
|
|
124
|
+
* Optional qb64 SAID of apply message this offer is responding to
|
|
125
|
+
*/
|
|
126
|
+
applySaid?: string;
|
|
127
|
+
datetime?: string;
|
|
128
|
+
}
|
|
129
|
+
export interface IpexAgreeArgs {
|
|
130
|
+
/**
|
|
131
|
+
* Alias for the IPEX sender AID
|
|
132
|
+
*/
|
|
133
|
+
senderName: string;
|
|
134
|
+
/**
|
|
135
|
+
* Prefix of the IPEX recipient AID
|
|
136
|
+
*/
|
|
137
|
+
recipient: string;
|
|
138
|
+
/**
|
|
139
|
+
* Message to send
|
|
140
|
+
*/
|
|
141
|
+
message?: string;
|
|
142
|
+
/**
|
|
143
|
+
* qb64 SAID of offer message this agree is responding to
|
|
144
|
+
*/
|
|
145
|
+
offerSaid: string;
|
|
146
|
+
datetime?: string;
|
|
65
147
|
}
|
|
66
148
|
export interface IpexGrantArgs {
|
|
67
149
|
/**
|
|
@@ -79,7 +161,7 @@ export interface IpexGrantArgs {
|
|
|
79
161
|
/**
|
|
80
162
|
* qb64 SAID of agree message this grant is responding to
|
|
81
163
|
*/
|
|
82
|
-
|
|
164
|
+
agreeSaid?: string;
|
|
83
165
|
datetime?: string;
|
|
84
166
|
acdc: Serder;
|
|
85
167
|
acdcAttachment?: string;
|
|
@@ -88,6 +170,26 @@ export interface IpexGrantArgs {
|
|
|
88
170
|
anc: Serder;
|
|
89
171
|
ancAttachment?: string;
|
|
90
172
|
}
|
|
173
|
+
export interface IpexAdmitArgs {
|
|
174
|
+
/**
|
|
175
|
+
* Alias for the IPEX sender AID
|
|
176
|
+
*/
|
|
177
|
+
senderName: string;
|
|
178
|
+
/**
|
|
179
|
+
* Prefix of the IPEX recipient AID
|
|
180
|
+
*/
|
|
181
|
+
recipient: string;
|
|
182
|
+
/**
|
|
183
|
+
* Message to send
|
|
184
|
+
*/
|
|
185
|
+
message?: string;
|
|
186
|
+
/**
|
|
187
|
+
* qb64 SAID of agree message this admit is responding to
|
|
188
|
+
*/
|
|
189
|
+
grantSaid: string;
|
|
190
|
+
datetime?: string;
|
|
191
|
+
}
|
|
192
|
+
export type CredentialState = components['schemas']['CredentialState'];
|
|
91
193
|
/**
|
|
92
194
|
* Credentials
|
|
93
195
|
*/
|
|
@@ -102,50 +204,48 @@ export declare class Credentials {
|
|
|
102
204
|
* List credentials
|
|
103
205
|
* @async
|
|
104
206
|
* @param {CredentialFilter} [kargs] Optional parameters to filter the credentials
|
|
105
|
-
* @returns {Promise<
|
|
207
|
+
* @returns {Promise<CredentialResult[]>} A promise to the list of credentials
|
|
106
208
|
*/
|
|
107
|
-
list(kargs?: CredentialFilter): Promise<
|
|
209
|
+
list(kargs?: CredentialFilter): Promise<CredentialResult[]>;
|
|
108
210
|
/**
|
|
109
211
|
* Get a credential
|
|
110
212
|
* @async
|
|
111
213
|
* @param {string} said - SAID of the credential
|
|
112
214
|
* @param {boolean} [includeCESR=false] - Optional flag export the credential in CESR format
|
|
113
|
-
* @returns {Promise<
|
|
215
|
+
* @returns {Promise<CredentialResult | string>} A promise to the credential
|
|
114
216
|
*/
|
|
115
|
-
get(said: string
|
|
217
|
+
get(said: string): Promise<CredentialResult>;
|
|
218
|
+
get(said: string, includeCESR: false): Promise<CredentialResult>;
|
|
219
|
+
get(said: string, includeCESR: true): Promise<string>;
|
|
220
|
+
get(said: string, includeCESR: boolean): Promise<CredentialResult | string>;
|
|
116
221
|
/**
|
|
117
|
-
*
|
|
222
|
+
* Delete a credential from the DB
|
|
223
|
+
* @async
|
|
224
|
+
* @param {string} said - SAID of the credential
|
|
225
|
+
* @returns {Promise<void>}
|
|
118
226
|
*/
|
|
119
|
-
|
|
227
|
+
delete(said: string): Promise<void>;
|
|
120
228
|
/**
|
|
121
|
-
*
|
|
229
|
+
* Get the state of a credential
|
|
122
230
|
* @async
|
|
123
|
-
* @param {string}
|
|
124
|
-
* @param {string} said SAID of the credential
|
|
125
|
-
* @
|
|
126
|
-
* @returns {Promise<any>} A promise to the long-running operation
|
|
231
|
+
* @param {string} ri - management registry identifier
|
|
232
|
+
* @param {string} said - SAID of the credential
|
|
233
|
+
* @returns {Promise<CredentialState>} A promise to the credential registry state
|
|
127
234
|
*/
|
|
128
|
-
|
|
235
|
+
state(ri: string, said: string): Promise<CredentialState>;
|
|
129
236
|
/**
|
|
130
|
-
*
|
|
131
|
-
* @async
|
|
132
|
-
* @param {string} name Name or alias of the identifier
|
|
133
|
-
* @param {string} said SAID of the credential
|
|
134
|
-
* @param {string} recipient Identifier prefix of the receiver of the presentation
|
|
135
|
-
* @param {boolean} [include=true] Flag to indicate whether to stream credential alongside presentation exchange message
|
|
136
|
-
* @returns {Promise<string>} A promise to the long-running operation
|
|
237
|
+
* Creates a credential in the specified registry to be GRANTed with IPEX to the intended recipient
|
|
137
238
|
*/
|
|
138
|
-
|
|
239
|
+
issue(name: string, args: CredentialData): Promise<IssueCredentialResult>;
|
|
139
240
|
/**
|
|
140
|
-
*
|
|
241
|
+
* Revoke credential
|
|
141
242
|
* @async
|
|
142
243
|
* @param {string} name Name or alias of the identifier
|
|
143
|
-
* @param {string}
|
|
144
|
-
* @param {string}
|
|
145
|
-
* @
|
|
146
|
-
* @returns {Promise<string>} A promise to the long-running operation
|
|
244
|
+
* @param {string} said SAID of the credential
|
|
245
|
+
* @param {string} datetime date time of revocation
|
|
246
|
+
* @returns {Promise<RevokeCredentialResult>} A promise to the long-running operation
|
|
147
247
|
*/
|
|
148
|
-
|
|
248
|
+
revoke(name: string, said: string, datetime?: string): Promise<RevokeCredentialResult>;
|
|
149
249
|
}
|
|
150
250
|
export interface CreateRegistryArgs {
|
|
151
251
|
name: string;
|
|
@@ -164,7 +264,7 @@ export declare class RegistryResult {
|
|
|
164
264
|
get regser(): any;
|
|
165
265
|
get serder(): Serder;
|
|
166
266
|
get sigs(): string[];
|
|
167
|
-
op(): Promise<
|
|
267
|
+
op(): Promise<RegistryOperation>;
|
|
168
268
|
}
|
|
169
269
|
/**
|
|
170
270
|
* Registries
|
|
@@ -180,9 +280,9 @@ export declare class Registries {
|
|
|
180
280
|
* List registries
|
|
181
281
|
* @async
|
|
182
282
|
* @param {string} name Name or alias of the identifier
|
|
183
|
-
* @returns {Promise<
|
|
283
|
+
* @returns {Promise<Registry[]>} A promise to the list of registries
|
|
184
284
|
*/
|
|
185
|
-
list(name: string): Promise<
|
|
285
|
+
list(name: string): Promise<Registry[]>;
|
|
186
286
|
/**
|
|
187
287
|
* Create a registry
|
|
188
288
|
* @async
|
|
@@ -190,7 +290,16 @@ export declare class Registries {
|
|
|
190
290
|
* @returns {Promise<[any, Serder, any[], object]> } A promise to the long-running operation
|
|
191
291
|
*/
|
|
192
292
|
create({ name, registryName, noBackers, toad, baks, nonce, }: CreateRegistryArgs): Promise<RegistryResult>;
|
|
193
|
-
createFromEvents(hab:
|
|
293
|
+
createFromEvents(hab: HabState, name: string, registryName: string, vcp: Dict<any>, ixn: Dict<any>, sigs: any[]): Promise<Response>;
|
|
294
|
+
/**
|
|
295
|
+
* Rename a registry
|
|
296
|
+
* @async
|
|
297
|
+
* @param {string} name Name or alias of the identifier
|
|
298
|
+
* @param {string} registryName Current registry name
|
|
299
|
+
* @param {string} newName New registry name
|
|
300
|
+
* @returns {Promise<Registry>} A promise to the registry record
|
|
301
|
+
*/
|
|
302
|
+
rename(name: string, registryName: string, newName: string): Promise<Registry>;
|
|
194
303
|
}
|
|
195
304
|
/**
|
|
196
305
|
* Schemas
|
|
@@ -206,15 +315,15 @@ export declare class Schemas {
|
|
|
206
315
|
* Get a schema
|
|
207
316
|
* @async
|
|
208
317
|
* @param {string} said SAID of the schema
|
|
209
|
-
* @returns {Promise<
|
|
318
|
+
* @returns {Promise<Schema>} A promise to the schema
|
|
210
319
|
*/
|
|
211
|
-
get(said: string): Promise<
|
|
320
|
+
get(said: string): Promise<Schema>;
|
|
212
321
|
/**
|
|
213
322
|
* List schemas
|
|
214
323
|
* @async
|
|
215
|
-
* @returns {Promise<
|
|
324
|
+
* @returns {Promise<Schema[]>} A promise to the list of schemas
|
|
216
325
|
*/
|
|
217
|
-
list(): Promise<
|
|
326
|
+
list(): Promise<Schema[]>;
|
|
218
327
|
}
|
|
219
328
|
/**
|
|
220
329
|
* Ipex
|
|
@@ -226,20 +335,29 @@ export declare class Ipex {
|
|
|
226
335
|
* @param {SignifyClient} client
|
|
227
336
|
*/
|
|
228
337
|
constructor(client: SignifyClient);
|
|
338
|
+
/**
|
|
339
|
+
* Create an IPEX apply EXN message
|
|
340
|
+
*/
|
|
341
|
+
apply(args: IpexApplyArgs): Promise<[Serder, string[], string]>;
|
|
342
|
+
submitApply(name: string, exn: Serder, sigs: string[], recp: string[]): Promise<ExchangeOperation>;
|
|
343
|
+
/**
|
|
344
|
+
* Create an IPEX offer EXN message
|
|
345
|
+
*/
|
|
346
|
+
offer(args: IpexOfferArgs): Promise<[Serder, string[], string]>;
|
|
347
|
+
submitOffer(name: string, exn: Serder, sigs: string[], atc: string, recp: string[]): Promise<ExchangeOperation>;
|
|
348
|
+
/**
|
|
349
|
+
* Create an IPEX agree EXN message
|
|
350
|
+
*/
|
|
351
|
+
agree(args: IpexAgreeArgs): Promise<[Serder, string[], string]>;
|
|
352
|
+
submitAgree(name: string, exn: Serder, sigs: string[], recp: string[]): Promise<ExchangeOperation>;
|
|
229
353
|
/**
|
|
230
354
|
* Create an IPEX grant EXN message
|
|
231
355
|
*/
|
|
232
356
|
grant(args: IpexGrantArgs): Promise<[Serder, string[], string]>;
|
|
233
|
-
submitGrant(name: string, exn: Serder, sigs: string[], atc: string, recp: string[]): Promise<
|
|
357
|
+
submitGrant(name: string, exn: Serder, sigs: string[], atc: string, recp: string[]): Promise<ExchangeOperation>;
|
|
234
358
|
/**
|
|
235
359
|
* Create an IPEX admit EXN message
|
|
236
|
-
* @async
|
|
237
|
-
* @param {string} name Name or alias of the identifier
|
|
238
|
-
* @param {string} message accompany human readable description of the credential being admitted
|
|
239
|
-
* @param {string} grant qb64 SAID of grant message this admit is responding to
|
|
240
|
-
* @param {string} datetime Optional datetime to set for the credential
|
|
241
|
-
* @returns {Promise<[Serder, string[], string]>} A promise to the long-running operation
|
|
242
360
|
*/
|
|
243
|
-
admit(
|
|
244
|
-
submitAdmit(name: string, exn: Serder, sigs: string[], atc: string, recp: string[]): Promise<
|
|
361
|
+
admit(args: IpexAdmitArgs): Promise<[Serder, string[], string]>;
|
|
362
|
+
submitAdmit(name: string, exn: Serder, sigs: string[], atc: string, recp: string[]): Promise<ExchangeOperation>;
|
|
245
363
|
}
|