@did-btcr2/method 0.27.0 → 0.29.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/README.md +38 -9
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser.js +20181 -31588
- package/dist/browser.mjs +20110 -31517
- package/dist/cjs/index.js +1355 -422
- package/dist/esm/core/aggregation/beacon-strategy.js +62 -0
- package/dist/esm/core/aggregation/beacon-strategy.js.map +1 -0
- package/dist/esm/core/aggregation/cohort.js +31 -8
- package/dist/esm/core/aggregation/cohort.js.map +1 -1
- package/dist/esm/core/aggregation/logger.js +15 -0
- package/dist/esm/core/aggregation/logger.js.map +1 -0
- package/dist/esm/core/aggregation/messages/base.js +12 -1
- package/dist/esm/core/aggregation/messages/base.js.map +1 -1
- package/dist/esm/core/aggregation/messages/bodies.js +90 -0
- package/dist/esm/core/aggregation/messages/bodies.js.map +1 -0
- package/dist/esm/core/aggregation/messages/factories.js.map +1 -1
- package/dist/esm/core/aggregation/messages/index.js +1 -0
- package/dist/esm/core/aggregation/messages/index.js.map +1 -1
- package/dist/esm/core/aggregation/participant.js +39 -46
- package/dist/esm/core/aggregation/participant.js.map +1 -1
- package/dist/esm/core/aggregation/runner/participant-runner.js +34 -4
- package/dist/esm/core/aggregation/runner/participant-runner.js.map +1 -1
- package/dist/esm/core/aggregation/runner/service-runner.js +198 -19
- package/dist/esm/core/aggregation/runner/service-runner.js.map +1 -1
- package/dist/esm/core/aggregation/service.js +143 -15
- package/dist/esm/core/aggregation/service.js.map +1 -1
- package/dist/esm/core/aggregation/signing-session.js +44 -5
- package/dist/esm/core/aggregation/signing-session.js.map +1 -1
- package/dist/esm/core/aggregation/transport/didcomm.js +9 -0
- package/dist/esm/core/aggregation/transport/didcomm.js.map +1 -1
- package/dist/esm/core/aggregation/transport/nostr.js +245 -16
- package/dist/esm/core/aggregation/transport/nostr.js.map +1 -1
- package/dist/esm/core/beacon/beacon.js +147 -61
- package/dist/esm/core/beacon/beacon.js.map +1 -1
- package/dist/esm/core/beacon/utils.js +14 -9
- package/dist/esm/core/beacon/utils.js.map +1 -1
- package/dist/esm/core/updater.js +269 -0
- package/dist/esm/core/updater.js.map +1 -0
- package/dist/esm/did-btcr2.js +30 -46
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/did-document.js +2 -2
- package/dist/esm/utils/did-document.js.map +1 -1
- package/dist/types/core/aggregation/beacon-strategy.d.ts +52 -0
- package/dist/types/core/aggregation/beacon-strategy.d.ts.map +1 -0
- package/dist/types/core/aggregation/cohort.d.ts +20 -3
- package/dist/types/core/aggregation/cohort.d.ts.map +1 -1
- package/dist/types/core/aggregation/logger.d.ts +22 -0
- package/dist/types/core/aggregation/logger.d.ts.map +1 -0
- package/dist/types/core/aggregation/messages/base.d.ts +13 -1
- package/dist/types/core/aggregation/messages/base.d.ts.map +1 -1
- package/dist/types/core/aggregation/messages/bodies.d.ts +130 -0
- package/dist/types/core/aggregation/messages/bodies.d.ts.map +1 -0
- package/dist/types/core/aggregation/messages/factories.d.ts +1 -0
- package/dist/types/core/aggregation/messages/factories.d.ts.map +1 -1
- package/dist/types/core/aggregation/messages/index.d.ts +1 -0
- package/dist/types/core/aggregation/messages/index.d.ts.map +1 -1
- package/dist/types/core/aggregation/participant.d.ts +2 -0
- package/dist/types/core/aggregation/participant.d.ts.map +1 -1
- package/dist/types/core/aggregation/runner/events.d.ts +32 -6
- package/dist/types/core/aggregation/runner/events.d.ts.map +1 -1
- package/dist/types/core/aggregation/runner/participant-runner.d.ts +8 -2
- package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +1 -1
- package/dist/types/core/aggregation/runner/service-runner.d.ts +33 -3
- package/dist/types/core/aggregation/runner/service-runner.d.ts.map +1 -1
- package/dist/types/core/aggregation/service.d.ts +33 -2
- package/dist/types/core/aggregation/service.d.ts.map +1 -1
- package/dist/types/core/aggregation/signing-session.d.ts +5 -1
- package/dist/types/core/aggregation/signing-session.d.ts.map +1 -1
- package/dist/types/core/aggregation/transport/didcomm.d.ts +3 -0
- package/dist/types/core/aggregation/transport/didcomm.d.ts.map +1 -1
- package/dist/types/core/aggregation/transport/nostr.d.ts +99 -1
- package/dist/types/core/aggregation/transport/nostr.d.ts.map +1 -1
- package/dist/types/core/aggregation/transport/transport.d.ts +25 -0
- package/dist/types/core/aggregation/transport/transport.d.ts.map +1 -1
- package/dist/types/core/beacon/beacon.d.ts +85 -18
- package/dist/types/core/beacon/beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/utils.d.ts +2 -2
- package/dist/types/core/beacon/utils.d.ts.map +1 -1
- package/dist/types/core/updater.d.ts +178 -0
- package/dist/types/core/updater.d.ts.map +1 -0
- package/dist/types/did-btcr2.d.ts +23 -23
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +4 -6
- package/src/core/aggregation/beacon-strategy.ts +123 -0
- package/src/core/aggregation/cohort.ts +34 -8
- package/src/core/aggregation/logger.ts +33 -0
- package/src/core/aggregation/messages/base.ts +20 -5
- package/src/core/aggregation/messages/bodies.ts +223 -0
- package/src/core/aggregation/messages/factories.ts +1 -0
- package/src/core/aggregation/messages/index.ts +1 -0
- package/src/core/aggregation/participant.ts +40 -46
- package/src/core/aggregation/runner/events.ts +27 -3
- package/src/core/aggregation/runner/participant-runner.ts +42 -4
- package/src/core/aggregation/runner/service-runner.ts +227 -19
- package/src/core/aggregation/service.ts +189 -20
- package/src/core/aggregation/signing-session.ts +65 -7
- package/src/core/aggregation/transport/didcomm.ts +17 -0
- package/src/core/aggregation/transport/nostr.ts +266 -23
- package/src/core/aggregation/transport/transport.ts +33 -0
- package/src/core/beacon/beacon.ts +217 -76
- package/src/core/beacon/utils.ts +16 -11
- package/src/core/updater.ts +415 -0
- package/src/did-btcr2.ts +36 -71
- package/src/index.ts +4 -1
- package/src/utils/did-document.ts +2 -2
- package/dist/esm/core/update.js +0 -112
- package/dist/esm/core/update.js.map +0 -1
- package/dist/types/core/update.d.ts +0 -52
- package/dist/types/core/update.d.ts.map +0 -1
- package/src/core/update.ts +0 -158
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"participant.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/participant.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAMxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"participant.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/participant.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAMxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAiBtD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAI9D,qFAAqF;AACrF,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB,EAAE,UAAU,CAAC;CACpC;AAED,oEAAoE;AACpE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAA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DAAgD;IAChD,IAAW,kBAAkB,IAAI,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAQtE;IAmCD;;OAEG;IACI,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE;IAiBzD;;OAEG;IACI,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE;IAkBxD,+CAA+C;IAC/C,IAAW,sBAAsB,IAAI,WAAW,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAQ9E;IAyBD;;OAEG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE;IAgEpD;;;;OAIG;IACI,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE;IA4BzD,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,0BAA0B,GAAG,SAAS;CAGhF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import type { SerializedSMTProof } from '@did-btcr2/smt';
|
|
1
2
|
import type { CohortAdvert, PendingSigningRequest, PendingValidation } from '../participant.js';
|
|
2
|
-
import type { AggregationResult, PendingOptIn } from '../service.js';
|
|
3
|
+
import type { AggregationResult, PendingOptIn, Rejection } from '../service.js';
|
|
3
4
|
/**
|
|
4
5
|
* AggregationServiceRunner events are emitted by the AggregationServiceRunner to signal important
|
|
5
6
|
* milestones and actions during the aggregation process. They can be listened to by external code
|
|
@@ -25,6 +26,14 @@ export type AggregationServiceEvents = {
|
|
|
25
26
|
'update-received': [{
|
|
26
27
|
participantDid: string;
|
|
27
28
|
}];
|
|
29
|
+
/**
|
|
30
|
+
* An inbound message was silently dropped by the state machine (bad proof,
|
|
31
|
+
* oversized payload, wrong wire version, etc.). Fires for *any* rejection,
|
|
32
|
+
* not just SUBMIT_UPDATE.
|
|
33
|
+
*/
|
|
34
|
+
'message-rejected': [Rejection & {
|
|
35
|
+
cohortId: string;
|
|
36
|
+
}];
|
|
28
37
|
/** Aggregated data has been distributed to all participants for validation. */
|
|
29
38
|
'data-distributed': [{
|
|
30
39
|
cohortId: string;
|
|
@@ -44,6 +53,11 @@ export type AggregationServiceEvents = {
|
|
|
44
53
|
}];
|
|
45
54
|
/** Signing complete — final aggregated signature is ready to broadcast. */
|
|
46
55
|
'signing-complete': [AggregationResult];
|
|
56
|
+
/** Cohort transitioned to Failed phase (e.g. a participant rejected validation). */
|
|
57
|
+
'cohort-failed': [{
|
|
58
|
+
cohortId: string;
|
|
59
|
+
reason: string;
|
|
60
|
+
}];
|
|
47
61
|
/** A non-fatal error occurred. Fatal errors reject the run() promise. */
|
|
48
62
|
'error': [Error];
|
|
49
63
|
};
|
|
@@ -73,11 +87,23 @@ export type AggregationParticipantEvents = {
|
|
|
73
87
|
'validation-requested': [PendingValidation];
|
|
74
88
|
/** Signing request has arrived. Fires before the sign approval callback. */
|
|
75
89
|
'signing-requested': [PendingSigningRequest];
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
90
|
+
/**
|
|
91
|
+
* Cohort signing is complete from this participant's perspective.
|
|
92
|
+
* Includes the aggregated sidecar data the participant needs to keep for
|
|
93
|
+
* future DID resolution: the CAS Announcement map (for CAS beacons) or the
|
|
94
|
+
* SMT inclusion proof (for SMT beacons).
|
|
95
|
+
*/
|
|
96
|
+
'cohort-complete': [
|
|
97
|
+
{
|
|
98
|
+
cohortId: string;
|
|
99
|
+
beaconAddress: string;
|
|
100
|
+
beaconType: string;
|
|
101
|
+
/** DID → base64url update hash. Populated only for CAS beacons. */
|
|
102
|
+
casAnnouncement?: Record<string, string>;
|
|
103
|
+
/** Merkle inclusion proof for this participant's slot. Populated only for SMT beacons. */
|
|
104
|
+
smtProof?: SerializedSMTProof;
|
|
105
|
+
}
|
|
106
|
+
];
|
|
81
107
|
/** Cohort failed (rejected validation, signing error, etc.). */
|
|
82
108
|
'cohort-failed': [{
|
|
83
109
|
cohortId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAEhF;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,kEAAkE;IAClE,mBAAmB,EAAE,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAE5C,6EAA6E;IAC7E,iBAAiB,EAAE,CAAC,YAAY,CAAC,CAAC;IAElC,uDAAuD;IACvD,sBAAsB,EAAE,CAAC;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAErD,mEAAmE;IACnE,iBAAiB,EAAE,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEjE,mDAAmD;IACnD,iBAAiB,EAAE,CAAC;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEhD;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,SAAS,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEvD,+EAA+E;IAC/E,kBAAkB,EAAE,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAE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YACnE,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACzC,0FAA0F;YAC1F,QAAQ,CAAC,EAAE,kBAAkB,CAAC;SAC/B;KAAC,CAAC;IAEH,gEAAgE;IAChE,eAAe,EAAE,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAExD,kCAAkC;IAClC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;CAClB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
2
2
|
import type { SchnorrKeyPair } from '@did-btcr2/keypair';
|
|
3
|
+
import type { SerializedSMTProof } from '@did-btcr2/smt';
|
|
3
4
|
import type { CohortAdvert, PendingSigningRequest, PendingValidation } from '../participant.js';
|
|
4
5
|
import { AggregationParticipant } from '../participant.js';
|
|
5
6
|
import type { Transport } from '../transport/transport.js';
|
|
@@ -65,7 +66,7 @@ export interface AggregationParticipantRunnerOptions {
|
|
|
65
66
|
* keys: myKeys,
|
|
66
67
|
* shouldJoin: async (advert) => advert.beaconType === 'CASBeacon',
|
|
67
68
|
* onProvideUpdate: async ({ beaconAddress }) => {
|
|
68
|
-
* return
|
|
69
|
+
* return Updater.sign(myDid, unsigned, vm, secretKey);
|
|
69
70
|
* },
|
|
70
71
|
* });
|
|
71
72
|
*
|
|
@@ -93,7 +94,7 @@ export declare class AggregationParticipantRunner extends TypedEventEmitter<Aggr
|
|
|
93
94
|
* is called or the underlying transport disconnects.
|
|
94
95
|
*/
|
|
95
96
|
start(): Promise<void>;
|
|
96
|
-
/** Stop the runner
|
|
97
|
+
/** Stop the runner and detach transport handlers. Safe to call repeatedly. */
|
|
97
98
|
stop(): void;
|
|
98
99
|
/**
|
|
99
100
|
* Single-shot helper: start, join the first cohort that passes `shouldJoin`,
|
|
@@ -102,6 +103,11 @@ export declare class AggregationParticipantRunner extends TypedEventEmitter<Aggr
|
|
|
102
103
|
static joinFirst(options: AggregationParticipantRunnerOptions): Promise<{
|
|
103
104
|
cohortId: string;
|
|
104
105
|
beaconAddress: string;
|
|
106
|
+
beaconType: string;
|
|
107
|
+
/** DID → base64url update hash. Populated only for CAS beacons. */
|
|
108
|
+
casAnnouncement?: Record<string, string>;
|
|
109
|
+
/** Merkle inclusion proof for this participant's slot. Populated only for SMT beacons. */
|
|
110
|
+
smtProof?: SerializedSMTProof;
|
|
105
111
|
}>;
|
|
106
112
|
}
|
|
107
113
|
//# sourceMappingURL=participant-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"participant-runner.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/participant-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUzD,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,yEAAyE;AACzE,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpE,wEAAwE;AACxE,MAAM,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAEjC,4DAA4D;AAC5D,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEzF,oDAAoD;AACpD,MAAM,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,qBAAqB,KAAK,OAAO,CAAC;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAE/F,MAAM,WAAW,mCAAmC;IAClD,4BAA4B;IAC5B,SAAS,EAAE,SAAS,CAAC;IAErB,4BAA4B;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,cAAc,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;;OAGG;IACH,eAAe,EAAE,eAAe,CAAC;IAEjC;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,4BAA6B,SAAQ,iBAAiB,CAAC,4BAA4B,CAAC;;IAC/F,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;gBAY7B,OAAO,EAAE,mCAAmC;IAYxD;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B
|
|
1
|
+
{"version":3,"file":"participant-runner.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/participant-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAUzD,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAA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;IAC/F,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;gBAY7B,OAAO,EAAE,mCAAmC;IAYxD;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,8EAA8E;IAC9E,IAAI,IAAI,IAAI;IAwBZ;;;OAGG;WACU,SAAS,CACpB,OAAO,EAAE,mCAAmC,GAC3C,OAAO,CAAC;QACT,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,UAAU,EAAE,MAAM,CAAC;QACnB,mEAAmE;QACnE,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACzC,0FAA0F;QAC1F,QAAQ,CAAC,EAAE,kBAAkB,CAAC;KAC/B,CAAC;CAwNH"}
|
|
@@ -45,7 +45,38 @@ export interface AggregationServiceRunnerOptions {
|
|
|
45
45
|
* REQUIRED — no sensible default.
|
|
46
46
|
*/
|
|
47
47
|
onProvideTxData: OnProvideTxData;
|
|
48
|
+
/**
|
|
49
|
+
* Maximum canonicalized byte-length of a signed update body. Submissions
|
|
50
|
+
* above this cap are rejected and surfaced via the `message-rejected` event.
|
|
51
|
+
* Defaults to {@link DEFAULT_MAX_UPDATE_SIZE_BYTES} (256 KiB).
|
|
52
|
+
*/
|
|
53
|
+
maxUpdateSizeBytes?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Overall wall-clock budget for the cohort, from run() to signing-complete.
|
|
56
|
+
* On expiry the cohort is dropped, `cohort-failed` is emitted, and run()
|
|
57
|
+
* rejects with a timeout error. Leave undefined to disable.
|
|
58
|
+
*/
|
|
59
|
+
cohortTtlMs?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Maximum time allowed between phase transitions. Protects against stalled
|
|
62
|
+
* cohorts (e.g. a participant vanishing mid-protocol). Reset automatically
|
|
63
|
+
* on every observed phase change. Leave undefined to disable.
|
|
64
|
+
*/
|
|
65
|
+
phaseTimeoutMs?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Re-publish COHORT_ADVERT on this interval until keygen is finalized.
|
|
68
|
+
* Works around relays that don't backfill historical events to late
|
|
69
|
+
* subscribers — a republish gives late joiners a window to discover the
|
|
70
|
+
* advert without protocol changes. The first publish is immediate;
|
|
71
|
+
* subsequent publishes fire every `advertRepeatIntervalMs` until
|
|
72
|
+
* keygen-complete, fail, or stop(). Defaults to
|
|
73
|
+
* {@link DEFAULT_ADVERT_REPEAT_INTERVAL_MS} (60 s). Set to 0 to publish
|
|
74
|
+
* once and never retry.
|
|
75
|
+
*/
|
|
76
|
+
advertRepeatIntervalMs?: number;
|
|
48
77
|
}
|
|
78
|
+
/** Default cadence for re-publishing COHORT_ADVERT until keygen completes: 60 seconds. */
|
|
79
|
+
export declare const DEFAULT_ADVERT_REPEAT_INTERVAL_MS = 60000;
|
|
49
80
|
/**
|
|
50
81
|
* High-level facade for running an Aggregation Service over a Transport.
|
|
51
82
|
*
|
|
@@ -93,9 +124,8 @@ export declare class AggregationServiceRunner extends TypedEventEmitter<Aggregat
|
|
|
93
124
|
*/
|
|
94
125
|
run(): Promise<AggregationResult>;
|
|
95
126
|
/**
|
|
96
|
-
* Stop the runner early.
|
|
97
|
-
*
|
|
98
|
-
* does not currently expose unregister).
|
|
127
|
+
* Stop the runner early. Marks the runner stopped and detaches transport
|
|
128
|
+
* handlers so a restart or a new runner doesn't inherit stale dispatch.
|
|
99
129
|
*/
|
|
100
130
|
stop(): void;
|
|
101
131
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-runner.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/runner/service-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAUzD,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EACL,kBAAkB,EACnB,MAA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;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;;;OASG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,0FAA0F;AAC1F,eAAO,MAAM,iCAAiC,QAAS,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,wBAAyB,SAAQ,iBAAiB,CAAC,wBAAwB,CAAC;;IACvF,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;gBA8BzB,OAAO,EAAE,+BAA+B;IAiCpD;;;;;OAKG;IACH,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAiGjC;;;OAGG;IACH,IAAI,IAAI,IAAI;CAqQb"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
2
2
|
import type { SchnorrKeyPair } from '@did-btcr2/keypair';
|
|
3
|
-
import type { Transaction } from '
|
|
3
|
+
import type { Transaction } from '@scure/btc-signer';
|
|
4
4
|
import { AggregationCohort } from './cohort.js';
|
|
5
5
|
import type { BaseMessage } from './messages/base.js';
|
|
6
6
|
import type { ServiceCohortPhaseType } from './phases.js';
|
|
@@ -36,9 +36,28 @@ export interface SigningTxData {
|
|
|
36
36
|
prevOutScripts: Uint8Array[];
|
|
37
37
|
prevOutValues: bigint[];
|
|
38
38
|
}
|
|
39
|
+
/** Reason an incoming message was silently dropped by the state machine. */
|
|
40
|
+
export type RejectionReason = 'WRONG_VERSION' | 'UPDATE_TOO_LARGE' | 'UPDATE_VERIFICATION_FAILED' | 'UPDATE_MALFORMED';
|
|
41
|
+
/** Record of a silently-dropped inbound message. Drained by the runner to emit events. */
|
|
42
|
+
export interface Rejection {
|
|
43
|
+
/** DID of the sender whose message was rejected. */
|
|
44
|
+
from: string;
|
|
45
|
+
/** Machine-readable code. */
|
|
46
|
+
code: RejectionReason;
|
|
47
|
+
/** Human-readable reason. */
|
|
48
|
+
reason: string;
|
|
49
|
+
}
|
|
50
|
+
/** Default maximum canonicalized byte-length of a submitted BTCR2 update. */
|
|
51
|
+
export declare const DEFAULT_MAX_UPDATE_SIZE_BYTES: number;
|
|
39
52
|
export interface AggregationServiceParams {
|
|
40
53
|
did: string;
|
|
41
54
|
keys: SchnorrKeyPair;
|
|
55
|
+
/**
|
|
56
|
+
* Maximum canonicalized byte-length of a signed update body accepted by the
|
|
57
|
+
* service. Submissions above this cap are silently dropped and surfaced as
|
|
58
|
+
* `UPDATE_TOO_LARGE` rejections. Defaults to {@link DEFAULT_MAX_UPDATE_SIZE_BYTES}.
|
|
59
|
+
*/
|
|
60
|
+
maxUpdateSizeBytes?: number;
|
|
42
61
|
}
|
|
43
62
|
/**
|
|
44
63
|
* Sans-I/O state machine for an Aggregation Service.
|
|
@@ -55,8 +74,15 @@ export declare class AggregationService {
|
|
|
55
74
|
#private;
|
|
56
75
|
readonly did: string;
|
|
57
76
|
readonly keys: SchnorrKeyPair;
|
|
58
|
-
|
|
77
|
+
readonly maxUpdateSizeBytes: number;
|
|
78
|
+
constructor({ did, keys, maxUpdateSizeBytes }: AggregationServiceParams);
|
|
59
79
|
receive(message: BaseMessage): void;
|
|
80
|
+
/**
|
|
81
|
+
* Drain the rejection log for a cohort. Used by runners to surface silent
|
|
82
|
+
* drops (bad proof, oversized update, wrong version, etc.) as structured
|
|
83
|
+
* events without breaking the sans-I/O state machine contract.
|
|
84
|
+
*/
|
|
85
|
+
drainRejections(cohortId: string): Array<Rejection>;
|
|
60
86
|
/**
|
|
61
87
|
* Create a new cohort with the given config. Returns the cohort ID.
|
|
62
88
|
* Cohort starts in `Created` phase — call `advertise()` to broadcast.
|
|
@@ -108,5 +134,10 @@ export declare class AggregationService {
|
|
|
108
134
|
*/
|
|
109
135
|
getSigningSessionId(cohortId: string): string | undefined;
|
|
110
136
|
get cohorts(): ReadonlyArray<AggregationCohort>;
|
|
137
|
+
/**
|
|
138
|
+
* Remove a cohort from the state map. Used by runners to GC state on cohort
|
|
139
|
+
* completion, failure, or expiry. No-op if the cohort doesn't exist.
|
|
140
|
+
*/
|
|
141
|
+
removeCohort(cohortId: string): void;
|
|
111
142
|
}
|
|
112
143
|
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAiBtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAI1D,wDAAwD;AACxD,MAAM,WAAW,YAAY;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,UAAU,CAAC;IAC1B,eAAe,EAAE,UAAU,CAAC;CAC7B;AAED,oCAAoC;AACpC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,EAAE,WAAW,CAAC,MAAM,CA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{ Transaction } from '@scure/btc-signer';
|
|
2
2
|
import type { AggregationCohort } from './cohort.js';
|
|
3
3
|
import type { SigningSessionPhaseType } from './phases.js';
|
|
4
4
|
type PublicKeyHex = string;
|
|
@@ -60,6 +60,10 @@ export declare class BeaconSigningSession {
|
|
|
60
60
|
/**
|
|
61
61
|
* Generates a partial signature using the participant's secret key + secret nonce.
|
|
62
62
|
* Requires the aggregated nonce to have been set first (via the service).
|
|
63
|
+
*
|
|
64
|
+
* Zeros the stored `secretNonce` after use. JS cannot truly erase memory (GC
|
|
65
|
+
* and immutable strings), but overwriting the bytes shortens the exposure
|
|
66
|
+
* window and prevents accidental reuse or serialization of a spent nonce.
|
|
63
67
|
*/
|
|
64
68
|
generatePartialSignature(participantSecretKey: Uint8Array): Uint8Array;
|
|
65
69
|
isComplete(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signing-session.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/signing-session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"signing-session.d.ts","sourceRoot":"","sources":["../../../../src/core/aggregation/signing-session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAG3D,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,KAAK,GAAG,UAAU,CAAC;AAExB,MAAM,WAAW,oBAAoB;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,iBAAiB,CAAC;IAC1B,SAAS,EAAE,WAAW,CAAC;IACvB,cAAc,CAAC,EAAE,UAAU,EAAE,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,qBAAa,oBAAoB;IAC/B,kDAA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|
registerPeer(_did: string, _communicationPk: Uint8Array): void;
|
|
16
16
|
getPeerPk(_did: string): Uint8Array | undefined;
|
|
17
17
|
registerMessageHandler(_actorDid: string, _messageType: string, _handler: MessageHandler): void;
|
|
18
|
+
unregisterMessageHandler(_actorDid: string, _messageType: string): void;
|
|
19
|
+
unregisterActor(_did: string): void;
|
|
18
20
|
sendMessage(_message: BaseMessage, _sender: string, _recipient?: string): Promise<void>;
|
|
21
|
+
publishRepeating(_message: BaseMessage, _sender: string, _intervalMs: number, _recipient?: string): () => void;
|
|
19
22
|
}
|
|
20
23
|
//# sourceMappingURL=didcomm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"didcomm.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/transport/didcomm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhE;;;;;GAKG;AACH,qBAAa,gBAAiB,YAAW,SAAS;IACzC,IAAI,EAAE,MAAM,CAAa;IAEzB,KAAK,IAAI,IAAI;IAIb,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IAIxD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIhD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,GAAG,IAAI;IAI9D,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAI/C,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"didcomm.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/transport/didcomm.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhE;;;;;GAKG;AACH,qBAAa,gBAAiB,YAAW,SAAS;IACzC,IAAI,EAAE,MAAM,CAAa;IAEzB,KAAK,IAAI,IAAI;IAIb,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI;IAIxD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIhD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,GAAG,IAAI;IAI9D,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAI/C,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI;IAI/F,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAIvE,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI7B,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7F,gBAAgB,CACrB,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,IAAI;CAGd"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Did } from '@did-btcr2/common';
|
|
2
2
|
import type { SchnorrKeyPair } from '@did-btcr2/keypair';
|
|
3
3
|
import { SimplePool } from 'nostr-tools/pool';
|
|
4
|
+
import type { Logger } from '../logger.js';
|
|
4
5
|
import type { BaseMessage } from '../messages/base.js';
|
|
5
6
|
import type { MessageHandler, Transport } from './transport.js';
|
|
6
7
|
/**
|
|
@@ -10,7 +11,24 @@ import type { MessageHandler, Transport } from './transport.js';
|
|
|
10
11
|
export declare const DEFAULT_NOSTR_RELAYS: string[];
|
|
11
12
|
export interface NostrTransportConfig {
|
|
12
13
|
relays?: string[];
|
|
14
|
+
/**
|
|
15
|
+
* Optional logger for transport-level diagnostics (publish/subscribe events,
|
|
16
|
+
* relay rejections, parse failures). Defaults to {@link CONSOLE_LOGGER}.
|
|
17
|
+
*/
|
|
18
|
+
logger?: Logger;
|
|
19
|
+
/**
|
|
20
|
+
* How far back (in milliseconds) to set the `since` filter on the broadcast
|
|
21
|
+
* (COHORT_ADVERT) subscription. Some public relays do NOT replay historical
|
|
22
|
+
* events to late subscribers when the filter has no `since`, so the advert
|
|
23
|
+
* gets lost if the subscription lands after the publish. A short lookback
|
|
24
|
+
* window nudges those relays into delivering recent adverts. Set to 0 to
|
|
25
|
+
* disable the filter entirely (unbounded history). Defaults to
|
|
26
|
+
* {@link DEFAULT_BROADCAST_LOOKBACK_MS} (5 minutes).
|
|
27
|
+
*/
|
|
28
|
+
broadcastLookbackMs?: number;
|
|
13
29
|
}
|
|
30
|
+
/** Default `since` lookback for broadcast (COHORT_ADVERT) subscriptions: 5 minutes. */
|
|
31
|
+
export declare const DEFAULT_BROADCAST_LOOKBACK_MS: number;
|
|
14
32
|
/**
|
|
15
33
|
* Nostr Transport for did:btcr2 aggregation messages.
|
|
16
34
|
*
|
|
@@ -41,15 +59,95 @@ export declare class NostrTransport implements Transport {
|
|
|
41
59
|
* @example
|
|
42
60
|
* const transport = new NostrTransport();
|
|
43
61
|
* const keys = SchnorrKeyPair.generate();
|
|
44
|
-
*
|
|
62
|
+
* const did = DidBtcr2.create(keys.publicKey.compressed, { idType: 'KEY', network: 'mutinynet' });
|
|
63
|
+
* transport.registerActor(did, keys);
|
|
45
64
|
* transport.start();
|
|
46
65
|
*/
|
|
47
66
|
registerActor(did: string, keys: SchnorrKeyPair): void;
|
|
67
|
+
/**
|
|
68
|
+
* Detach an actor: drop its handlers, close its relay subscriptions, and remove its keys + peer
|
|
69
|
+
* mapping. Idempotent.
|
|
70
|
+
* @param {string} did - The DID of the actor to unregister.
|
|
71
|
+
* @returns {void}
|
|
72
|
+
* @throws {TransportAdapterError} If the transport is not started or if the pool is unavailable.
|
|
73
|
+
* @example
|
|
74
|
+
* transport.unregisterActor(did);
|
|
75
|
+
*/
|
|
76
|
+
unregisterActor(did: string): void;
|
|
77
|
+
/**
|
|
78
|
+
* Remove a single (actor, messageType) handler. Idempotent.
|
|
79
|
+
* @param {string} actorDid - The DID of the actor.
|
|
80
|
+
* @param {string} messageType - The type of message to unregister the handler for.
|
|
81
|
+
* @returns {void}
|
|
82
|
+
* @example
|
|
83
|
+
* transport.unregisterMessageHandler(actorDid, messageType);
|
|
84
|
+
*/
|
|
85
|
+
unregisterMessageHandler(actorDid: string, messageType: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* Gets the public key for a registered actor by their DID.
|
|
88
|
+
* @param {string} did - The DID of the registered actor to get the public key for.
|
|
89
|
+
* @returns {Uint8Array | undefined} The compressed public key bytes for the actor's DID, or
|
|
90
|
+
* undefined if the DID is not registered.
|
|
91
|
+
*/
|
|
48
92
|
getActorPk(did: string): Uint8Array | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* Registers a peer's communication public key for encrypted messages.
|
|
95
|
+
* @param {string} did - The DID of the peer to register.
|
|
96
|
+
* @param {Uint8Array} communicationPk - The compressed secp256k1 public key bytes for the peer.
|
|
97
|
+
*/
|
|
49
98
|
registerPeer(did: string, communicationPk: Uint8Array): void;
|
|
99
|
+
/**
|
|
100
|
+
* Gets the registered communication public key for a peer by their DID.
|
|
101
|
+
* @param {string} did - The DID of the peer to get the communication public key for.
|
|
102
|
+
* @returns {Uint8Array | undefined} The compressed secp256k1 public key bytes for the peer, or
|
|
103
|
+
* undefined if the peer is not registered.
|
|
104
|
+
*/
|
|
50
105
|
getPeerPk(did: string): Uint8Array | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Registers a message handler function for a specific actor and message type. The handler will be called
|
|
108
|
+
* when a message of the specified type is received for the actor's DID. The transport must have been
|
|
109
|
+
* started for handlers to be invoked. If the transport is already started, the handler will be registered
|
|
110
|
+
* immediately; otherwise, it will be registered when the transport starts and the actor's subscription is created.
|
|
111
|
+
* @param {string} actorDid - The DID of the actor to register the message handler for.
|
|
112
|
+
* @param {string} messageType - The type of message to handle.
|
|
113
|
+
* @param {MessageHandler} handler - The function to handle incoming messages of the specified type.
|
|
114
|
+
* @throws {TransportAdapterError} If the actor DID is not registered or if the handler is invalid.
|
|
115
|
+
*/
|
|
51
116
|
registerMessageHandler(actorDid: string, messageType: string, handler: MessageHandler): void;
|
|
117
|
+
/**
|
|
118
|
+
* Starts the transport by connecting to the configured Nostr relays and setting up subscriptions
|
|
119
|
+
* for all registered actors. This method must be called after registering actors via registerActor()
|
|
120
|
+
* and before sending or receiving messages. The transport will subscribe to broadcast events (kind 1)
|
|
121
|
+
* for cohort adverts and directed events (kinds 1 and 1059) for each registered actor based on their
|
|
122
|
+
* public keys. Incoming events are processed and dispatched to the appropriate handlers based on
|
|
123
|
+
* message type. If the transport is already started, this method has no effect.
|
|
124
|
+
* @returns {NostrTransport}
|
|
125
|
+
*/
|
|
52
126
|
start(): NostrTransport;
|
|
127
|
+
/**
|
|
128
|
+
* Sends a message by publishing a Nostr event to the configured relays. The message is serialized
|
|
129
|
+
* as JSON and included in the event content.
|
|
130
|
+
* @param {BaseMessage} message - The aggregation message to send. Must include a valid `type` property.
|
|
131
|
+
* @param {Did} sender - The DID of the registered actor sending the message. Must have been
|
|
132
|
+
* registered via registerActor().
|
|
133
|
+
* @param {Did} [to] - Optional recipient DID for directed messages. Required for encrypted message
|
|
134
|
+
* types. If provided, must have been registered via registerPeer().
|
|
135
|
+
* @returns {Promise<void>} Resolves when the message has been published to the relays. Note that
|
|
136
|
+
* publication is best-effort: the method will resolve as long as at least one relay accepts the
|
|
137
|
+
* event, even if others reject it.
|
|
138
|
+
*/
|
|
53
139
|
sendMessage(message: BaseMessage, sender: Did, to?: Did): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Publish the message once immediately and then re-publish on an interval
|
|
142
|
+
* until the returned stop function is invoked.
|
|
143
|
+
*
|
|
144
|
+
* Useful for broadcast messages (COHORT_ADVERT) on relays that don't
|
|
145
|
+
* backfill historical events to late subscribers: republishing gives late
|
|
146
|
+
* joiners a window to discover the message without requiring protocol
|
|
147
|
+
* changes. Relay rate-limit / publish failures inside the interval are
|
|
148
|
+
* caught and logged rather than propagated — the caller should stop the
|
|
149
|
+
* repeater once the protocol condition is satisfied.
|
|
150
|
+
*/
|
|
151
|
+
publishRepeating(message: BaseMessage, sender: Did, intervalMs: number, recipient?: Did): () => void;
|
|
54
152
|
}
|
|
55
153
|
//# sourceMappingURL=nostr.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nostr.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/transport/nostr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"nostr.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/transport/nostr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,C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,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IAmF7E;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,MAAM,IAAI;CAwNrG"}
|
|
@@ -31,7 +31,32 @@ export interface Transport {
|
|
|
31
31
|
getPeerPk(did: string): Uint8Array | undefined;
|
|
32
32
|
/** Register a message handler scoped to a specific actor. */
|
|
33
33
|
registerMessageHandler(actorDid: string, messageType: string, handler: MessageHandler): void;
|
|
34
|
+
/** Remove a previously-registered handler. No-op if not registered. */
|
|
35
|
+
unregisterMessageHandler(actorDid: string, messageType: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Detach an actor: unregister all its handlers, drop its keys, and close any
|
|
38
|
+
* transport-level subscriptions created for it. No-op if the actor is not
|
|
39
|
+
* registered.
|
|
40
|
+
*/
|
|
41
|
+
unregisterActor(did: string): void;
|
|
34
42
|
/** Send a message. The transport looks up sender to resolve signing keys. */
|
|
35
43
|
sendMessage(message: BaseMessage, sender: string, recipient?: string): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Publish the message once immediately and then repeat it on a fixed
|
|
46
|
+
* interval. Returns a stop function the caller MUST invoke when the repeat
|
|
47
|
+
* is no longer needed (e.g. once the protocol state that required the
|
|
48
|
+
* message is satisfied).
|
|
49
|
+
*
|
|
50
|
+
* Useful for broadcasts on transports that don't reliably backfill
|
|
51
|
+
* historical events to late subscribers (many Nostr relays) — republishing
|
|
52
|
+
* gives late joiners a window in which to discover the message. The first
|
|
53
|
+
* publish is synchronous-ish (fired before the method returns).
|
|
54
|
+
*
|
|
55
|
+
* Callers specify `recipient` only for directed messages; for broadcasts
|
|
56
|
+
* it is omitted.
|
|
57
|
+
*
|
|
58
|
+
* @returns A stop function. Idempotent — safe to call more than once.
|
|
59
|
+
*/
|
|
60
|
+
publishRepeating(message: BaseMessage, sender: string, intervalMs: number, recipient?: string): () => void;
|
|
36
61
|
}
|
|
37
62
|
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../../../src/core/aggregation/transport/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;AACpD,MAAM,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9D,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;AAEtE,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IAEb,sEAAsE;IACtE,KAAK,IAAI,IAAI,CAAC;IAEd,sEAAsE;IACtE,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,IAAI,CAAC;IAEvD,uEAAuE;IACvE,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAEhD,4EAA4E;IAC5E,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,EAAE,UAAU,GAAG,IAAI,CAAC;IAE7D,yDAAyD;IACzD,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAE/C,6DAA6D;IAC7D,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE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