signify-ts 0.3.0-rc2 → 0.4.0

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 (37) hide show
  1. package/dist/keri/app/aiding.d.ts +20 -4
  2. package/dist/keri/app/aiding.js +27 -2
  3. package/dist/keri/app/clienting.d.ts +2 -0
  4. package/dist/keri/app/clienting.js +1 -1
  5. package/dist/keri/app/contacting.d.ts +9 -14
  6. package/dist/keri/app/contacting.js +2 -2
  7. package/dist/keri/app/controller.js +2 -2
  8. package/dist/keri/app/coring.d.ts +119 -25
  9. package/dist/keri/app/coring.js +40 -13
  10. package/dist/keri/app/credentialing.d.ts +10 -10
  11. package/dist/keri/app/didwebing.d.ts +146 -0
  12. package/dist/keri/app/didwebing.js +359 -0
  13. package/dist/keri/app/escrowing.d.ts +4 -2
  14. package/dist/keri/app/escrowing.js +1 -1
  15. package/dist/keri/app/exchanging.d.ts +238 -7
  16. package/dist/keri/app/exchanging.js +102 -3
  17. package/dist/keri/app/grouping.d.ts +10 -8
  18. package/dist/keri/app/grouping.js +4 -4
  19. package/dist/keri/app/signaling.d.ts +50 -0
  20. package/dist/keri/app/signaling.js +52 -0
  21. package/dist/keri/app/w3cing.d.ts +137 -0
  22. package/dist/keri/app/w3cing.js +337 -0
  23. package/dist/keri/core/eventing.d.ts +2 -2
  24. package/dist/keri/core/eventing.js +7 -18
  25. package/dist/keri/core/keeping.d.ts +111 -8
  26. package/dist/keri/core/keeping.js +133 -54
  27. package/dist/keri/core/keyState.d.ts +84 -70
  28. package/dist/keri/core/keyState.js +1 -1
  29. package/dist/keri/core/manager.d.ts +1 -1
  30. package/dist/keri/core/manager.js +3 -3
  31. package/dist/keri/core/number.d.ts +1 -1
  32. package/dist/keri/core/number.js +7 -4
  33. package/dist/keri/core/salter.d.ts +2 -9
  34. package/dist/keri/core/salter.js +2 -9
  35. package/dist/types/keria-api-schema.d.ts +889 -35
  36. package/dist/types/keria-api-schema.js +34 -2
  37. package/package.json +3 -5
@@ -1,7 +1,237 @@
1
1
  import { SignifyClient } from './clienting.ts';
2
2
  import { Dict } from '../core/core.ts';
3
3
  import { Serder } from '../core/serder.ts';
