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,31 +1,23 @@
1
- import { SaltyCreator } from '../core/manager';
2
- import { Salter, Tier } from '../core/salter';
3
- import { MtrDex } from '../core/matter';
4
- import { Diger } from '../core/diger';
5
- import { incept, rotate, interact } from '../core/eventing';
6
- import { Serder } from '../core/serder';
7
- import { Tholder } from '../core/tholder';
8
- import { Ilks, b, Serials, Versionage } from '../core/core';
9
- import { Verfer } from '../core/verfer';
10
- import { Encrypter } from '../core/encrypter';
11
- import { Decrypter } from '../core/decrypter';
12
- import { Cipher } from '../core/cipher';
13
- import { Seqner } from '../core/seqner';
14
- import { CesrNumber } from '../core/number';
15
-
1
+ import { SaltyCreator } from "../core/manager.js";
2
+ import { Salter } from "../core/salter.js";
3
+ import { MtrDex } from "../core/matter.js";
4
+ import { Diger } from "../core/diger.js";
5
+ import { incept, rotate, interact } from "../core/eventing.js";
6
+ import { Serder } from "../core/serder.js";
7
+ import { Tholder } from "../core/tholder.js";
8
+ import { Ilks, b, Serials, Vrsn_1_0 } from "../core/core.js";
9
+ import { Verfer } from "../core/verfer.js";
10
+ import { Encrypter } from "../core/encrypter.js";
11
+ import { Decrypter } from "../core/decrypter.js";
12
+ import { Cipher } from "../core/cipher.js";
13
+ import { Seqner } from "../core/seqner.js";
14
+ import { CesrNumber } from "../core/number.js";
16
15
  /**
17
16
  * Agent is a custodial entity that can be used in conjuntion with a local Client to establish the
18
17
  * KERI "signing at the edge" semantic
19
18
  */
