signify-ts 0.2.1 → 0.3.0-rc2

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.
Files changed (128) hide show
  1. package/README.md +104 -34
  2. package/dist/exports.d.ts +40 -40
  3. package/dist/exports.js +40 -0
  4. package/dist/index.d.ts +2 -3
  5. package/dist/index.js +3 -8
  6. package/dist/keri/app/aiding.d.ts +34 -14
  7. package/{src/keri/app/aiding.ts → dist/keri/app/aiding.js} +104 -235
  8. package/dist/keri/app/clienting.d.ts +57 -22
  9. package/{src/keri/app/clienting.ts → dist/keri/app/clienting.js} +145 -234
  10. package/dist/keri/app/contacting.d.ts +33 -21
  11. package/{src/keri/app/contacting.ts → dist/keri/app/contacting.js} +25 -62
  12. package/dist/keri/app/controller.d.ts +49 -6
  13. package/{src/keri/app/controller.ts → dist/keri/app/controller.js} +79 -185
  14. package/dist/keri/app/coring.d.ts +30 -8
  15. package/{src/keri/app/coring.ts → dist/keri/app/coring.js} +62 -51
  16. package/dist/keri/app/credentialing.d.ts +183 -65
  17. package/dist/keri/app/credentialing.js +540 -0
  18. package/dist/keri/app/delegating.d.ts +18 -0
  19. package/dist/keri/app/delegating.js +24 -0
  20. package/dist/keri/app/escrowing.d.ts +1 -1
  21. package/{src/keri/app/escrowing.ts → dist/keri/app/escrowing.js} +2 -8
  22. package/dist/keri/app/exchanging.d.ts +7 -6
  23. package/{src/keri/app/exchanging.ts → dist/keri/app/exchanging.js} +33 -110
  24. package/dist/keri/app/grouping.d.ts +2 -2
  25. package/{src/keri/app/grouping.ts → dist/keri/app/grouping.js} +6 -25
  26. package/dist/keri/app/habery.d.ts +2 -2
  27. package/dist/keri/app/habery.js +117 -0
  28. package/dist/keri/app/notifying.d.ts +2 -2
  29. package/{src/keri/app/notifying.ts → dist/keri/app/notifying.js} +7 -17
  30. package/dist/keri/core/authing.d.ts +2 -2
  31. package/{src/keri/core/authing.ts → dist/keri/core/authing.js} +26 -42
  32. package/dist/keri/core/base64.d.ts +2 -0
  33. package/dist/keri/core/base64.js +16 -0
  34. package/dist/keri/core/bexter.d.ts +1 -1
  35. package/{src/keri/core/bexter.ts → dist/keri/core/bexter.js} +18 -32
  36. package/dist/keri/core/cigar.d.ts +2 -2
  37. package/dist/keri/core/cigar.js +13 -0
  38. package/dist/keri/core/cipher.d.ts +1 -1
  39. package/{src/keri/core/cipher.ts → dist/keri/core/cipher.js} +10 -19
  40. package/dist/keri/core/core.d.ts +117 -9
  41. package/dist/keri/core/core.js +385 -0
  42. package/dist/keri/core/counter.d.ts +2 -2
  43. package/dist/keri/core/counter.js +221 -0
  44. package/dist/keri/core/decrypter.d.ts +4 -4
  45. package/{src/keri/core/decrypter.ts → dist/keri/core/decrypter.js} +23 -40
  46. package/dist/keri/core/diger.d.ts +3 -3
  47. package/{src/keri/core/diger.ts → dist/keri/core/diger.js} +18 -33
  48. package/dist/keri/core/encrypter.d.ts +2 -2
  49. package/{src/keri/core/encrypter.ts → dist/keri/core/encrypter.js} +18 -38
  50. package/dist/keri/core/eventing.d.ts +4 -4
  51. package/{src/keri/core/eventing.ts → dist/keri/core/eventing.js} +134 -321
  52. package/dist/keri/core/httping.d.ts +11 -4
  53. package/{src/keri/core/httping.ts → dist/keri/core/httping.js} +36 -101
  54. package/dist/keri/core/indexer.d.ts +1 -1
  55. package/dist/keri/core/indexer.js +407 -0
  56. package/dist/keri/core/keeping.d.ts +98 -46
  57. package/dist/keri/core/keeping.js +365 -0
  58. package/{src/keri/core/kering.ts → dist/keri/core/kering.js} +1 -3
  59. package/dist/keri/core/keyState.d.ts +85 -0
  60. package/dist/keri/core/keyState.js +1 -0
  61. package/dist/keri/core/manager.d.ts +147 -12
  62. package/dist/keri/core/manager.js +880 -0
  63. package/dist/keri/core/matter.d.ts +1 -1
  64. package/dist/keri/core/matter.js +460 -0
  65. package/dist/keri/core/number.d.ts +1 -1
  66. package/{src/keri/core/number.ts → dist/keri/core/number.js} +21 -30
  67. package/dist/keri/core/pather.d.ts +2 -2
  68. package/{src/keri/core/pather.ts → dist/keri/core/pather.js} +12 -27
  69. package/dist/keri/core/prefixer.d.ts +10 -10
  70. package/dist/keri/core/prefixer.js +182 -0
  71. package/dist/keri/core/saider.d.ts +2 -12
  72. package/dist/keri/core/saider.js +107 -0
  73. package/dist/keri/core/salter.d.ts +45 -3
  74. package/dist/keri/core/salter.js +117 -0
  75. package/dist/keri/core/seqner.d.ts +1 -1
  76. package/{src/keri/core/seqner.ts → dist/keri/core/seqner.js} +20 -21
  77. package/dist/keri/core/serder.d.ts +25 -12
  78. package/dist/keri/core/serder.js +133 -0
  79. package/dist/keri/core/siger.d.ts +2 -2
  80. package/{src/keri/core/siger.ts → dist/keri/core/siger.js} +4 -14
  81. package/dist/keri/core/signer.d.ts +4 -4
  82. package/dist/keri/core/signer.js +84 -0
  83. package/{src/keri/core/tholder.ts → dist/keri/core/tholder.js} +69 -94
  84. package/dist/keri/core/utils.d.ts +1 -1
  85. package/{src/keri/core/utils.ts → dist/keri/core/utils.js} +30 -60
  86. package/dist/keri/core/vdring.d.ts +2 -2
  87. package/dist/keri/core/vdring.js +61 -0
  88. package/dist/keri/core/verfer.d.ts +2 -6
  89. package/dist/keri/core/verfer.js +37 -0
  90. package/dist/keri/end/ending.d.ts +10 -8
  91. package/dist/keri/end/ending.js +136 -0
  92. package/{src/ready.ts → dist/ready.js} +1 -2
  93. package/dist/types/keria-api-schema.d.ts +304 -0
  94. package/dist/types/keria-api-schema.js +2 -0
  95. package/package.json +53 -50
  96. package/dist/buffer-polyfill.d.ts +0 -1
  97. package/dist/math.d.ts +0 -1
  98. package/dist/signify-ts.cjs +0 -7842
  99. package/dist/signify-ts.cjs.development.js +0 -9501
  100. package/dist/signify-ts.cjs.development.js.map +0 -1
  101. package/dist/signify-ts.cjs.map +0 -7
  102. package/dist/signify-ts.cjs.production.min.js +0 -2
  103. package/dist/signify-ts.cjs.production.min.js.map +0 -1
  104. package/dist/signify-ts.esm.js +0 -9345
  105. package/dist/signify-ts.esm.js.map +0 -1
  106. package/dist/signify-ts.mjs +0 -7818
  107. package/dist/signify-ts.mjs.map +0 -7
  108. package/src/buffer-polyfill.ts +0 -5
  109. package/src/exports.ts +0 -44
  110. package/src/index.ts +0 -4
  111. package/src/keri/app/credentialing.ts +0 -841
  112. package/src/keri/app/habery.ts +0 -185
  113. package/src/keri/core/cigar.ts +0 -18
  114. package/src/keri/core/core.ts +0 -326
  115. package/src/keri/core/counter.ts +0 -273
  116. package/src/keri/core/indexer.ts +0 -509
  117. package/src/keri/core/keeping.ts +0 -684
  118. package/src/keri/core/manager.ts +0 -1183
  119. package/src/keri/core/matter.ts +0 -521
  120. package/src/keri/core/prefixer.ts +0 -233
  121. package/src/keri/core/saider.ts +0 -186
  122. package/src/keri/core/salter.ts +0 -120
  123. package/src/keri/core/serder.ts +0 -163
  124. package/src/keri/core/signer.ts +0 -133
  125. package/src/keri/core/vdring.ts +0 -94
  126. package/src/keri/core/verfer.ts +0 -47
  127. package/src/keri/end/ending.ts +0 -170
  128. package/src/math.ts +0 -3