4
- import { HabState } from '../core/keyState.ts';
4
+ import { Dip, ExnV1, HabState, Icp, Ixn } from '../core/keyState.ts';
5
+ import { Rpy } from './escrowing.ts';
6
+ import { components } from '../../types/keria-api-schema.ts';
7
+ export type Exn = components['schemas']['Exn'];
8
+ export type ExchangeResource = components['schemas']['ExchangeResource'];
9
+ export type ExchangeResourceV1 = Omit<ExchangeResource, 'exn'> & {
10
+ exn: ExnV1;
11
+ };
12
+ export type ExnMultisig = components['schemas']['ExnMultisig'];
13
+ export declare const MULTISIG_ICP_ROUTE = "/multisig/icp";
14
+ export declare const MULTISIG_ROT_ROUTE = "/multisig/rot";
15
+ export declare const MULTISIG_IXN_ROUTE = "/multisig/ixn";
16
+ export declare const MULTISIG_RPY_ROUTE = "/multisig/rpy";
17
+ export declare const MULTISIG_VCP_ROUTE = "/multisig/vcp";
18
+ export declare const MULTISIG_ISS_ROUTE = "/multisig/iss";
19
+ export declare const MULTISIG_EXN_ROUTE = "/multisig/exn";
20
+ export declare const MULTISIG_REV_ROUTE = "/multisig/rev";
21
+ export declare const IPEX_GRANT_ROUTE = "/ipex/grant";
22
+ export declare const IPEX_OFFER_ROUTE = "/ipex/offer";
23
+ export declare const IPEX_APPLY_ROUTE = "/ipex/apply";
24
+ export declare const IPEX_AGREE_ROUTE = "/ipex/agree";
25
+ export declare const IPEX_ADMIT_ROUTE = "/ipex/admit";
26
+ export type AnchorEvent = components['schemas']['IXN_V_1'] | components['schemas']['ICP_V_1'] | components['schemas']['ROT_V_1'] | components['schemas']['DIP_V_1'] | components['schemas']['DIP_V_2'];
27
+ export type MultisigIcpExchange = ExchangeResourceV1 & {
28
+ exn: ExnV1 & {
29
+ r: typeof MULTISIG_ICP_ROUTE;
30
+ e: {
31
+ icp: Icp | Dip;
32
+ d?: string;
33
+ };
34
+ a: {
35
+ gid: string;
36
+ smids: string[];
37
+ rmids?: string[];
38
+ [key: string]: unknown;
39
+ };
40
+ };
41
+ };
42
+ export type MultisigRotExchange = ExchangeResourceV1 & {
43
+ exn: ExnV1 & {
44
+ r: typeof MULTISIG_ROT_ROUTE;
45
+ e: {
46
+ rot: components['schemas']['ROT_V_1'];
47
+ d?: string;
48
+ };
49
+ a: {
50
+ gid: string;
51
+ smids: string[];
52
+ rmids?: string[];
53
+ [key: string]: unknown;
54
+ };
55
+ };
56
+ };
57
+ export type MultisigIxnExchange = ExchangeResourceV1 & {
58
+ exn: ExnV1 & {
59
+ r: typeof MULTISIG_IXN_ROUTE;
60
+ e: {
61
+ ixn: Ixn;
62
+ d?: string;
63
+ };
64
+ a: {
65
+ gid: string;
66
+ smids: string[];
67
+ rmids?: string[];
68
+ [key: string]: unknown;
69
+ };
70
+ };
71
+ };
72
+ export type MultisigRpyExchange = ExchangeResourceV1 & {
73
+ exn: ExnV1 & {
74
+ r: typeof MULTISIG_RPY_ROUTE;
75
+ e: {
76
+ rpy: Rpy;
77
+ d?: string;
78
+ };
79
+ a: {
80
+ gid: string;
81
+ [key: string]: unknown;
82
+ };
83
+ };
84
+ };
85
+ export type MultisigVcpExchange = ExchangeResourceV1 & {
86
+ exn: ExnV1 & {
87
+ r: typeof MULTISIG_VCP_ROUTE;
88
+ e: {
89
+ vcp: components['schemas']['VCP_V_1'];
90
+ anc: AnchorEvent;
91
+ d?: string;
92
+ };
93
+ a: {
94
+ gid: string;
95
+ usage?: string;
96
+ [key: string]: unknown;
97
+ };
98
+ };
99
+ };
100
+ export type MultisigIssExchange = ExchangeResourceV1 & {
101
+ exn: ExnV1 & {
102
+ r: typeof MULTISIG_ISS_ROUTE;
103
+ e: {
104
+ acdc: components['schemas']['ACDC_V_1'];
105
+ iss: components['schemas']['ISS_V_1'];
106
+ anc: AnchorEvent;
107
+ d?: string;
108
+ };
109
+ a: {
110
+ gid: string;
111
+ [key: string]: unknown;
112
+ };
113
+ };
114
+ };
115
+ export type MultisigExnExchange = ExchangeResourceV1 & {
116
+ exn: ExnV1 & {
117
+ r: typeof MULTISIG_EXN_ROUTE;
118
+ e: {
119
+ exn: ExnV1;
120
+ d?: string;
121
+ };
122
+ a: {
123
+ gid: string;
124
+ [key: string]: unknown;
125
+ };
126
+ };
127
+ };
128
+ export type MultisigRevExchange = ExchangeResourceV1 & {
129
+ exn: ExnV1 & {
130
+ r: typeof MULTISIG_REV_ROUTE;
131
+ e: {
132
+ rev: components['schemas']['REV_V_1'];
133
+ d?: string;
134
+ };
135
+ a: {
136
+ gid: string;
137
+ [key: string]: unknown;
138
+ };
139
+ };
140
+ };
141
+ type WithGroupMetadata = Pick<ExnMultisig, 'paths' | 'groupName' | 'memberName' | 'sender'>;
142
+ export type MultisigIcpGroup = Omit<MultisigIcpExchange, 'pathed'> & WithGroupMetadata;
143
+ export type MultisigRotGroup = Omit<MultisigRotExchange, 'pathed'> & WithGroupMetadata;
144
+ export type MultisigIxnGroup = Omit<MultisigIxnExchange, 'pathed'> & WithGroupMetadata;
145
+ export type MultisigRpyGroup = Omit<MultisigRpyExchange, 'pathed'> & WithGroupMetadata;
146
+ export type MultisigVcpGroup = Omit<MultisigVcpExchange, 'pathed'> & WithGroupMetadata;
147
+ export type MultisigIssGroup = Omit<MultisigIssExchange, 'pathed'> & WithGroupMetadata;
148
+ export type MultisigExnGroup = Omit<MultisigExnExchange, 'pathed'> & WithGroupMetadata;
149
+ export type MultisigRevGroup = Omit<MultisigRevExchange, 'pathed'> & WithGroupMetadata;
150
+ export type IpexGrantExchange = ExchangeResourceV1 & {
151
+ exn: ExnV1 & {
152
+ r: typeof IPEX_GRANT_ROUTE;
153
+ e: {
154
+ acdc: components['schemas']['ACDC_V_1'];
155
+ iss: components['schemas']['ISS_V_1'];
156
+ anc: AnchorEvent;
157
+ d?: string;
158
+ };
159
+ };
160
+ };
161
+ export type IpexOfferExchange = ExchangeResourceV1 & {
162
+ exn: ExnV1 & {
163
+ r: typeof IPEX_OFFER_ROUTE;
164
+ e: {
165
+ acdc: components['schemas']['ACDC_V_1'];
166
+ d?: string;
167
+ };
168
+ };
169
+ };
170
+ export type IpexApplyExchange = ExchangeResourceV1 & {
171
+ exn: ExnV1 & {
172
+ r: typeof IPEX_APPLY_ROUTE;
173
+ e: object;
174
+ };
175
+ };
176
+ export type IpexAgreeExchange = ExchangeResourceV1 & {
177
+ exn: ExnV1 & {
178
+ r: typeof IPEX_AGREE_ROUTE;
179
+ e: object;
180
+ };
181
+ };
182
+ export type IpexAdmitExchange = ExchangeResourceV1 & {
183
+ exn: ExnV1 & {
184
+ r: typeof IPEX_ADMIT_ROUTE;
185
+ e: object;
186
+ };
187
+ };
188
+ export declare function isMultisigIcp(msg: ExchangeResourceV1): msg is MultisigIcpExchange;
189
+ export declare function isMultisigIcp(msg: ExnMultisig): msg is MultisigIcpGroup;
190
+ export declare function isMultisigRot(msg: ExchangeResourceV1): msg is MultisigRotExchange;
191
+ export declare function isMultisigRot(msg: ExnMultisig): msg is MultisigRotGroup;
192
+ export declare function isMultisigIxn(msg: ExchangeResourceV1): msg is MultisigIxnExchange;
193
+ export declare function isMultisigIxn(msg: ExnMultisig): msg is MultisigIxnGroup;
194
+ export declare function isMultisigRpy(msg: ExchangeResourceV1): msg is MultisigRpyExchange;
195
+ export declare function isMultisigRpy(msg: ExnMultisig): msg is MultisigRpyGroup;
196
+ export declare function isMultisigVcp(msg: ExchangeResourceV1): msg is MultisigVcpExchange;
197
+ export declare function isMultisigVcp(msg: ExnMultisig): msg is MultisigVcpGroup;
198
+ export declare function isMultisigIss(msg: ExchangeResourceV1): msg is MultisigIssExchange;
199
+ export declare function isMultisigIss(msg: ExnMultisig): msg is MultisigIssGroup;
200
+ export declare function isMultisigExn(msg: ExchangeResourceV1): msg is MultisigExnExchange;
201
+ export declare function isMultisigExn(msg: ExnMultisig): msg is MultisigExnGroup;
202
+ export declare function isMultisigRev(msg: ExchangeResourceV1): msg is MultisigRevExchange;
203
+ export declare function isMultisigRev(msg: ExnMultisig): msg is MultisigRevGroup;
204
+ export declare function isIpexGrant(msg: ExchangeResourceV1): msg is IpexGrantExchange;
205
+ export declare function isIpexOffer(msg: ExchangeResourceV1): msg is IpexOfferExchange;
206
+ export declare function isIpexApply(msg: ExchangeResourceV1): msg is IpexApplyExchange;
207
+ export declare function isIpexAgree(msg: ExchangeResourceV1): msg is IpexAgreeExchange;
208
+ export declare function isIpexAdmit(msg: ExchangeResourceV1): msg is IpexAdmitExchange;
209
+ export declare function assertMultisigIss(msg: ExchangeResourceV1): MultisigIssExchange;
210
+ export declare function assertMultisigIss(msg: ExnMultisig): MultisigIssGroup;
211
+ export declare function assertMultisigIcp(msg: ExchangeResourceV1): MultisigIcpExchange;
212
+ export declare function assertMultisigIcp(msg: ExnMultisig): MultisigIcpGroup;
213
+ export declare function assertMultisigRot(msg: ExchangeResourceV1): MultisigRotExchange;
214
+ export declare function assertMultisigRot(msg: ExnMultisig): MultisigRotGroup;
215
+ export declare function assertMultisigIxn(msg: ExchangeResourceV1): MultisigIxnExchange;
216
+ export declare function assertMultisigIxn(msg: ExnMultisig): MultisigIxnGroup;
217
+ export declare function assertMultisigRpy(msg: ExchangeResourceV1): MultisigRpyExchange;
218
+ export declare function assertMultisigRpy(msg: ExnMultisig): MultisigRpyGroup;
219
+ export declare function assertMultisigVcp(msg: ExchangeResourceV1): MultisigVcpExchange;
220
+ export declare function assertMultisigVcp(msg: ExnMultisig): MultisigVcpGroup;
221
+ export declare function assertMultisigExn(msg: ExchangeResourceV1): MultisigExnExchange;
222
+ export declare function assertMultisigExn(msg: ExnMultisig): MultisigExnGroup;
223
+ export declare function assertMultisigRev(msg: ExchangeResourceV1): MultisigRevExchange;
224
+ export declare function assertMultisigRev(msg: ExnMultisig): MultisigRevGroup;
225
+ export declare function assertIpexGrant(msg: ExchangeResourceV1): IpexGrantExchange;
226
+ export declare function assertIpexGrant(msg: ExnMultisig): ExnMultisig;
227
+ export declare function assertIpexOffer(msg: ExchangeResourceV1): IpexOfferExchange;
228
+ export declare function assertIpexOffer(msg: ExnMultisig): ExnMultisig;
229
+ export declare function assertIpexApply(msg: ExchangeResourceV1): IpexApplyExchange;
230
+ export declare function assertIpexApply(msg: ExnMultisig): ExnMultisig;
231
+ export declare function assertIpexAgree(msg: ExchangeResourceV1): IpexAgreeExchange;
232
+ export declare function assertIpexAgree(msg: ExnMultisig): ExnMultisig;
233
+ export declare function assertIpexAdmit(msg: ExchangeResourceV1): IpexAdmitExchange;
234
+ export declare function assertIpexAdmit(msg: ExnMultisig): ExnMultisig;
5
235
  /**
6
236
  * Exchanges
7
237
  */
