signify-ts 0.3.0-rc2 → 0.3.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.
- package/dist/keri/app/aiding.d.ts +20 -4
- package/dist/keri/app/aiding.js +26 -1
- package/dist/keri/app/clienting.d.ts +2 -0
- package/dist/keri/app/clienting.js +1 -1
- package/dist/keri/app/contacting.d.ts +9 -14
- package/dist/keri/app/contacting.js +2 -2
- package/dist/keri/app/controller.js +2 -2
- package/dist/keri/app/coring.d.ts +112 -25
- package/dist/keri/app/coring.js +29 -13
- package/dist/keri/app/credentialing.d.ts +10 -10
- package/dist/keri/app/escrowing.d.ts +4 -2
- package/dist/keri/app/escrowing.js +1 -1
- package/dist/keri/app/exchanging.d.ts +238 -7
- package/dist/keri/app/exchanging.js +102 -3
- package/dist/keri/app/grouping.d.ts +10 -8
- package/dist/keri/app/grouping.js +4 -4
- package/dist/keri/core/eventing.d.ts +2 -2
- package/dist/keri/core/eventing.js +7 -18
- package/dist/keri/core/keeping.d.ts +16 -1
- package/dist/keri/core/keeping.js +18 -36
- package/dist/keri/core/keyState.d.ts +83 -70
- package/dist/keri/core/keyState.js +1 -1
- package/dist/keri/core/number.d.ts +1 -1
- package/dist/keri/core/number.js +7 -4
- package/dist/keri/core/salter.d.ts +2 -9
- package/dist/keri/core/salter.js +2 -9
- package/dist/types/keria-api-schema.d.ts +889 -35
- package/dist/types/keria-api-schema.js +34 -2
- 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<
|
|
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<
|
|
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
|
|
272
|
+
* Send exn message to list of recipients
|
|
43
273
|
* @async
|
|
44
|
-
* @returns {Promise<
|
|
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<
|
|
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<
|
|
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<
|
|
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
|
|
154
|
+
* Send exn message to list of recipients
|
|
56
155
|
* @async
|
|
57
|
-
* @returns {Promise<
|
|
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 {
|
|
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<
|
|
19
|
+
* @returns {Promise<ExnMultisig[]>} A promise to the list of replay messages
|
|
18
20
|
*/
|
|
19
|
-
getRequest(said: string): Promise<
|
|
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 {
|
|
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<
|
|
29
|
+
* @returns {Promise<Exn>} A promise to the list of replay messages
|
|
28
30
|
*/
|
|
29
|
-
sendRequest(name: string, exn:
|
|
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<
|
|
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<
|
|
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<
|
|
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 {
|
|
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<
|
|
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<
|
|
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) {
|
|
@@ -26,9 +26,9 @@ export declare function rotate({ pre, keys, dig, ilk, sn, isith, ndigs, nsith, w
|
|
|
26
26
|
export declare function ample(n: number, f?: number, weak?: boolean): number;
|
|
27
27
|
export interface InceptArgs {
|
|
28
28
|
keys: Array<string>;
|
|
29
|
-
isith?: number | string |
|
|
29
|
+
isith?: string | number | string[] | string[][];
|
|
30
30
|
ndigs?: Array<string>;
|
|
31
|
-
nsith?: number | string |
|
|
31
|
+
nsith?: string | number | string[] | string[][];
|
|
32
32
|
toad?: number | string;
|
|
33
33
|
wits?: Array<string>;
|
|
34
34
|
cnfg?: Array<string>;
|
|
@@ -8,7 +8,7 @@ import { Saider } from "./saider.js";
|
|
|
8
8
|
import { Counter, CtrDex } from "./counter.js";
|
|
9
9
|
import { Seqner } from "./seqner.js";
|
|
10
10
|
const MaxIntThold = 2 ** 32 - 1;
|
|
11
|
-
export function rotate({ pre = undefined, keys, dig = undefined, ilk = Ilks.rot, sn = 1, isith = undefined, ndigs = undefined, nsith = undefined, wits = undefined, cuts =
|
|
11
|
+
export function rotate({ pre = undefined, keys, dig = undefined, ilk = Ilks.rot, sn = 1, isith = undefined, ndigs = undefined, nsith = undefined, wits = undefined, cuts = [], adds = [], toad = undefined, data = undefined, version = undefined, kind = undefined, intive = true, }) {
|
|
12
12
|
const vs = versify(Protocols.KERI, version, kind, 0);
|
|
13
13
|
const _ilk = ilk;
|
|
14
14
|
if (_ilk != Ilks.rot && _ilk != Ilks.drt) {
|
|
@@ -66,25 +66,14 @@ export function rotate({ pre = undefined, keys, dig = undefined, ilk = Ilks.rot,
|
|
|
66
66
|
if (witset.size != _wits.length) {
|
|
67
67
|
throw new Error(`Invalid wits = ${wits}, has duplicates.`);
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
_cuts = [];
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
_cuts = cuts;
|
|
75
|
-
}
|
|
76
|
-
const cutset = new Set(_cuts);
|
|
77
|
-
if (cutset.size != _cuts.length) {
|
|
69
|
+
const cutset = new Set(cuts);
|
|
70
|
+
if (cutset.size != cuts.length) {
|
|
78
71
|
throw new Error(`Invalid cuts = ${cuts}, has duplicates.`);
|
|
79
72
|
}
|
|
80
|
-
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
_adds = adds;
|
|
73
|
+
const addset = new Set(adds);
|
|
74
|
+
if (addset.size != adds.length) {
|
|
75
|
+
throw new Error(`Invalid adds = ${adds}, has duplicates.`);
|
|
86
76
|
}
|
|
87
|
-
const addset = new Set(_adds);
|
|
88
77
|
//non empty intersection of witset and addset
|
|
89
78
|
const witaddset = new Set([...witset].filter((x) => addset.has(x)));
|
|
90
79
|
if (witaddset.size > 0) {
|
|
@@ -96,7 +85,7 @@ export function rotate({ pre = undefined, keys, dig = undefined, ilk = Ilks.rot,
|
|
|
96
85
|
throw new Error(`Invalid member combination among cuts = ${cuts}, and adds = ${adds}.`);
|
|
97
86
|
}
|
|
98
87
|
const newitsetdiff = new Set(_wits);
|
|
99
|
-
|
|
88
|
+
cuts.forEach(function (v) {
|
|
100
89
|
newitsetdiff.delete(v);
|
|
101
90
|
});
|
|
102
91
|
const newitset = new Set((function* () {
|
|
@@ -148,7 +148,22 @@ export declare class GroupIdentifierManager implements IdentifierManager {
|
|
|
148
148
|
rotate(_ncodes: string[], _transferable: boolean, states: KeyState[], rstates: KeyState[]): Promise<IdentifierManagerResult>;
|
|
149
149
|
sign(ser: Uint8Array, indexed?: boolean): Promise<SignResult>;
|
|
150
150
|
params(): {
|
|
151
|
-
mhab:
|
|
151
|
+
mhab: {
|
|
152
|
+
name: string;
|
|
153
|
+
prefix: string;
|
|
154
|
+
icp_dt: string;
|
|
155
|
+
state: import("../../types/keria-api-schema.ts").components["schemas"]["KeyStateRecord"];
|
|
156
|
+
transferable: boolean;
|
|
157
|
+
windexes: string[];
|
|
158
|
+
} & ({
|
|
159
|
+
salty: import("../../types/keria-api-schema.ts").components["schemas"]["SaltyState"];
|
|
160
|
+
} | {
|
|
161
|
+
randy: import("../../types/keria-api-schema.ts").components["schemas"]["RandyKeyState"];
|
|
162
|
+
} | {
|
|
163
|
+
group: import("../../types/keria-api-schema.ts").components["schemas"]["GroupKeyState"];
|
|
164
|
+
} | {
|
|
165
|
+
extern: import("../../types/keria-api-schema.ts").components["schemas"]["ExternState"];
|
|
166
|
+
});
|
|
152
167
|
keys: string[];
|
|
153
168
|
ndigs: string[];
|
|
154
169
|
};
|
|
@@ -57,45 +57,27 @@ export class IdentifierManagerFactory {
|
|
|
57
57
|
* @returns IdentifierManager instance
|
|
58
58
|
*/
|
|
59
59
|
get(aid) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
: aid[Algos.randy]
|
|
63
|
-
? Algos.randy
|
|
64
|
-
: aid[Algos.group]
|
|
65
|
-
? Algos.group
|
|
66
|
-
: aid[Algos.extern]
|
|
67
|
-
? Algos.extern
|
|
68
|
-
: undefined;
|
|
69
|
-
if (!algo) {
|
|
70
|
-
throw new Error('No algo specified');
|
|
60
|
+
if (Algos.salty in aid) {
|
|
61
|
+
return new SaltyIdentifierManager(this.salter, aid.salty.pidx, aid.salty.kidx, aid.salty.tier, aid.salty.transferable, aid.salty.stem, undefined, undefined, aid.salty.icodes, undefined, undefined, aid.salty.ncodes, aid.salty.dcode, undefined, aid.salty.sxlt);
|
|
71
62
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
throw new Error('No kargs found in HabState');
|
|
63
|
+
else if (Algos.randy in aid) {
|
|
64
|
+
return new RandyIdentifierManager(this.salter, undefined, undefined, undefined, new Prefixer({ qb64: aid['prefix'] }).transferable, undefined, undefined, [], undefined, aid.randy.prxs, aid.randy.nxts);
|
|
75
65
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
kargs = kargs;
|
|
85
|
-
return new GroupIdentifierManager(this, kargs.mhab, undefined, undefined, kargs.keys, kargs.ndigs);
|
|
86
|
-
case Algos.extern: {
|
|
87
|
-
kargs = kargs;
|
|
88
|
-
const typ = kargs.extern_type;
|
|
89
|
-
if (typ in this.modules) {
|
|
90
|
-
const mod = new this.modules[typ](kargs.pidx, kargs);
|
|
91
|
-
return mod;
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
throw new Error(`unsupported external module type ${typ}`);
|
|
95
|
-
}
|
|
66
|
+
else if (Algos.group in aid) {
|
|
67
|
+
return new GroupIdentifierManager(this, aid.group.mhab, undefined, undefined, aid.group.keys, aid.group.ndigs);
|
|
68
|
+
}
|
|
69
|
+
else if (Algos.extern in aid) {
|
|
70
|
+
const typ = aid.extern.extern_type;
|
|
71
|
+
if (typ in this.modules) {
|
|
72
|
+
const mod = new this.modules[typ](aid.extern.pidx, aid.extern);
|
|
73
|
+
return mod;
|
|
96
74
|
}
|
|
97
|
-
|
|
98
|
-
throw new Error(
|
|
75
|
+
else {
|
|
76
|
+
throw new Error(`unsupported external module type ${typ}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
throw new Error('No algo specified');
|
|
99
81
|
}
|
|
100
82
|
}
|
|
101
83
|
}
|