@@ -1,25 +1,19 @@
1
- import { Agent, Controller } from './controller';
2
- import { Tier } from '../core/salter';
3
- import { Authenticater } from '../core/authing';
4
- import { ExternalModule, KeyManager } from '../core/keeping';
5
-
6
- import { Identifier } from './aiding';
7
- import { Contacts, Challenges } from './contacting';
8
- import { Oobis, Operations, KeyEvents, KeyStates } from './coring';
9
- import { Credentials, Ipex, Registries, Schemas } from './credentialing';
10
- import { Notifications } from './notifying';
11
- import { Escrows } from './escrowing';
12
- import { Groups } from './grouping';
13
- import { Exchanges } from './exchanging';
14
-
1
+ import { Authenticater } from "../core/authing.js";
2
+ import { HEADER_SIG_TIME } from "../core/httping.js";
3
+ import { IdentifierManagerFactory } from "../core/keeping.js";
4
+ import { Tier } from "../core/salter.js";
5
+ import { Identifier } from "./aiding.js";
6
+ import { Contacts, Challenges } from "./contacting.js";
7
+ import { Agent, Controller } from "./controller.js";
8
+ import { Oobis, Operations, KeyEvents, KeyStates, Config } from "./coring.js";
9
+ import { Credentials, Ipex, Registries, Schemas } from "./credentialing.js";
10
+ import { Delegations } from "./delegating.js";
11
+ import { Escrows } from "./escrowing.js";
12
+ import { Exchanges } from "./exchanging.js";
13
+ import { Groups } from "./grouping.js";
14
+ import { Notifications } from "./notifying.js";
15
15
  const DEFAULT_BOOT_URL = 'http://localhost:3903';