@@ -28,7 +258,7 @@ export declare class Exchanges {
28
258
  /**
29
259
  * Send exn messages to list of recipients
30
260
  * @async
31
- * @returns {Promise<any>} A promise to the list of replay messages
261
+ * @returns {Promise<Exn>} A promise to the list of replay messages
32
262
  * @param name
33
263
  * @param topic
34
264
  * @param sender
@@ -37,11 +267,11 @@ export declare class Exchanges {
37
267
  * @param embeds
38
268
  * @param recipients
39
269
  */
40
- send(name: string, topic: string, sender: HabState, route: string, payload: Dict<any>, embeds: Dict<any>, recipients: string[]): Promise<any>;
270
+ send(name: string, topic: string, sender: HabState, route: string, payload: Dict<any>, embeds: Dict<any>, recipients: string[]): Promise<Exn>;
41
271
  /**
42
- * Send exn messaget to list of recipients
272
+ * Send exn message to list of recipients
43
273
  * @async
44
- * @returns {Promise<any>} A promise to the list of replay messages
274
+ * @returns {Promise<Exn>} A promise to the list of replay messages
45
275
  * @param name
46
276
  * @param topic
47
277
  * @param exn
@@ -49,13 +279,14 @@ export declare class Exchanges {
49
279
  * @param atc
50
280
  * @param recipients
51
281
  */
52
- sendFromEvents(name: string, topic: string, exn: Serder, sigs: string[], atc: string, recipients: string[]): Promise<any>;
282
+ sendFromEvents(name: string, topic: string, exn: Serder, sigs: string[], atc: string, recipients: string[]): Promise<Exn>;
53
283
  /**
54
284
  * Get exn message by said
55
285
  * @async
56
286
  * @returns A promise to the exn message
57
287
  * @param said The said of the exn message
58
288
  */
59
- get(said: string): Promise<any>;
289
+ get(said: string): Promise<ExchangeResourceV1>;
60
290
  }