20
19
  export class Agent {
21
- pre: string;
22
- anchor: string;
23
- verfer: Verfer | null;
24
- state: any | null;
25
- sn: number | undefined;
26
- said: string | undefined;
27
-
28
- constructor(agent: any) {
20
+ constructor(agent) {
29
21
  this.pre = '';
30
22
  this.anchor = '';
31
23
  this.verfer = null;
@@ -34,121 +26,87 @@ export class Agent {
34
26
  this.said = '';
35
27
  this.parse(agent);
36
28
  }
37
-
38
- private parse(agent: Agent) {
29
+ parse(agent) {
39
30
  const [state, verfer] = this.event(agent);
40
-
41
31
  this.sn = new CesrNumber({}, undefined, state['s']).num;
42
32
  this.said = state['d'];
43
-
44
33
  if (state['et'] !== Ilks.dip) {
45
34
  throw new Error(`invalid inception event type ${state['et']}`);
46
35
  }
47
-
48
36
  this.pre = state['i'];
49
37
  if (!state['di']) {
50
38
  throw new Error('no anchor to controller AID');
51
39
  }
52
-
53
40
  this.anchor = state['di'];
54
-
55
41
  this.verfer = verfer;
56
42
  this.state = state;
57
43
  }
58
-
59
- private event(evt: any): [any, Verfer, Diger] {
44
+ event(evt) {
60
45
  if (evt['k'].length !== 1) {
61
46
  throw new Error(`agent inception event can only have one key`);
62
47
  }
63
-
64
48
  const verfer = new Verfer({ qb64: evt['k'][0] });
65
-
66
49
  if (evt['n'].length !== 1) {
67
50
  throw new Error(`agent inception event can only have one next key`);
68
51
  }
69
-
70
52
  const diger = new Diger({ qb64: evt['n'][0] });
71
-
72
53
  const tholder = new Tholder({ sith: evt['kt'] });
73
54
  if (tholder.num !== 1) {
74
55
  throw new Error(`invalid threshold ${tholder.num}, must be 1`);
75
56
  }
76
-
77
57
  const ntholder = new Tholder({ sith: evt['nt'] });
78
58
  if (ntholder.num !== 1) {
79
- throw new Error(
80
- `invalid next threshold ${ntholder.num}, must be 1`
81
- );
59
+ throw new Error(`invalid next threshold ${ntholder.num}, must be 1`);
82
60
  }
83
61
  return [evt, verfer, diger];
84
62
  }
85
63
  }
86
-
87
64
  /**
88
65
  * Controller is responsible for managing signing keys for the client and agent. The client
89
66
  * signing key represents the Account for the client on the agent
90
67
  */
91
68
  export class Controller {
92
- private bran: string;
93
- public stem: string;
94
- public tier: Tier;
95
- public ridx: number;
96
- public salter: any;
97
- public signer: any;
98
- private nsigner: any;
99
- public serder: Serder;
100
- private keys: string[];
101
- public ndigs: string[];
102
-
103
- constructor(
104
- bran: string,
105
- tier: Tier,
106
- ridx: number = 0,
107
- state: any | null = null
108
- ) {
69
+ /**
70
+ * Creates a Signify Controller starting at key index 0 that generates keys in
71
+ * memory based on the provided seed, or bran, the tier, and the rotation index.
72
+ *
73
+ * The rotation index is used as follows:
74
+ *
75
+ * @param bran
76
+ * @param tier
77
+ * @param ridx
78
+ * @param state
79
+ */
80
+ constructor(bran, tier, ridx = 0, state = null) {
109
81
  this.bran = MtrDex.Salt_128 + 'A' + bran.substring(0, 21); // qb64 salt for seed
110
82
  this.stem = 'signify:controller';
111
83
  this.tier = tier;
112
84
  this.ridx = ridx;
113
-
85
+ const codes = undefined; // Defines the types of seeds that the SaltyCreator will create. Defaults to undefined.
86
+ const keyCount = 1; // The number of keys to create. Defaults to 1.
87
+ const transferable = true; // Whether the keys are transferable. Defaults to true.
88
+ const code = MtrDex.Ed25519_Seed; // The type cryptographic seed to create by default when not overiddeen by "codes".
89
+ const pidx = 0; // The index of this identifier prefix of all managed identifiers created for this SignifyClient Controller. Defaults to 0.
90
+ const kidx = 0; // The overall starting key index for the first key this rotation set of keys. This is not a local index to this set of keys but an index in the overall set of keys for all keys in this sequence.
91
+ // Defaults to 0. Multiply rotation index (ridx) times key count to get the overall key index.
114
92
  this.salter = new Salter({ qb64: this.bran, tier: this.tier });
115
-
116
- const creator = new SaltyCreator(
117
- this.salter.qb64,
118
- this.tier,
119
- this.stem
120
- );
121
-
93
+ const creator = new SaltyCreator(this.salter.qb64, this.tier, this.stem);
94
+ // Creates the first key pair used to sign the inception event.
95
+ // noinspection UnnecessaryLocalVariableJS
96
+ const initialKeyIndex = ridx; // will be zero for inception
122
97
  this.signer = creator
123
- .create(
124
- undefined,
125
- 1,
126
- MtrDex.Ed25519_Seed,
127
- true,
128
- 0,
129
- this.ridx,
130
- 0,
131
- false
132
- )
133
- .signers.pop();
98
+ .create(codes, keyCount, code, transferable, pidx, initialKeyIndex, kidx)
99
+ .signers.pop(); // assumes only one key pair is created because keyCount is 1
100
+ // Creates the second key pair which a digest of the public key is committed to in the inception event.
101
+ const nextKeyIndex = ridx + 1;
134
102
  this.nsigner = creator
135
- .create(
136
- undefined,
137
- 1,
138
- MtrDex.Ed25519_Seed,
139
- true,
140
- 0,
141
- this.ridx + 1,
142
- 0,
143
- false
144
- )
145
- .signers.pop();
103
+ .create(codes, keyCount, code, transferable, pidx, nextKeyIndex, kidx)
104
+ .signers.pop(); // assumes only one key pair is created because keyCount is 1
146
105
  this.keys = [this.signer.verfer.qb64];
147
106
  this.ndigs = [
148
107
  new Diger({ code: MtrDex.Blake3_256 }, this.nsigner.verfer.qb64b)
149
108
  .qb64,
150
109
  ];
151
-
152
110
  if (state == null || state['ee']['s'] == 0) {
153
111
  this.serder = incept({
154
112
  keys: this.keys,
@@ -159,40 +117,36 @@ export class Controller {
159
117
  toad: '0',
160
118
  wits: [],
161
119
  });
162
- } else {
120
+ }
121
+ else {
163
122
  this.serder = new Serder(state['ee']);
164
123
  }
165
124
  }
166
-
167
- approveDelegation(_agent: Agent) {
125
+ approveDelegation(_agent) {
168
126
  const seqner = new Seqner({ sn: _agent.sn });
169
127
  const anchor = { i: _agent.pre, s: seqner.snh, d: _agent.said };
170
- const sn = new CesrNumber({}, undefined, this.serder.ked['s']).num + 1;
128
+ const sn = new CesrNumber({}, undefined, this.serder.sad['s']).num + 1;
171
129
  this.serder = interact({
172
130
  pre: this.serder.pre,
173
- dig: this.serder.ked['d'],
131
+ dig: this.serder.sad['d'],
174
132
  sn: sn,
175
133
  data: [anchor],
176
- version: Versionage,
134
+ version: Vrsn_1_0,
177
135
  kind: Serials.JSON,
178
136
  });
179
137
  return [this.signer.sign(this.serder.raw, 0).qb64];
180
138
  }
181
-
182
- get pre(): string {
139
+ get pre() {
183
140
  return this.serder.pre;
184
141
  }
185
-
186
142
  get event() {
187
143
  const siger = this.signer.sign(this.serder.raw, 0);
188
144
  return [this.serder, siger];
189
145
  }
190
-
191
- get verfers(): [] {
146
+ get verfers() {
192
147
  return this.signer.verfer();
193
148
  }
194
-
195
- derive(state: any) {
149
+ derive(state) {
196
150
  if (state != undefined && state['ee']['s'] === '0') {
197
151
  return incept({
198
152
  keys: this.keys,
@@ -203,124 +157,70 @@ export class Controller {
203
157
  toad: '0',
204
158
  wits: [],
205
159
  });
206
- } else {
207
- return new Serder({ ked: state.controller['ee'] });
160
+ }
161
+ else {
162
+ return new Serder({ sad: state.controller['ee'] });
208
163
  }
209
164
  }
210
-
211
- rotate(bran: string, aids: Array<any>) {
165
+ rotate(bran, aids) {
212
166
  const nbran = MtrDex.Salt_128 + 'A' + bran.substring(0, 21); // qb64 salt for seed
213
167
  const nsalter = new Salter({ qb64: nbran, tier: this.tier });
214
168
  const nsigner = this.salter.signer(undefined, false);
215
-
216
- const creator = new SaltyCreator(
217
- this.salter.qb64,
218
- this.tier,
219
- this.stem
220
- );
169
+ const creator = new SaltyCreator(this.salter.qb64, this.tier, this.stem);
221
170
  const signer = creator
222
- .create(
223
- undefined,
224
- 1,
225
- MtrDex.Ed25519_Seed,
226
- true,
227
- 0,
228
- this.ridx + 1,
229
- 0,
230
- false
231
- )
171
+ .create(undefined, 1, MtrDex.Ed25519_Seed, true, 0, this.ridx + 1, 0, false)
232
172
  .signers.pop();
233
-
234
173
  const ncreator = new SaltyCreator(nsalter.qb64, this.tier, this.stem);
235
174
  this.signer = ncreator
236
- .create(
237
- undefined,
238
- 1,
239
- MtrDex.Ed25519_Seed,
240
- true,
241
- 0,
242
- this.ridx,
243
- 0,
244
- false
245
- )
175
+ .create(undefined, 1, MtrDex.Ed25519_Seed, true, 0, this.ridx, 0, false)
246
176
  .signers.pop();
247
177
  this.nsigner = ncreator
248
- .create(
249
- undefined,
250
- 1,
251
- MtrDex.Ed25519_Seed,
252
- true,
253
- 0,
254
- this.ridx + 1,
255
- 0,
256
- false
257
- )
178
+ .create(undefined, 1, MtrDex.Ed25519_Seed, true, 0, this.ridx + 1, 0, false)
258
179
  .signers.pop();
259
-
260
- this.keys = [this.signer.verfer.qb64, signer?.verfer.qb64];
180
+ this.keys = [this.signer.verfer.qb64, signer === null || signer === void 0 ? void 0 : signer.verfer.qb64];
261
181
  this.ndigs = [new Diger({}, this.nsigner.verfer.qb64b).qb64];
262
-
263
182
  const rot = rotate({
264
183
  pre: this.pre,
265
184
  keys: this.keys,
266
- dig: this.serder.ked['d'],
185
+ dig: this.serder.sad['d'],
267
186
  isith: ['1', '0'],
268
187
  nsith: '1',
269
188
  ndigs: this.ndigs,
270
189
  });
271
-
272
190
  const sigs = [
273
- signer?.sign(b(rot.raw), 1, false, 0).qb64,
191
+ signer === null || signer === void 0 ? void 0 : signer.sign(b(rot.raw), 1, false, 0).qb64,
274
192
  this.signer.sign(rot.raw, 0).qb64,
275
193
  ];
276
194
  const encrypter = new Encrypter({}, b(nsigner.verfer.qb64));
277
195
  const decrypter = new Decrypter({}, nsigner.qb64b);
278
196
  const sxlt = encrypter.encrypt(b(this.bran)).qb64;
279
-
280
- const keys: Record<any, any> = {};
281
-
197
+ const keys = {};
282
198
  for (const aid of aids) {
283
- const pre: string = aid['prefix'] as string;
199
+ const pre = aid['prefix'];
284
200
  if ('salty' in aid) {
285
- const salty: any = aid['salty'];
201
+ const salty = aid['salty'];
286
202
  const cipher = new Cipher({ qb64: salty['sxlt'] });
287
203
  const dnxt = decrypter.decrypt(null, cipher).qb64;
288
-
289
204
  // Now we have the AID salt, use it to verify against the current public keys
290
- const acreator = new SaltyCreator(
291
- dnxt,
292
- salty['tier'],
293
- salty['stem']
294
- );
295
- const signers = acreator.create(
296
- salty['icodes'],
297
- undefined,
298
- MtrDex.Ed25519_Seed,
299
- salty['transferable'],
300
- salty['pidx'],
301
- 0,
302
- salty['kidx'],
303
- false
304
- );
205
+ const acreator = new SaltyCreator(dnxt, salty['tier'], salty['stem']);
206
+ const signers = acreator.create(salty['icodes'], undefined, MtrDex.Ed25519_Seed, salty['transferable'], salty['pidx'], 0, salty['kidx'], false);
305
207
  const _signers = [];
306
208
  for (const signer of signers.signers) {
307
209
  _signers.push(signer.verfer.qb64);
308
210
  }
309
211
  const pubs = aid['state']['k'];
310
-
311
212
  if (pubs.join(',') != _signers.join(',')) {
312
213
  throw new Error('Invalid Salty AID');
313
214
  }
314
-
315
215
  const asxlt = encrypter.encrypt(b(dnxt)).qb64;
316
216
  keys[pre] = {
317
217
  sxlt: asxlt,
318
218
  };
319
- } else if ('randy' in aid) {
219
+ }
220
+ else if ('randy' in aid) {
320
221
  const randy = aid['randy'];
321
222
  const prxs = randy['prxs'];
322
223
  const nxts = randy['nxts'];
323
-
324
224
  const nprxs = [];
325
225
  const signers = [];
326
226
  for (const prx of prxs) {
@@ -334,37 +234,31 @@ export class Controller {
334
234
  for (const signer of signers) {
335
235
  _signers.push(signer.verfer.qb64);
336
236
  }
337
-
338
237
  if (pubs.join(',') != _signers.join(',')) {
339
- throw new Error(
340
- `unable to rotate, validation of encrypted public keys ${pubs} failed`
341
- );
238
+ throw new Error(`unable to rotate, validation of encrypted public keys ${pubs} failed`);
342
239
  }
343
-
344
240
  const nnxts = [];
345
241
  for (const nxt of nxts) {
346
242
  nnxts.push(this.recrypt(nxt, decrypter, encrypter));
347
243
  }
348
-
349
244
  keys[pre] = {
350
245
  prxs: nprxs,
351
246
  nxts: nnxts,
352
247
  };
353
- } else {
248
+ }
249
+ else {
354
250
  throw new Error('invalid aid type ');
355
251
  }
356
252
  }
357
-
358
253
  const data = {
359
- rot: rot.ked,
254
+ rot: rot.sad,
360
255
  sigs: sigs,
361
256
  sxlt: sxlt,
362
257
  keys: keys,
363
258
  };
364
259
  return data;
365
260
  }
366
-
367
- recrypt(enc: string, decrypter: Decrypter, encrypter: Encrypter) {
261
+ recrypt(enc, decrypter, encrypter) {
368
262
  const cipher = new Cipher({ qb64: enc });
369
263
  const dnxt = decrypter.decrypt(null, cipher).qb64;
370
264
  return encrypter.encrypt(b(dnxt)).qb64;
@@ -1,4 +1,5 @@
1
- import { SignifyClient } from './clienting';
1
+ import { SignifyClient } from './clienting.ts';
2
+ import { components } from '../../types/keria-api-schema.ts';
2
3
  export declare function randomPasscode(): string;
3
4
  export declare function randomNonce(): string;
4
5
  export declare class Oobis {
@@ -24,15 +25,18 @@ export declare class Oobis {
24
25
  */
25
26
  resolve(oobi: string, alias?: string): Promise<any>;
26
27
  }
27
- export interface Operation<T = unknown> {
28
- name: string;
28
+ export type Operation<T = unknown> = Omit<components['schemas']['Operation'], 'response' | 'metadata'> & {
29
+ response?: T;
29
30
  metadata?: {
30
31
  depends?: Operation;
31
32
  [property: string]: any;
32
33
  };
33
- done?: boolean;
34
- error?: any;
35
- response?: T;
34
+ };
35
+ export interface OperationsDeps {
36
+ fetch(pathname: string, method: string, body: unknown, headers?: Headers): Promise<Response>;
37
+ }
38
+ export interface AgentConfig {
39
+ iurls?: string[];
36
40
  }
37
41
  /**
38
42
  * Operations
@@ -40,12 +44,12 @@ export interface Operation<T = unknown> {
40
44
  * Operations represent the status and result of long running tasks performed by KERIA agent
41
45
  */
42
46
  export declare class Operations {
43
- client: SignifyClient;
47
+ client: OperationsDeps;
44
48
  /**
45
49
  * Operations
46
50
  * @param {SignifyClient} client
47
51
  */
48
- constructor(client: SignifyClient);
52
+ constructor(client: OperationsDeps);
49
53
  /**
50
54
  * Get operation status
51
55
  * @async
@@ -66,6 +70,15 @@ export declare class Operations {
66
70
  * @param {string} name Name of the operation
67
71
  */
68
72
  delete(name: string): Promise<void>;
73
+ /**
74
+ * Poll for operation to become completed.
75
+ */
76
+ wait<T>(op: Operation<T>, options?: {
77
+ signal?: AbortSignal;
78
+ minSleep?: number;
79
+ maxSleep?: number;
80
+ increaseFactor?: number;
81
+ }): Promise<Operation<T>>;
69
82
  }
70
83
  /**
71
84
  * KeyEvents
@@ -119,3 +132,12 @@ export declare class KeyStates {
119
132
  */
120
133
  query(pre: string, sn?: string, anchor?: any): Promise<any>;
121
134
  }
135
+ export declare class Config {
136
+ client: SignifyClient;
137
+ /**
138
+ * Config
139
+ * @param {SignifyClient} client
140
+ */
141
+ constructor(client: SignifyClient);
142
+ get(): Promise<AgentConfig>;
143
+ }