16
-
17
16
  class State {
18
- agent: any | null;
19
- controller: any | null;
20
- ridx: number;
21
- pidx: number;
22
-
23
17
  constructor() {
24
18
  this.agent = null;
25
19
  this.controller = null;
@@ -27,20 +21,11 @@ class State {
27
21
  this.ridx = 0;
28
22
  }
29
23
  }
30
-
31
- /** SignifyClient */
24
+ /**
25
+ * An in-memory key manager that can connect to a KERIA Agent and use it to
26
+ * receive messages and act as a proxy for multi-signature operations and delegation operations.
27
+ */
32
28
  export class SignifyClient {
33
- public controller: Controller;
34
- public url: string;
35
- public bran: string;
36
- public pidx: number;
37
- public agent: Agent | null;
38
- public authn: Authenticater | null;
39
- public manager: KeyManager | null;
40
- public tier: Tier;
41
- public bootUrl: string;
42
- public exteralModules: ExternalModule[];
43
-
44
29
  /**
45
30
  * SignifyClient constructor
46
31
  * @param {string} url KERIA admin interface URL
@@ -49,13 +34,24 @@ export class SignifyClient {
49
34
  * @param {string} bootUrl KERIA boot interface URL
50
35
  * @param {ExternalModule[]} externalModules list of external modules to load
51
36
  */
52
- constructor(
53
- url: string,
54
- bran: string,
55
- tier: Tier = Tier.low,
56
- bootUrl: string = DEFAULT_BOOT_URL,
57
- externalModules: ExternalModule[] = []
58
- ) {
37
+ constructor(url, bran, tier = Tier.low, bootUrl = DEFAULT_BOOT_URL, externalModules = []) {
38
+ this._identifiers = new Identifier(this);
39
+ this._operations = new Operations(this);
40
+ this._keyEvents = new KeyEvents(this);
41
+ this._keyStates = new KeyStates(this);
42
+ this._oobis = new Oobis(this);
43
+ this._config = new Config(this);
44
+ this._delegations = new Delegations(this);
45
+ this._exchanges = new Exchanges(this);
46
+ this._groups = new Groups(this);
47
+ this._escrows = new Escrows(this);
48
+ this._credentials = new Credentials(this);
49
+ this._registries = new Registries(this);
50
+ this._ipex = new Ipex(this);
51
+ this._notifications = new Notifications(this);
52
+ this._contacts = new Contacts(this);
53
+ this._challenges = new Challenges(this);
54
+ this._schemas = new Schemas(this);
59
55
  this.url = url;
60
56
  if (bran.length < 21) {
61
57
  throw Error('bran must be 21 characters');
@@ -70,26 +66,24 @@ export class SignifyClient {
70
66
  this.bootUrl = bootUrl;
71
67
  this.exteralModules = externalModules;
72
68
  }
73
-
74
69
  get data() {
75
70
  return [this.url, this.bran, this.pidx, this.authn];
76
71
  }
77
-
78
72
  /**
79
73
  * Boot a KERIA agent
80
74
  * @async
81
75
  * @returns {Promise<Response>} A promise to the result of the boot
82
76
  */
83
- async boot(): Promise<Response> {
84
- const [evt, sign] = this.controller?.event ?? [];
77
+ async boot() {
78
+ var _a, _b, _c, _d;
79
+ const [evt, sign] = (_b = (_a = this.controller) === null || _a === void 0 ? void 0 : _a.event) !== null && _b !== void 0 ? _b : [];
85
80
  const data = {
86
- icp: evt.ked,
81
+ icp: evt.sad,
87
82
  sig: sign.qb64,
88
- stem: this.controller?.stem,
83
+ stem: (_c = this.controller) === null || _c === void 0 ? void 0 : _c.stem,
89
84
  pidx: 1,
90
- tier: this.controller?.tier,
85
+ tier: (_d = this.controller) === null || _d === void 0 ? void 0 : _d.tier,
91
86
  };
92
-
93
87
  return await fetch(this.bootUrl + '/boot', {
94
88
  method: 'POST',
95
89
  body: JSON.stringify(data),
@@ -98,29 +92,26 @@ export class SignifyClient {
98
92
  },
99
93
  });
100
94
  }
101
-
102
95
  /**
103
96
  * Get state of the agent and the client
104
97
  * @async
105
98
  * @returns {Promise<Response>} A promise to the state
106
99
  */
107
- async state(): Promise<State> {
108
- const caid = this.controller?.pre;
109
-
100
+ async state() {
101
+ var _a, _b, _c, _d, _e;
102
+ const caid = (_a = this.controller) === null || _a === void 0 ? void 0 : _a.pre;
110
103
  const res = await fetch(this.url + `/agent/${caid}`);
111
104
  if (res.status == 404) {
112
105
  throw new Error(`agent does not exist for controller ${caid}`);
113
106
  }
114
-
115
107
  const data = await res.json();
116
108
  const state = new State();
117
- state.agent = data.agent ?? {};
118
- state.controller = data.controller ?? {};
119
- state.ridx = data.ridx ?? 0;
120
- state.pidx = data.pidx ?? 0;
109
+ state.agent = (_b = data.agent) !== null && _b !== void 0 ? _b : {};
110
+ state.controller = (_c = data.controller) !== null && _c !== void 0 ? _c : {};
111
+ state.ridx = (_d = data.ridx) !== null && _d !== void 0 ? _d : 0;
112
+ state.pidx = (_e = data.pidx) !== null && _e !== void 0 ? _e : 0;
121
113
  return state;
122
114
  }
123
-
124
115
  /** Connect to a KERIA agent
125
116
  * @async
126
117
  */
@@ -128,33 +119,19 @@ export class SignifyClient {
128
119
  const state = await this.state();
129
120
  this.pidx = state.pidx;
130
121
  //Create controller representing the local client AID
131
- this.controller = new Controller(
132
- this.bran,
133
- this.tier,
134
- 0,
135
- state.controller
136
- );
122
+ this.controller = new Controller(this.bran, this.tier, 0, state.controller);
137
123
  this.controller.ridx = state.ridx !== undefined ? state.ridx : 0;
138
124
  // Create agent representing the AID of KERIA cloud agent
139
125
  this.agent = new Agent(state.agent);
140
126
  if (this.agent.anchor != this.controller.pre) {
141
- throw Error(
142
- 'commitment to controller AID missing in agent inception event'
143
- );
127
+ throw Error('commitment to controller AID missing in agent inception event');
144
128
  }
145
- if (this.controller.serder.ked.s == 0) {
129
+ if (this.controller.serder.sad.s == 0) {
146
130
  await this.approveDelegation();
147
131
  }
148
- this.manager = new KeyManager(
149
- this.controller.salter,
150
- this.exteralModules
151
- );
152
- this.authn = new Authenticater(
153
- this.controller.signer,
154
- this.agent.verfer!
155
- );
132
+ this.manager = new IdentifierManagerFactory(this.controller.salter, this.exteralModules);
133
+ this.authn = new Authenticater(this.controller.signer, this.agent.verfer);
156
134
  }
157
-
158
135
  /**
159
136
  * Fetch a resource from the KERIA agent
160
137
  * @async
@@ -164,37 +141,21 @@ export class SignifyClient {
164
141
  * @param {Headers} [extraHeaders] Optional extra headers to be sent with the request
165
142
  * @returns {Promise<Response>} A promise to the result of the fetch
166
143
  */
167
- async fetch(
168
- path: string,
169
- method: string,
170
- data: any,
171
- extraHeaders?: Headers
172
- ): Promise<Response> {
144
+ async fetch(path, method, data, extraHeaders) {
145
+ var _a;
173
146
  const headers = new Headers();
174
147
  let signed_headers = new Headers();
175
148
  const final_headers = new Headers();
176
-
177
149
  headers.set('Signify-Resource', this.controller.pre);
178
- headers.set(
179
- 'Signify-Timestamp',
180
- new Date().toISOString().replace('Z', '000+00:00')
181
- );
150
+ headers.set(HEADER_SIG_TIME, new Date().toISOString().replace('Z', '000+00:00'));
182
151
  headers.set('Content-Type', 'application/json');
183
-
184
152
  const _body = method == 'GET' ? null : JSON.stringify(data);
185
- if (_body !== null) {
186
- headers.set('Content-Length', String(_body.length));
187
- }
188
153
  if (this.authn) {
189
- signed_headers = this.authn.sign(
190
- headers,
191
- method,
192
- path.split('?')[0]
193
- );
194
- } else {
154
+ signed_headers = this.authn.sign(headers, method, path.split('?')[0]);
155
+ }
156
+ else {
195
157
  throw new Error('client need to call connect first');
196
158
  }
197
-
198
159
  signed_headers.forEach((value, key) => {
199
160
  final_headers.set(key, value);
200
161
  });
@@ -213,120 +174,72 @@ export class SignifyClient {
213
174
  const message = `HTTP ${method} ${path} - ${res.status} ${res.statusText} - ${error}`;
214
175
  throw new Error(message);
215
176
  }
216
- const isSameAgent =
217
- this.agent?.pre === res.headers.get('signify-resource');
177
+ const isSameAgent = ((_a = this.agent) === null || _a === void 0 ? void 0 : _a.pre) === res.headers.get('signify-resource');
218
178
  if (!isSameAgent) {
219
179
  throw new Error('message from a different remote agent');
220
180
  }
221
-
222
- const verification = this.authn.verify(
223
- res.headers,
224
- method,
225
- path.split('?')[0]
226
- );
181
+ const verification = this.authn.verify(res.headers, method, path.split('?')[0]);
227
182
  if (verification) {
228
183
  return res;
229
- } else {
184
+ }
185
+ else {
230
186
  throw new Error('response verification failed');
231
187
  }
232
188
  }
233
-
234
189
  /**
235
- * Fetch a resource from from an external URL with headers signed by an AID
190
+ * Create a Signed Request to fetch a resource from an external URL with headers signed by an AID
236
191
  * @async
237
- * @param {string} url URL of the resource
238
- * @param {string} path Path to the resource
239
- * @param {string} method HTTP method
240
- * @param {any} data Data to be sent in the body of the resource
241
192
  * @param {string} aidName Name or alias of the AID to be used for signing
242
- * @returns {Promise<Response>} A promise to the result of the fetch
193
+ * @param {string} url URL of the requested resource
194
+ * @param {RequestInit} req Request options should include:
195
+ * - method: HTTP method
196
+ * - data Data to be sent in the body of the resource.
197
+ * If the data is a CESR JSON string then you should also set contentType to 'application/json+cesr'
198
+ * If the data is a FormData object then you should not set the contentType and the browser will set it to 'multipart/form-data'
199
+ * If the data is an object then you should use JSON.stringify to convert it to a string and set the contentType to 'application/json'
200
+ * - contentType Content type of the request.
201
+ * @returns {Promise<Request>} A promise to the created Request
243
202
  */
244
- async signedFetch(
245
- url: string,
246
- path: string,
247
- method: string,
248
- data: any,
249
- aidName: string
250
- ): Promise<Response> {
203
+ async createSignedRequest(aidName, url, req) {
204
+ var _a;
251
205
  const hab = await this.identifiers().get(aidName);
252
- const keeper = this.manager!.get(hab);
253
-
254
- const authenticator = new Authenticater(
255
- keeper.signers[0],
256
- keeper.signers[0].verfer
257
- );
258
-
259
- const headers = new Headers();
260
- headers.set('Signify-Resource', hab.prefix);
261
- headers.set(
262
- 'Signify-Timestamp',
263
- new Date().toISOString().replace('Z', '000+00:00')
264
- );
265
-
266
- if (data !== null) {
267
- headers.set('Content-Length', data.length);
268
- } else {
269
- headers.set('Content-Length', '0');
270
- }
271
- const signed_headers = authenticator.sign(
272
- headers,
273
- method,
274
- path.split('?')[0]
275
- );
276
- let _body = null;
277
- if (method != 'GET') {
278
- if (data instanceof FormData) {
279
- _body = data;
280
- // do not set the content type, let the browser do it
281
- // headers.set('Content-Type', 'multipart/form-data')
282
- } else {
283
- _body = JSON.stringify(data);
284
- headers.set('Content-Type', 'application/json');
285
- }
286
- } else {
287
- headers.set('Content-Type', 'application/json');
288
- }
289
-
290
- return await fetch(url + path, {
291
- method: method,
292
- body: _body,
293
- headers: signed_headers,
294
- });
206
+ const keeper = this.manager.get(hab);
207
+ const authenticator = new Authenticater(keeper.signers[0], keeper.signers[0].verfer);
208
+ const headers = new Headers(req.headers);
209
+ headers.set('Signify-Resource', hab['prefix']);
210
+ headers.set(HEADER_SIG_TIME, new Date().toISOString().replace('Z', '000+00:00'));
211
+ const signed_headers = authenticator.sign(new Headers(headers), (_a = req.method) !== null && _a !== void 0 ? _a : 'GET', new URL(url).pathname);
212
+ req.headers = signed_headers;
213
+ return new Request(url, req);
295
214
  }
296
-
297
215
  /**
298
216
  * Approve the delegation of the client AID to the KERIA agent
299
217
  * @async
300
218
  * @returns {Promise<Response>} A promise to the result of the approval
301
219
  */
302
- async approveDelegation(): Promise<Response> {
303
- const sigs = this.controller.approveDelegation(this.agent!);
304
-
220
+ async approveDelegation() {
221
+ const sigs = this.controller.approveDelegation(this.agent);
305
222
  const data = {
306
- ixn: this.controller.serder.ked,
223
+ ixn: this.controller.serder.sad,
307
224
  sigs: sigs,
308
225
  };
309
-
310
- return await fetch(
311
- this.url + '/agent/' + this.controller.pre + '?type=ixn',
312
- {
313
- method: 'PUT',
314
- body: JSON.stringify(data),
315
- headers: {
316
- 'Content-Type': 'application/json',
317
- },
318
- }
319
- );
226
+ return await fetch(this.url + '/agent/' + this.controller.pre + '?type=ixn', {
227
+ method: 'PUT',
228
+ body: JSON.stringify(data),
229
+ headers: {
230
+ 'Content-Type': 'application/json',
231
+ },
232
+ });
320
233
  }
321
-
322
234
  /**
323
235
  * Save old client passcode in KERIA agent
324
236
  * @async
325
237
  * @param {string} passcode Passcode to be saved
326
238
  * @returns {Promise<Response>} A promise to the result of the save
327
239
  */
328
- async saveOldPasscode(passcode: string): Promise<Response> {
329
- const caid = this.controller?.pre;
240
+ async saveOldPasscode(passcode) {
241
+ var _a;
242
+ const caid = (_a = this.controller) === null || _a === void 0 ? void 0 : _a.pre;
330
243
  const body = { salt: passcode };
331
244
  return await fetch(this.url + '/salt/' + caid, {
332
245
  method: 'PUT',
@@ -336,14 +249,14 @@ export class SignifyClient {
336
249
  },
337
250
  });
338
251
  }
339
-
340
252
  /**
341
253
  * Delete a saved passcode from KERIA agent
342
254
  * @async
343
255
  * @returns {Promise<Response>} A promise to the result of the deletion
344
256
  */
345
- async deletePasscode(): Promise<Response> {
346
- const caid = this.controller?.pre;
257
+ async deletePasscode() {
258
+ var _a;
259
+ const caid = (_a = this.controller) === null || _a === void 0 ? void 0 : _a.pre;
347
260
  return await fetch(this.url + '/salt/' + caid, {
348
261
  method: 'DELETE',
349
262
  headers: {
@@ -351,7 +264,6 @@ export class SignifyClient {
351
264
  },
352
265
  });
353
266
  }
354
-
355
267
  /**
356
268
  * Rotate the client AID
357
269
  * @async
@@ -359,7 +271,7 @@ export class SignifyClient {
359
271
  * @param {Array<string>} aids List of managed AIDs to be rotated
360
272
  * @returns {Promise<Response>} A promise to the result of the rotation
361
273
  */
362
- async rotate(nbran: string, aids: string[]): Promise<Response> {
274
+ async rotate(nbran, aids) {
363
275
  const data = this.controller.rotate(nbran, aids);
364
276
  return await fetch(this.url + '/agent/' + this.controller.pre, {
365
277
  method: 'PUT',
@@ -369,124 +281,123 @@ export class SignifyClient {
369
281
  },
370
282
  });
371
283
  }
372
-
373
284
  /**
374
285
  * Get identifiers resource
375
286
  * @returns {Identifier}
376
287
  */
377
- identifiers(): Identifier {
378
- return new Identifier(this);
288
+ identifiers() {
289
+ return this._identifiers;
379
290
  }
380
-
381
291
  /**
382
292
  * Get OOBIs resource
383
293
  * @returns {Oobis}
384
294
  */
385
- oobis(): Oobis {
386
- return new Oobis(this);
295
+ oobis() {
296
+ return this._oobis;
387
297
  }
388
-
389
298
  /**
390
299
  * Get operations resource
391
300
  * @returns {Operations}
392
301
  */
393
- operations(): Operations {
394
- return new Operations(this);
302
+ operations() {
303
+ return this._operations;
395
304
  }
396
-
397
305
  /**
398
306
  * Get keyEvents resource
399
307
  * @returns {KeyEvents}
400
308
  */
401
- keyEvents(): KeyEvents {
402
- return new KeyEvents(this);
309
+ keyEvents() {
310
+ return this._keyEvents;
403
311
  }
404
-
405
312
  /**
406
313
  * Get keyStates resource
407
314
  * @returns {KeyStates}
408
315
  */
409
- keyStates(): KeyStates {
410
- return new KeyStates(this);
316
+ keyStates() {
317
+ return this._keyStates;
411
318
  }
412
-
413
319
  /**
414
320
  * Get credentials resource
415
321
  * @returns {Credentials}
416
322
  */
417
- credentials(): Credentials {
418
- return new Credentials(this);
323
+ credentials() {
324
+ return this._credentials;
419
325
  }
420
-
421
326
  /**
422
327
  * Get IPEX resource
423
328
  * @returns {Ipex}
424
329
  */
425
- ipex(): Ipex {
426
- return new Ipex(this);
330
+ ipex() {
331
+ return this._ipex;
427
332
  }
428
-
429
333
  /**
430
334
  * Get registries resource
431
335
  * @returns {Registries}
432
336
  */
433
- registries(): Registries {
434
- return new Registries(this);
337
+ registries() {
338
+ return this._registries;
435
339
  }
436
-
437
340
  /**
438
341
  * Get schemas resource
439
342
  * @returns {Schemas}
440
343
  */
441
- schemas(): Schemas {
442
- return new Schemas(this);
344
+ schemas() {
345
+ return this._schemas;
443
346
  }
444
-
445
347
  /**
446
348
  * Get challenges resource
447
349
  * @returns {Challenges}
448
350
  */
449
- challenges(): Challenges {
450
- return new Challenges(this);
351
+ challenges() {
352
+ return this._challenges;
451
353
  }
452
-
453
354
  /**
454
355
  * Get contacts resource
455
356
  * @returns {Contacts}
456
357
  */
457
- contacts(): Contacts {
458
- return new Contacts(this);
358
+ contacts() {
359
+ return this._contacts;
459
360
  }
460
-
461
361
  /**
462
362
  * Get notifications resource
463
363
  * @returns {Notifications}
464
364
  */
465
- notifications(): Notifications {
466
- return new Notifications(this);
365
+ notifications() {
366
+ return this._notifications;
467
367
  }
468
-
469
368
  /**
470
369
  * Get escrows resource
471
370
  * @returns {Escrows}
472
371
  */
473
- escrows(): Escrows {
474
- return new Escrows(this);
372
+ escrows() {
373
+ return this._escrows;
475
374
  }
476
-
477
375
  /**
478
376
  * Get groups resource
479
377
  * @returns {Groups}
480
378
  */
481
- groups(): Groups {
482
- return new Groups(this);
379
+ groups() {
380
+ return this._groups;
483
381
  }
484
-
485
382
  /**
486
383
  * Get exchange resource
487
384
  * @returns {Exchanges}
488
385
  */
489
- exchanges(): Exchanges {
490
- return new Exchanges(this);
386
+ exchanges() {
387
+ return this._exchanges;
388
+ }
389
+ /**
390
+ * Get delegations resource
391
+ * @returns {Delegations}
392
+ */
393
+ delegations() {
394
+ return this._delegations;
395
+ }
396
+ /**
397
+ * Get agent config resource
398
+ * @returns {Config}
399
+ */
400
+ config() {
401
+ return this._config;
491
402
  }
492
403
  }