61
291
  export declare function exchange(route: string, payload: Dict<any>, sender: string, recipient: string, date?: string, dig?: string, modifiers?: Dict<any>, embeds?: Dict<any>): [Serder, Uint8Array];
292
+ export {};
@@ -4,6 +4,104 @@ import { nowUTC } from "../core/utils.js";
4
4
  import { Pather } from "../core/pather.js";
5
5
  import { Counter, CtrDex } from "../core/counter.js";
6
6
  import { Saider } from "../core/saider.js";
7
+ export const MULTISIG_ICP_ROUTE = '/multisig/icp';
8
+ export const MULTISIG_ROT_ROUTE = '/multisig/rot';
9
+ export const MULTISIG_IXN_ROUTE = '/multisig/ixn';
10
+ export const MULTISIG_RPY_ROUTE = '/multisig/rpy';
11
+ export const MULTISIG_VCP_ROUTE = '/multisig/vcp';
12
+ export const MULTISIG_ISS_ROUTE = '/multisig/iss';
13
+ export const MULTISIG_EXN_ROUTE = '/multisig/exn';
14
+ export const MULTISIG_REV_ROUTE = '/multisig/rev';
15
+ export const IPEX_GRANT_ROUTE = '/ipex/grant';
16
+ export const IPEX_OFFER_ROUTE = '/ipex/offer';
17
+ export const IPEX_APPLY_ROUTE = '/ipex/apply';
18
+ export const IPEX_AGREE_ROUTE = '/ipex/agree';
19
+ export const IPEX_ADMIT_ROUTE = '/ipex/admit';
20
+ export function isMultisigIcp(msg) {
21
+ return msg.exn.r === MULTISIG_ICP_ROUTE;
22
+ }
23
+ export function isMultisigRot(msg) {
24
+ return msg.exn.r === MULTISIG_ROT_ROUTE;
25
+ }
26
+ export function isMultisigIxn(msg) {
27
+ return msg.exn.r === MULTISIG_IXN_ROUTE;
28
+ }
29
+ export function isMultisigRpy(msg) {
30
+ return msg.exn.r === MULTISIG_RPY_ROUTE;
31
+ }
32
+ export function isMultisigVcp(msg) {
33
+ return msg.exn.r === MULTISIG_VCP_ROUTE;
34
+ }
35
+ export function isMultisigIss(msg) {
36
+ return msg.exn.r === MULTISIG_ISS_ROUTE;
37
+ }
38
+ export function isMultisigExn(msg) {
39
+ return msg.exn.r === MULTISIG_EXN_ROUTE;
40
+ }
41
+ export function isMultisigRev(msg) {
42
+ return msg.exn.r === MULTISIG_REV_ROUTE;
43
+ }
44
+ export function isIpexGrant(msg) {
45
+ return msg.exn.r === IPEX_GRANT_ROUTE;
46
+ }
47
+ export function isIpexOffer(msg) {
48
+ return msg.exn.r === IPEX_OFFER_ROUTE;
49
+ }
50
+ export function isIpexApply(msg) {
51
+ return msg.exn.r === IPEX_APPLY_ROUTE;
52
+ }
53
+ export function isIpexAgree(msg) {
54
+ return msg.exn.r === IPEX_AGREE_ROUTE;
55
+ }
56
+ export function isIpexAdmit(msg) {
57
+ return msg.exn.r === IPEX_ADMIT_ROUTE;
58
+ }
59
+ function assertRoute(msg, route, label) {
60
+ var _a, _b;
61
+ if (((_a = msg.exn) === null || _a === void 0 ? void 0 : _a.r) !== route) {
62
+ throw new Error(`Expected ${label} but got route: ${(_b = msg.exn) === null || _b === void 0 ? void 0 : _b.r}`);
63
+ }
64
+ return msg;
65
+ }
66
+ export function assertMultisigIss(msg) {
67
+ return assertRoute(msg, MULTISIG_ISS_ROUTE, 'Multisig ISS message');
68
+ }
69
+ export function assertMultisigIcp(msg) {
70
+ return assertRoute(msg, MULTISIG_ICP_ROUTE, 'Multisig ICP message');
71
+ }
72
+ export function assertMultisigRot(msg) {
73
+ return assertRoute(msg, MULTISIG_ROT_ROUTE, 'Multisig ROT message');
74
+ }
75
+ export function assertMultisigIxn(msg) {
76
+ return assertRoute(msg, MULTISIG_IXN_ROUTE, 'Multisig IXN message');
77
+ }
78
+ export function assertMultisigRpy(msg) {
79
+ return assertRoute(msg, MULTISIG_RPY_ROUTE, 'Multisig RPY message');
80
+ }
81
+ export function assertMultisigVcp(msg) {
82
+ return assertRoute(msg, MULTISIG_VCP_ROUTE, 'Multisig VCP message');
83
+ }
84
+ export function assertMultisigExn(msg) {
85
+ return assertRoute(msg, MULTISIG_EXN_ROUTE, 'Multisig EXN message');
86
+ }
87
+ export function assertMultisigRev(msg) {
88
+ return assertRoute(msg, MULTISIG_REV_ROUTE, 'Multisig REV message');
89
+ }
90
+ export function assertIpexGrant(msg) {
91
+ return assertRoute(msg, IPEX_GRANT_ROUTE, 'IPEX grant message');
92
+ }
93
+ export function assertIpexOffer(msg) {
94
+ return assertRoute(msg, IPEX_OFFER_ROUTE, 'IPEX offer message');
95
+ }
96
+ export function assertIpexApply(msg) {
97
+ return assertRoute(msg, IPEX_APPLY_ROUTE, 'IPEX apply message');
98
+ }
99
+ export function assertIpexAgree(msg) {
100
+ return assertRoute(msg, IPEX_AGREE_ROUTE, 'IPEX agree message');
101
+ }
102
+ export function assertIpexAdmit(msg) {
103
+ return assertRoute(msg, IPEX_ADMIT_ROUTE, 'IPEX admit message');
104
+ }
7
105
  /**
8
106
  * Exchanges
9
107
  */
@@ -36,7 +134,7 @@ export class Exchanges {
36
134
  /**
37
135
  * Send exn messages to list of recipients
38
136
  * @async
39
- * @returns {Promise<any>} A promise to the list of replay messages
137
+ * @returns {Promise<Exn>} A promise to the list of replay messages
40
138
  * @param name
41
139
  * @param topic
42
140
  * @param sender
@@ -50,11 +148,12 @@ export class Exchanges {
50
148
  const [exn, sigs, atc] = await this.createExchangeMessage(sender, route, payload, embeds, recipient);
51
149
  return await this.sendFromEvents(name, topic, exn, sigs, atc, recipients);
52
150
  }
151
+ throw new Error('recipients list was empty');
53
152
  }
54
153
  /**
55
- * Send exn messaget to list of recipients
154
+ * Send exn message to list of recipients
56
155
  * @async
57
- * @returns {Promise<any>} A promise to the list of replay messages
156
+ * @returns {Promise<Exn>} A promise to the list of replay messages
58
157
  * @param name
59
158
  * @param topic
60
159
  * @param exn
@@ -1,5 +1,7 @@
1
1
  import { SignifyClient } from './clienting.ts';
2
- import { Dict } from '../core/core.ts';
2
+ import { GroupOperation } from '../core/keyState.ts';
3
+ import { ExnMultisig } from './exchanging.ts';
4
+ import { Exn } from './exchanging.ts';
3
5
  /**
4
6
  * Groups
5
7
  */
@@ -14,19 +16,19 @@ export declare class Groups {
14
16
  * Get group request messages
15
17
  * @async
16
18
  * @param {string} [said] SAID of exn message to load
17
- * @returns {Promise<any>} A promise to the list of replay messages
19
+ * @returns {Promise<ExnMultisig[]>} A promise to the list of replay messages
18
20
  */
19
- getRequest(said: string): Promise<any>;
21
+ getRequest(said: string): Promise<ExnMultisig[]>;
20
22
  /**
21
23
  * Send multisig exn request messages to other group members
22
24
  * @async
23
25
  * @param {string} [name] human readable name of group AID
24
- * @param {Dict<any>} [exn] exn message to send to other members
26
+ * @param {Exn} [exn] exn message to send to other members
25
27
  * @param {string[]} [sigs] signature of the participant over the exn
26
28
  * @param {string} [atc] additional attachments from embedded events in exn
27
- * @returns {Promise<any>} A promise to the list of replay messages
29
+ * @returns {Promise<Exn>} A promise to the list of replay messages
28
30
  */
29
- sendRequest(name: string, exn: Dict<any>, sigs: string[], atc: string): Promise<any>;
31
+ sendRequest(name: string, exn: Exn, sigs: string[], atc: string): Promise<Exn>;
30
32
  /**
31
33
  * Join multisig group using rotation event.
32
34
  * This can be used by participants being asked to contribute keys to a rotation event to join an existing group.
@@ -37,8 +39,8 @@ export declare class Groups {
37
39
  * @param {string} [gid] prefix
38
40
  * @param {string[]} [smids] array of particpants
39
41
  * @param {string[]} [rmids] array of particpants
40
- * @returns {Promise<any>} A promise to the list of replay messages
42
+ * @returns {Promise<GroupOperation>} A promise to the list of replay messages
41
43
  */
42
44
  join(name: string, rot: any, sigs: any, //string[],
43
- gid: string, smids: string[], rmids: string[]): Promise<any>;
45
+ gid: string, smids: string[], rmids: string[]): Promise<GroupOperation>;
44
46
  }
@@ -13,7 +13,7 @@ export class Groups {
13
13
  * Get group request messages
14
14
  * @async
15
15
  * @param {string} [said] SAID of exn message to load
16
- * @returns {Promise<any>} A promise to the list of replay messages
16
+ * @returns {Promise<ExnMultisig[]>} A promise to the list of replay messages
17
17
  */
18
18
  async getRequest(said) {
19
19
  const path = `/multisig/request/` + said;
@@ -25,10 +25,10 @@ export class Groups {
25
25
  * Send multisig exn request messages to other group members
26
26
  * @async
27
27
  * @param {string} [name] human readable name of group AID
28
- * @param {Dict<any>} [exn] exn message to send to other members
28
+ * @param {Exn} [exn] exn message to send to other members
29
29
  * @param {string[]} [sigs] signature of the participant over the exn
30
30
  * @param {string} [atc] additional attachments from embedded events in exn
31
- * @returns {Promise<any>} A promise to the list of replay messages
31
+ * @returns {Promise<Exn>} A promise to the list of replay messages
32
32
  */
33
33
  async sendRequest(name, exn, sigs, atc) {
34
34
  const path = `/identifiers/${name}/multisig/request`;
@@ -51,7 +51,7 @@ export class Groups {
51
51
  * @param {string} [gid] prefix
52
52
  * @param {string[]} [smids] array of particpants
53
53
  * @param {string[]} [rmids] array of particpants
54
- * @returns {Promise<any>} A promise to the list of replay messages
54
+ * @returns {Promise<GroupOperation>} A promise to the list of replay messages
55
55
  */
56
56
  async join(name, rot, sigs, //string[],
57
57
  gid, smids, rmids) {
@@ -0,0 +1,50 @@
1
+ import { SignifyClient } from './clienting.ts';
2
+ /**
3
+ * KERIA agent-signed KERI reply envelope carried as SSE event data.
4
+ *
5
+ * The envelope format is generic. Topic modules decide which reply route and
6
+ * payload fields they understand, but they should all reuse
7
+ * `AgentSignals.verifyReplyEnvelope` before auto-approving edge-signed work.
8
+ */
9
+ export interface SignedReplyEnvelope {
10
+ rpy: Record<string, unknown>;
11
+ sigs: string[];
12
+ }
13
+ /**
14
+ * Optional constraints applied while verifying a signed reply envelope.
15
+ */
16
+ export interface VerifyReplyEnvelopeOptions {
17
+ /**
18
+ * Expected KERI reply route, such as `/test/signals/request`.
19
+ */
20
+ route?: string;
21
+ }
22
+ /**
23
+ * Generic signaling API for one connected KERIA agent.
24
+ *
25
+ * This class intentionally owns only live transport and server-authentication
26
+ * checks. Topic-specific modules use it, but do not own it. SSE delivery is
27
+ * transient, so topic modules must still provide durable
28
+ * polling fallback endpoints for missed events and restarts.
29
+ */
30
+ export declare class AgentSignals {
31
+ client: SignifyClient;
32
+ constructor(client: SignifyClient);
33
+ /**
34
+ * Open KERIA's authenticated generic agent SSE stream.
35
+ *
36
+ * Browser `EventSource` cannot attach Signify authentication headers, so
37
+ * consumers should use this signed `fetch` response and parse SSE frames
38
+ * from the returned body stream.
39
+ */
40
+ stream(): Promise<Response>;
41
+ /**
42
+ * Verify one KERIA agent-signed KERI `rpy` envelope.
43
+ *
44
+ * Verification is route-agnostic by default. Pass `options.route` when a
45
+ * caller is expecting a specific topic request. The payload must name the
46
+ * connected KERIA agent in `rpy.a.agent`, and the first signature must verify
47
+ * against the connected agent verifier.
48
+ */
49
+ verifyReplyEnvelope(envelope: SignedReplyEnvelope, options?: VerifyReplyEnvelopeOptions): boolean;
50
+ }
@@ -0,0 +1,52 @@
1
+ import { Serder } from "../core/serder.js";
2
+ import { Siger } from "../core/siger.js";
3
+ /**
4
+ * Generic signaling API for one connected KERIA agent.
5
+ *
6
+ * This class intentionally owns only live transport and server-authentication
7
+ * checks. Topic-specific modules use it, but do not own it. SSE delivery is
8
+ * transient, so topic modules must still provide durable
9
+ * polling fallback endpoints for missed events and restarts.
10
+ */
11
+ export class AgentSignals {
12
+ constructor(client) {
13
+ this.client = client;
14
+ }
15
+ /**
16
+ * Open KERIA's authenticated generic agent SSE stream.
17
+ *
18
+ * Browser `EventSource` cannot attach Signify authentication headers, so
19
+ * consumers should use this signed `fetch` response and parse SSE frames
20
+ * from the returned body stream.
21
+ */
22
+ async stream() {
23
+ const headers = new Headers({ Accept: 'text/event-stream' });
24
+ return await this.client.fetch('/signals/stream', 'GET', null, headers);
25
+ }
26
+ /**
27
+ * Verify one KERIA agent-signed KERI `rpy` envelope.
28
+ *
29
+ * Verification is route-agnostic by default. Pass `options.route` when a
30
+ * caller is expecting a specific topic request. The payload must name the
31
+ * connected KERIA agent in `rpy.a.agent`, and the first signature must verify
32
+ * against the connected agent verifier.
33
+ */
34
+ verifyReplyEnvelope(envelope, options = {}) {
35
+ var _a;
36
+ if (this.client.agent === null || this.client.agent.verfer === null) {
37
+ throw new Error('client must be connected before verification');
38
+ }
39
+ const rpy = new Serder(envelope.rpy);
40
+ if (options.route !== undefined && rpy.sad.r !== options.route) {
41
+ return false;
42
+ }
43
+ if (((_a = rpy.sad.a) === null || _a === void 0 ? void 0 : _a.agent) !== this.client.agent.pre) {
44
+ return false;
45
+ }
46
+ if (envelope.sigs.length === 0) {
47
+ return false;
48
+ }
49
+ const siger = new Siger({ qb64: envelope.sigs[0] });
50
+ return this.client.agent.verfer.verify(siger.raw, rpy.raw);
51
+ }
52
+ }