@did-btcr2/aggregation 0.3.0 → 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.
- package/README.md +3 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser.js +9 -23974
- package/dist/browser.mjs +9 -23968
- package/dist/cjs/core/index.js +4 -0
- package/dist/cjs/index.js +89 -17
- package/dist/cjs/participant/index.js +12 -5
- package/dist/cjs/service/index.js +71 -10
- package/dist/esm/core/messages/base.js.map +1 -1
- package/dist/esm/core/messages/bodies.js.map +1 -1
- package/dist/esm/core/messages/factories.js.map +1 -1
- package/dist/esm/core/transport/didcomm.js +4 -0
- package/dist/esm/core/transport/didcomm.js.map +1 -1
- package/dist/esm/participant/http-client.js +2 -2
- package/dist/esm/participant/http-client.js.map +1 -1
- package/dist/esm/participant/participant-runner.js +1 -0
- package/dist/esm/participant/participant-runner.js.map +1 -1
- package/dist/esm/participant/participant.js +7 -1
- package/dist/esm/participant/participant.js.map +1 -1
- package/dist/esm/service/http-server.js +99 -10
- package/dist/esm/service/http-server.js.map +1 -1
- package/dist/esm/service/service-runner.js +6 -1
- package/dist/esm/service/service-runner.js.map +1 -1
- package/dist/types/core/messages/base.d.ts +7 -0
- package/dist/types/core/messages/base.d.ts.map +1 -1
- package/dist/types/core/messages/bodies.d.ts +6 -0
- package/dist/types/core/messages/bodies.d.ts.map +1 -1
- package/dist/types/core/messages/factories.d.ts +2 -0
- package/dist/types/core/messages/factories.d.ts.map +1 -1
- package/dist/types/core/transport/didcomm.d.ts.map +1 -1
- package/dist/types/participant/http-client.d.ts +7 -3
- package/dist/types/participant/http-client.d.ts.map +1 -1
- package/dist/types/participant/participant-runner.d.ts +8 -0
- package/dist/types/participant/participant-runner.d.ts.map +1 -1
- package/dist/types/participant/participant.d.ts +12 -1
- package/dist/types/participant/participant.d.ts.map +1 -1
- package/dist/types/service/http-server.d.ts +15 -2
- package/dist/types/service/http-server.d.ts.map +1 -1
- package/dist/types/service/service-runner.d.ts.map +1 -1
- package/package.json +5 -11
- package/src/core/messages/base.ts +7 -0
- package/src/core/messages/bodies.ts +6 -0
- package/src/core/messages/factories.ts +2 -0
- package/src/core/transport/didcomm.ts +4 -0
- package/src/participant/http-client.ts +17 -6
- package/src/participant/participant-runner.ts +12 -2
- package/src/participant/participant.ts +19 -1
- package/src/service/http-server.ts +126 -14
- package/src/service/service-runner.ts +6 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../../src/core/messages/factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAkBxC;;;;GAIG;AACH,KAAK,mBAAmB,GAAG,gBAAgB,GAAG;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,UAAU,CAAC;CAC7B,CAAC;AACF,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,UAAU,CAAC;IAC1B,eAAe,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../../src/core/messages/factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAkBxC;;;;GAIG;AACH,KAAK,mBAAmB,GAAG,gBAAgB,GAAG;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,UAAU,CAAC;CAC7B,CAAC;AAC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CAAC;IACrB,iBAAiB,EAAE,UAAU,CAAC;CAC/B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,yCAAyC,CAAC,MAAM,EAAE,mCAAmC,GAAG,WAAW,CAGlH;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,wBAAwB,GAAG,WAAW,CAG5F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"didcomm.d.ts","sourceRoot":"","sources":["../../../../src/core/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;
|
|
1
|
+
{"version":3,"file":"didcomm.d.ts","sourceRoot":"","sources":["../../../../src/core/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;IAQhD,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"}
|
|
@@ -17,10 +17,14 @@ export interface HttpClientTransportConfig {
|
|
|
17
17
|
/**
|
|
18
18
|
* Resolve a sender's communication public key from its DID when the sender is not a
|
|
19
19
|
* registered peer. Lets the transport stay DID-method-agnostic: the caller supplies
|
|
20
|
-
* the decode (for example, a did:btcr2 KEY identifier yields its genesis key).
|
|
21
|
-
*
|
|
20
|
+
* the decode (for example, a did:btcr2 KEY identifier yields its genesis key). The
|
|
21
|
+
* optional `genesisDocument` mirrors the server transport's genesis-aware signature so a
|
|
22
|
+
* single injected resolver serves both; the client does not itself bootstrap senders.
|
|
23
|
+
* When omitted, sender resolution is limited to registered peers.
|
|
22
24
|
*/
|
|
23
|
-
resolveSenderPk?: (did: string
|
|
25
|
+
resolveSenderPk?: (did: string, opts?: {
|
|
26
|
+
genesisDocument?: object;
|
|
27
|
+
}) => CompressedSecp256k1PublicKey | undefined;
|
|
24
28
|
}
|
|
25
29
|
/** Default exponential backoff: 1s, 2s, 4s, ..., capped at 30s, 20% jitter. */
|
|
26
30
|
export declare function defaultReconnectBackoff(attempt: number): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../src/participant/http-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAYhF,MAAM,WAAW,yBAAyB;IACxC,oFAAoF;IACpF,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC;IACtB,oGAAoG;IACpG,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC;IAC/C,+DAA+D;IAC/D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../../src/participant/http-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAYhF,MAAM,WAAW,yBAAyB;IACx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AAW,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiC1F,gBAAgB,CACd,OAAO,EAAI,WAAW,EACtB,MAAM,EAAK,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,IAAI;CAkKd"}
|
|
@@ -46,6 +46,14 @@ export interface AggregationParticipantRunnerOptions {
|
|
|
46
46
|
* Default: approve.
|
|
47
47
|
*/
|
|
48
48
|
onApproveSigning?: OnApproveSigning;
|
|
49
|
+
/**
|
|
50
|
+
* The identity's genesis DID document. Required for an EXTERNAL (x1) did:btcr2 identifier
|
|
51
|
+
* so the service can bootstrap-authenticate this participant from a self-verifying opt-in;
|
|
52
|
+
* omitted for a KEY (k1) identifier. When present, `keys` MUST be the keypair of the
|
|
53
|
+
* genesis document's `capabilityInvocation[0]` verification method (see
|
|
54
|
+
* {@link AggregationParticipantParams.genesisDocument}).
|
|
55
|
+
*/
|
|
56
|
+
genesisDocument?: Record<string, unknown>;
|
|
49
57
|
}
|
|
50
58
|
/**
|
|
51
59
|
* High-level facade for an Aggregation Participant.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"participant-runner.d.ts","sourceRoot":"","sources":["../../../src/participant/participant-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAWzD,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,KAAK,EAAE,4BAA4B,EAAE,kBAAkB,EAAE,MAA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MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,4BAA6B,SAAQ,iBAAiB,CAAC,4BAA4B,CAAC;;IAC/F,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;gBAY7B,OAAO,EAAE,mCAAmC;IAgBxD;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,8EAA8E;IAC9E,IAAI,IAAI,IAAI;IA6BZ;;;;OAIG;WACU,SAAS,CACpB,OAAO,EAAE,mCAAmC,GAC3C,OAAO,CAAC,kBAAkB,CAAC;IAY9B;;;;;;;;;;;;;;;OAeG;WACU,YAAY,CACvB,OAAO,EAAE,mCAAmC,EAC5C,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,kBAAkB,EAAE,CAAC;CAiRjC"}
|
|
@@ -66,6 +66,17 @@ export interface AggregationParticipantParams {
|
|
|
66
66
|
* pass a {@link KeyPairAggregationSigner} to back it with an in-memory keypair.
|
|
67
67
|
*/
|
|
68
68
|
signer: AggregationSigner;
|
|
69
|
+
/**
|
|
70
|
+
* The joining identity's genesis DID document. Required for an EXTERNAL (x1) did:btcr2
|
|
71
|
+
* identifier, whose key is not in the DID string: it is attached to every cohort opt-in
|
|
72
|
+
* this participant sends so the service can bootstrap-authenticate the participant from
|
|
73
|
+
* the self-verifying genesis. Omitted for a KEY (k1) identifier. When present, the
|
|
74
|
+
* participant's `signer` MUST be the keypair of the genesis document's
|
|
75
|
+
* `capabilityInvocation[0]` verification method, so the advertised `communicationPk`
|
|
76
|
+
* matches the genesis-derived key the service verifies against. Typed as a plain record
|
|
77
|
+
* to keep the aggregation package DID-method-agnostic.
|
|
78
|
+
*/
|
|
79
|
+
genesisDocument?: Record<string, unknown>;
|
|
69
80
|
}
|
|
70
81
|
/**
|
|
71
82
|
* Sans-I/O state machine for an Aggregation Participant.
|
|
@@ -80,7 +91,7 @@ export interface AggregationParticipantParams {
|
|
|
80
91
|
export declare class AggregationParticipant {
|
|
81
92
|
#private;
|
|
82
93
|
readonly did: string;
|
|
83
|
-
constructor({ did, signer }: AggregationParticipantParams);
|
|
94
|
+
constructor({ did, signer, genesisDocument }: AggregationParticipantParams);
|
|
84
95
|
/** The participant's compressed (33-byte) MuSig2 public key. Not secret. */
|
|
85
96
|
get publicKey(): Uint8Array;
|
|
86
97
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"participant.d.ts","sourceRoot":"","sources":["../../../src/participant/participant.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAMxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAqB5D,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AA2B3D;;;;GAIG;AACH,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,EAAE,UAAU,CAAC;CACpC;AAED,mEAAmE;AACnE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAC/B;AAED,iFAAiF;AACjF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,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CAAC,MAAM,EAAE,qBAAqB,CAAC,CAQ9E;IAiDD;;OAEG;IACI,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE;IAqEpD;;;;OAIG;IACI,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE;IA+BhE,wFAAwF;IACxF,IAAW,uBAAuB,IAAI,WAAW,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAQhF;IAqCD;;;;;;OAMG;IACI,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE;IA8ChD,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,0BAA0B,GAAG,SAAS;IAI/E;;;;;OAKG;IACI,YAAY,IAAI,IAAI;CAK5B"}
|
|
@@ -64,13 +64,26 @@ export interface HttpServerTransportConfig {
|
|
|
64
64
|
heartbeatIntervalMs?: number;
|
|
65
65
|
/** Clock injection point for tests. Returns unix milliseconds. */
|
|
66
66
|
now?: () => number;
|
|
67
|
+
/**
|
|
68
|
+
* Maximum accepted request-body size for the authenticated POST routes, measured as the
|
|
69
|
+
* body string length. Bounds the work an unauthenticated party can force before the
|
|
70
|
+
* genesis-bootstrap hash check runs, so a large fake genesis cannot be parsed and hashed.
|
|
71
|
+
* A request larger than this receives 413 before its body is parsed. Default 65536 (64
|
|
72
|
+
* KiB), well above a real genesis document.
|
|
73
|
+
*/
|
|
74
|
+
maxBodyBytes?: number;
|
|
67
75
|
/**
|
|
68
76
|
* Resolve a sender's communication public key from its DID when the sender is not a
|
|
69
77
|
* registered peer. Lets the transport stay DID-method-agnostic: the caller supplies
|
|
70
|
-
* the decode (for example, a did:btcr2 KEY identifier yields its genesis key).
|
|
78
|
+
* the decode (for example, a did:btcr2 KEY identifier yields its genesis key). The
|
|
79
|
+
* optional `genesisDocument` is passed through on a bootstrap opt-in from an as-yet
|
|
80
|
+
* unregistered sender (for example a did:btcr2 EXTERNAL identifier, whose key is not in
|
|
81
|
+
* the DID string but is derivable from its self-verifying genesis document). When
|
|
71
82
|
* omitted, sender resolution is limited to registered peers.
|
|
72
83
|
*/
|
|
73
|
-
resolveSenderPk?: (did: string
|
|
84
|
+
resolveSenderPk?: (did: string, opts?: {
|
|
85
|
+
genesisDocument?: object;
|
|
86
|
+
}) => CompressedSecp256k1PublicKey | undefined;
|
|
74
87
|
}
|
|
75
88
|
/**
|
|
76
89
|
* Server-side HTTP transport. Sans-I/O - the caller mounts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-server.d.ts","sourceRoot":"","sources":["../../../src/service/http-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"http-server.d.ts","sourceRoot":"","sources":["../../../src/service/http-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAGlE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAIhF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQ9C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,UAAU,CAAC,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;;;;;;;;;OAUG;IACG,MAAM,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC;IA+E5C;;;;;;;;;;;;;OAaG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA6EtD;;;;OAIG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IASlC;;;;OAIG;IACH,IAAI,IAAI,IAAI;CAqTb"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@did-btcr2/aggregation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Multi-party coordination for did:btcr2 aggregate beacons: sans-I/O AggregationService and AggregationParticipant state machines, MuSig2 (BIP-327) signing sessions, cohort conditions, and pluggable transports (Nostr, HTTP, in-memory).",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -90,36 +90,30 @@
|
|
|
90
90
|
"@scure/btc-signer": "^1.8.1",
|
|
91
91
|
"nostr-tools": "^2.23.3",
|
|
92
92
|
"@did-btcr2/bitcoin": "^0.8.0",
|
|
93
|
-
"@did-btcr2/
|
|
93
|
+
"@did-btcr2/keypair": "^0.13.1",
|
|
94
94
|
"@did-btcr2/common": "^9.1.0",
|
|
95
|
-
"@did-btcr2/
|
|
96
|
-
"@did-btcr2/
|
|
95
|
+
"@did-btcr2/cryptosuite": "^9.0.0",
|
|
96
|
+
"@did-btcr2/smt": "^0.3.0"
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
99
|
"@eslint/js": "^9.20.0",
|
|
100
100
|
"@types/chai": "^5.0.1",
|
|
101
|
-
"@types/chai-as-promised": "^8.0.1",
|
|
102
|
-
"@types/eslint": "^9.6.1",
|
|
103
101
|
"@types/mocha": "^10.0.10",
|
|
104
102
|
"@types/node": "^22.13.4",
|
|
105
103
|
"@typescript-eslint/eslint-plugin": "^8.24.1",
|
|
106
104
|
"@typescript-eslint/parser": "^8.24.1",
|
|
107
105
|
"c8": "^10.1.3",
|
|
108
106
|
"chai": "^5.2.0",
|
|
109
|
-
"chai-as-promised": "^8.0.1",
|
|
110
107
|
"esbuild": "^0.25.0",
|
|
111
108
|
"eslint": "^9.20.1",
|
|
112
109
|
"eslint-plugin-mocha": "^10.5.0",
|
|
113
110
|
"globals": "^15.15.0",
|
|
114
111
|
"mocha": "^11.1.0",
|
|
115
|
-
"mocha-junit-reporter": "^2.2.1",
|
|
116
112
|
"node-stdlib-browser": "^1.3.1",
|
|
117
113
|
"rimraf": "^6.0.1",
|
|
118
114
|
"tsup": "^8.5.1",
|
|
119
|
-
"typedoc-plugin-markdown": "^4.7.0",
|
|
120
115
|
"typescript": "^5.7.3",
|
|
121
|
-
"
|
|
122
|
-
"@did-btcr2/method": "^0.41.0"
|
|
116
|
+
"@did-btcr2/method": "^0.51.0"
|
|
123
117
|
},
|
|
124
118
|
"scripts": {
|
|
125
119
|
"clean": "rimraf dist coverage tests/compiled",
|
|
@@ -34,6 +34,13 @@ export type BaseBody = Partial<CohortConditions> & {
|
|
|
34
34
|
prevOutValue?: string;
|
|
35
35
|
communicationPk?: Uint8Array;
|
|
36
36
|
data?: string;
|
|
37
|
+
/**
|
|
38
|
+
* An EXTERNAL (`x1`) sender's genesis DID document, carried in-band on a bootstrap
|
|
39
|
+
* opt-in so the service can derive and verify the sender's communication key before
|
|
40
|
+
* the sender is a registered peer. Omitted for KEY (`k1`) senders. Typed as a plain
|
|
41
|
+
* record to keep the transport DID-method-agnostic.
|
|
42
|
+
*/
|
|
43
|
+
genesisDocument?: Record<string, unknown>;
|
|
37
44
|
signedUpdate?: Record<string, unknown>;
|
|
38
45
|
casAnnouncement?: Record<string, string>;
|
|
39
46
|
smtProof?: Record<string, unknown>;
|
|
@@ -45,6 +45,12 @@ export interface CohortOptInBody {
|
|
|
45
45
|
cohortId: string;
|
|
46
46
|
participantPk: Uint8Array;
|
|
47
47
|
communicationPk: Uint8Array;
|
|
48
|
+
/**
|
|
49
|
+
* An EXTERNAL (`x1`) sender's genesis DID document, carried in-band so the service can
|
|
50
|
+
* bootstrap-verify the sender's communication key. Omitted for KEY (`k1`) senders;
|
|
51
|
+
* {@link isCohortOptInMessage} stays tolerant of its absence.
|
|
52
|
+
*/
|
|
53
|
+
genesisDocument?: Record<string, unknown>;
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
export interface CohortOptInAcceptBody {
|
|
@@ -34,6 +34,8 @@ type CohortOptInMessage = {
|
|
|
34
34
|
cohortId: string;
|
|
35
35
|
participantPk: Uint8Array;
|
|
36
36
|
communicationPk: Uint8Array;
|
|
37
|
+
/** An EXTERNAL (`x1`) sender's genesis DID document (see {@link CohortOptInBody}). */
|
|
38
|
+
genesisDocument?: Record<string, unknown>;
|
|
37
39
|
};
|
|
38
40
|
type CohortOptInAcceptMessage = {
|
|
39
41
|
from: string;
|
|
@@ -24,6 +24,10 @@ export class DidCommTransport implements Transport {
|
|
|
24
24
|
throw new NotImplementedError('DidCommTransport not implemented.');
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
// When implemented, this transport must authenticate an EXTERNAL (x1) did:btcr2 sender
|
|
28
|
+
// the same way the HTTP transport does: an x1 DID's key is not in the DID string, so it
|
|
29
|
+
// is derived from a self-verifying genesis document carried in-band on a bootstrap opt-in
|
|
30
|
+
// and registered here (see ADR 066).
|
|
27
31
|
public registerPeer(_did: string, _communicationPk: Uint8Array): void {
|
|
28
32
|
throw new NotImplementedError('DidCommTransport not implemented.');
|
|
29
33
|
}
|
|
@@ -30,10 +30,15 @@ export interface HttpClientTransportConfig {
|
|
|
30
30
|
/**
|
|
31
31
|
* Resolve a sender's communication public key from its DID when the sender is not a
|
|
32
32
|
* registered peer. Lets the transport stay DID-method-agnostic: the caller supplies
|
|
33
|
-
* the decode (for example, a did:btcr2 KEY identifier yields its genesis key).
|
|
34
|
-
*
|
|
33
|
+
* the decode (for example, a did:btcr2 KEY identifier yields its genesis key). The
|
|
34
|
+
* optional `genesisDocument` mirrors the server transport's genesis-aware signature so a
|
|
35
|
+
* single injected resolver serves both; the client does not itself bootstrap senders.
|
|
36
|
+
* When omitted, sender resolution is limited to registered peers.
|
|
35
37
|
*/
|
|
36
|
-
resolveSenderPk?: (
|
|
38
|
+
resolveSenderPk?: (
|
|
39
|
+
did: string,
|
|
40
|
+
opts?: { genesisDocument?: object },
|
|
41
|
+
) => CompressedSecp256k1PublicKey | undefined;
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
/** Default exponential backoff: 1s, 2s, 4s, ..., capped at 30s, 20% jitter. */
|
|
@@ -63,7 +68,10 @@ export class HttpClientTransport implements Transport {
|
|
|
63
68
|
readonly #logger: Logger;
|
|
64
69
|
readonly #backoff: (attempt: number) => number;
|
|
65
70
|
readonly #clockSkewSec: number;
|
|
66
|
-
readonly #resolveSenderPkFn?: (
|
|
71
|
+
readonly #resolveSenderPkFn?: (
|
|
72
|
+
did: string,
|
|
73
|
+
opts?: { genesisDocument?: object },
|
|
74
|
+
) => CompressedSecp256k1PublicKey | undefined;
|
|
67
75
|
|
|
68
76
|
readonly #actors: Map<string, ActorEntry> = new Map();
|
|
69
77
|
readonly #peers: Map<string, Uint8Array> = new Map();
|
|
@@ -362,13 +370,16 @@ export class HttpClientTransport implements Transport {
|
|
|
362
370
|
if(handler) await handler(flat);
|
|
363
371
|
}
|
|
364
372
|
|
|
365
|
-
#resolveSenderPk(
|
|
373
|
+
#resolveSenderPk(
|
|
374
|
+
did: string,
|
|
375
|
+
opts?: { genesisDocument?: object },
|
|
376
|
+
): CompressedSecp256k1PublicKey | undefined {
|
|
366
377
|
const peerBytes = this.#peers.get(did);
|
|
367
378
|
if(peerBytes) {
|
|
368
379
|
try { return new CompressedSecp256k1PublicKey(peerBytes); }
|
|
369
380
|
catch { /* fall through to the injected resolver */ }
|
|
370
381
|
}
|
|
371
|
-
return this.#resolveSenderPkFn?.(did);
|
|
382
|
+
return this.#resolveSenderPkFn?.(did, opts);
|
|
372
383
|
}
|
|
373
384
|
}
|
|
374
385
|
|
|
@@ -69,6 +69,15 @@ export interface AggregationParticipantRunnerOptions {
|
|
|
69
69
|
* Default: approve.
|
|
70
70
|
*/
|
|
71
71
|
onApproveSigning?: OnApproveSigning;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The identity's genesis DID document. Required for an EXTERNAL (x1) did:btcr2 identifier
|
|
75
|
+
* so the service can bootstrap-authenticate this participant from a self-verifying opt-in;
|
|
76
|
+
* omitted for a KEY (k1) identifier. When present, `keys` MUST be the keypair of the
|
|
77
|
+
* genesis document's `capabilityInvocation[0]` verification method (see
|
|
78
|
+
* {@link AggregationParticipantParams.genesisDocument}).
|
|
79
|
+
*/
|
|
80
|
+
genesisDocument?: Record<string, unknown>;
|
|
72
81
|
}
|
|
73
82
|
|
|
74
83
|
/**
|
|
@@ -131,8 +140,9 @@ export class AggregationParticipantRunner extends TypedEventEmitter<AggregationP
|
|
|
131
140
|
this.#onApproveSigning = options.onApproveSigning ?? (async () => ({ approved: true }));
|
|
132
141
|
|
|
133
142
|
this.session = new AggregationParticipant({
|
|
134
|
-
did
|
|
135
|
-
signer
|
|
143
|
+
did : options.did,
|
|
144
|
+
signer : new KeyPairAggregationSigner(options.keys),
|
|
145
|
+
genesisDocument : options.genesisDocument,
|
|
136
146
|
});
|
|
137
147
|
}
|
|
138
148
|
|
|
@@ -147,6 +147,17 @@ export interface AggregationParticipantParams {
|
|
|
147
147
|
* pass a {@link KeyPairAggregationSigner} to back it with an in-memory keypair.
|
|
148
148
|
*/
|
|
149
149
|
signer: AggregationSigner;
|
|
150
|
+
/**
|
|
151
|
+
* The joining identity's genesis DID document. Required for an EXTERNAL (x1) did:btcr2
|
|
152
|
+
* identifier, whose key is not in the DID string: it is attached to every cohort opt-in
|
|
153
|
+
* this participant sends so the service can bootstrap-authenticate the participant from
|
|
154
|
+
* the self-verifying genesis. Omitted for a KEY (k1) identifier. When present, the
|
|
155
|
+
* participant's `signer` MUST be the keypair of the genesis document's
|
|
156
|
+
* `capabilityInvocation[0]` verification method, so the advertised `communicationPk`
|
|
157
|
+
* matches the genesis-derived key the service verifies against. Typed as a plain record
|
|
158
|
+
* to keep the aggregation package DID-method-agnostic.
|
|
159
|
+
*/
|
|
160
|
+
genesisDocument?: Record<string, unknown>;
|
|
150
161
|
}
|
|
151
162
|
|
|
152
163
|
/**
|
|
@@ -165,12 +176,16 @@ export class AggregationParticipant {
|
|
|
165
176
|
/** MuSig2 signing capability. The raw secret never lives as a field here. */
|
|
166
177
|
readonly #signer: AggregationSigner;
|
|
167
178
|
|
|
179
|
+
/** EXTERNAL (x1) genesis document attached to opt-ins for bootstrap auth; undefined for k1. */
|
|
180
|
+
readonly #genesisDocument?: Record<string, unknown>;
|
|
181
|
+
|
|
168
182
|
/** Per-cohort state, keyed by cohortId. */
|
|
169
183
|
#cohortStates: Map<string, ParticipantCohortState> = new Map();
|
|
170
184
|
|
|
171
|
-
constructor({ did, signer }: AggregationParticipantParams) {
|
|
185
|
+
constructor({ did, signer, genesisDocument }: AggregationParticipantParams) {
|
|
172
186
|
this.did = did;
|
|
173
187
|
this.#signer = signer;
|
|
188
|
+
this.#genesisDocument = genesisDocument;
|
|
174
189
|
}
|
|
175
190
|
|
|
176
191
|
/** The participant's compressed (33-byte) MuSig2 public key. Not secret. */
|
|
@@ -289,6 +304,9 @@ export class AggregationParticipant {
|
|
|
289
304
|
cohortId,
|
|
290
305
|
participantPk : this.publicKey,
|
|
291
306
|
communicationPk : this.publicKey,
|
|
307
|
+
// Attach the genesis so an EXTERNAL (x1) sender can be bootstrap-authenticated by
|
|
308
|
+
// the service; omitted for a KEY (k1) sender.
|
|
309
|
+
...(this.#genesisDocument ? { genesisDocument: this.#genesisDocument } : {}),
|
|
292
310
|
});
|
|
293
311
|
|
|
294
312
|
return [optInMessage];
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { SchnorrKeyPair } from '@did-btcr2/keypair';
|
|
2
2
|
import { CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
|
|
3
|
+
import { equalBytes } from '@noble/curves/utils.js';
|
|
3
4
|
|
|
4
5
|
import type { Logger } from '../core/logger.js';
|
|
5
6
|
import { CONSOLE_LOGGER } from '../core/logger.js';
|
|
6
7
|
import type { BaseMessage } from '../core/messages/base.js';
|
|
8
|
+
import { COHORT_OPT_IN } from '../core/messages/constants.js';
|
|
7
9
|
import type { MessageHandler, Transport } from '../core/transport/transport.js';
|
|
8
10
|
import { reviveFromWire, signEnvelope, verifyEnvelope } from '../core/transport/http/envelope.js';
|
|
9
11
|
import { HttpTransportError } from '../core/transport/http/errors.js';
|
|
@@ -78,13 +80,27 @@ export interface HttpServerTransportConfig {
|
|
|
78
80
|
heartbeatIntervalMs?: number;
|
|
79
81
|
/** Clock injection point for tests. Returns unix milliseconds. */
|
|
80
82
|
now?: () => number;
|
|
83
|
+
/**
|
|
84
|
+
* Maximum accepted request-body size for the authenticated POST routes, measured as the
|
|
85
|
+
* body string length. Bounds the work an unauthenticated party can force before the
|
|
86
|
+
* genesis-bootstrap hash check runs, so a large fake genesis cannot be parsed and hashed.
|
|
87
|
+
* A request larger than this receives 413 before its body is parsed. Default 65536 (64
|
|
88
|
+
* KiB), well above a real genesis document.
|
|
89
|
+
*/
|
|
90
|
+
maxBodyBytes?: number;
|
|
81
91
|
/**
|
|
82
92
|
* Resolve a sender's communication public key from its DID when the sender is not a
|
|
83
93
|
* registered peer. Lets the transport stay DID-method-agnostic: the caller supplies
|
|
84
|
-
* the decode (for example, a did:btcr2 KEY identifier yields its genesis key).
|
|
94
|
+
* the decode (for example, a did:btcr2 KEY identifier yields its genesis key). The
|
|
95
|
+
* optional `genesisDocument` is passed through on a bootstrap opt-in from an as-yet
|
|
96
|
+
* unregistered sender (for example a did:btcr2 EXTERNAL identifier, whose key is not in
|
|
97
|
+
* the DID string but is derivable from its self-verifying genesis document). When
|
|
85
98
|
* omitted, sender resolution is limited to registered peers.
|
|
86
99
|
*/
|
|
87
|
-
resolveSenderPk?: (
|
|
100
|
+
resolveSenderPk?: (
|
|
101
|
+
did: string,
|
|
102
|
+
opts?: { genesisDocument?: object },
|
|
103
|
+
) => CompressedSecp256k1PublicKey | undefined;
|
|
88
104
|
}
|
|
89
105
|
|
|
90
106
|
interface ActorEntry {
|
|
@@ -118,6 +134,7 @@ const INBOX_PATH_SUFFIX = '/inbox';
|
|
|
118
134
|
|
|
119
135
|
const DEFAULT_ADVERT_TTL_MS = 5 * 60 * 1000;
|
|
120
136
|
const DEFAULT_HEARTBEAT_MS = 20_000;
|
|
137
|
+
const DEFAULT_MAX_BODY_BYTES = 64 * 1024;
|
|
121
138
|
|
|
122
139
|
/**
|
|
123
140
|
* Server-side HTTP transport. Sans-I/O - the caller mounts
|
|
@@ -141,7 +158,11 @@ export class HttpServerTransport implements Transport {
|
|
|
141
158
|
readonly #rateLimiter: RateLimiter;
|
|
142
159
|
readonly #nonceCache: NonceCache;
|
|
143
160
|
readonly #now: () => number;
|
|
144
|
-
readonly #
|
|
161
|
+
readonly #maxBodyBytes: number;
|
|
162
|
+
readonly #resolveSenderPkFn?: (
|
|
163
|
+
did: string,
|
|
164
|
+
opts?: { genesisDocument?: object },
|
|
165
|
+
) => CompressedSecp256k1PublicKey | undefined;
|
|
145
166
|
|
|
146
167
|
readonly #actors: Map<string, ActorEntry> = new Map();
|
|
147
168
|
readonly #peers: Map<string, Uint8Array> = new Map();
|
|
@@ -162,6 +183,7 @@ export class HttpServerTransport implements Transport {
|
|
|
162
183
|
this.#rateLimiter = config.rateLimiter ?? new RateLimiter();
|
|
163
184
|
this.#nonceCache = config.nonceCache ?? new NonceCache();
|
|
164
185
|
this.#now = config.now ?? (() => Date.now());
|
|
186
|
+
this.#maxBodyBytes = config.maxBodyBytes ?? DEFAULT_MAX_BODY_BYTES;
|
|
165
187
|
this.#resolveSenderPkFn = config.resolveSenderPk;
|
|
166
188
|
}
|
|
167
189
|
|
|
@@ -343,19 +365,31 @@ export class HttpServerTransport implements Transport {
|
|
|
343
365
|
// ----------------------------------------------------------------
|
|
344
366
|
|
|
345
367
|
async #handleMessagesPost(req: HttpRequestLike): Promise<HttpResponseLike> {
|
|
368
|
+
const tooLarge = this.#enforceBodySize(req);
|
|
369
|
+
if(tooLarge) return tooLarge;
|
|
370
|
+
|
|
346
371
|
const envelope = parseJsonBody<SignedEnvelope>(req.body);
|
|
347
372
|
if(!envelope) return this.#respondJson(400, { error: 'invalid_json' }, req);
|
|
348
373
|
|
|
349
374
|
const senderPk = this.#resolveSenderPk(envelope.from);
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
375
|
+
let bootstrappedPk: CompressedSecp256k1PublicKey | undefined;
|
|
376
|
+
if(senderPk) {
|
|
377
|
+
try {
|
|
378
|
+
verifyEnvelope(envelope, senderPk, { clockSkewSec: this.#clockSkewSec });
|
|
379
|
+
} catch(err) {
|
|
380
|
+
this.#logger.debug('POST /v1/messages: envelope verification failed:', err);
|
|
381
|
+
return this.#respondJson(401, { error: 'invalid_envelope' }, req);
|
|
382
|
+
}
|
|
383
|
+
} else {
|
|
384
|
+
// The sender is not a registered peer and its DID does not decode to a key on its
|
|
385
|
+
// own (an EXTERNAL x1 DID commits to a genesis-document hash, not a key). The only
|
|
386
|
+
// way to authenticate is a self-verifying bootstrap opt-in carrying that genesis
|
|
387
|
+
// document; #bootstrapSenderPk derives the key, cross-checks the advertised
|
|
388
|
+
// communicationPk, and verifies the envelope. The derived key is not registered
|
|
389
|
+
// until the request clears every gate below (there is no trust-on-first-use, and a
|
|
390
|
+
// request that is later rejected leaves no peer-registry state behind).
|
|
391
|
+
bootstrappedPk = this.#bootstrapSenderPk(envelope);
|
|
392
|
+
if(!bootstrappedPk) return this.#respondJson(401, { error: 'unknown_sender' }, req);
|
|
359
393
|
}
|
|
360
394
|
|
|
361
395
|
if(!this.#nonceCache.store(envelope.from, envelope.nonce, envelope.timestamp)) {
|
|
@@ -376,6 +410,24 @@ export class HttpServerTransport implements Transport {
|
|
|
376
410
|
|
|
377
411
|
const revived = reviveFromWire(envelope.message) as Record<string, unknown>;
|
|
378
412
|
const flat = flattenMessage(revived);
|
|
413
|
+
|
|
414
|
+
// Bind the inner message to the authenticated envelope: a sender may only speak as
|
|
415
|
+
// itself. The envelope signature authenticates envelope.from, but the dispatched
|
|
416
|
+
// message carries its own `from` that the runner trusts (it registers a peer and
|
|
417
|
+
// records an opt-in under message.from). Without this check a sender authenticated as
|
|
418
|
+
// its own DID could carry an inner message claiming a different `from`, spoofing that
|
|
419
|
+
// DID into the cohort and poisoning the peer registry for it.
|
|
420
|
+
if(flat.from !== envelope.from) {
|
|
421
|
+
return this.#respondJson(401, { error: 'sender_mismatch' }, req);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
// The request has cleared every gate; only now register a bootstrapped x1 peer, so its
|
|
425
|
+
// later messages resolve from the registry without re-deriving from the genesis. This
|
|
426
|
+
// is the sole point that mutates peer state, and only for a fully-validated request.
|
|
427
|
+
if(bootstrappedPk) {
|
|
428
|
+
this.registerPeer(envelope.from, bootstrappedPk.compressed);
|
|
429
|
+
}
|
|
430
|
+
|
|
379
431
|
const messageType = typeof flat.type === 'string' ? flat.type : undefined;
|
|
380
432
|
if(!messageType) return this.#respondJson(400, { error: 'missing_message_type' }, req);
|
|
381
433
|
|
|
@@ -390,6 +442,9 @@ export class HttpServerTransport implements Transport {
|
|
|
390
442
|
}
|
|
391
443
|
|
|
392
444
|
async #handleAdvertsPost(req: HttpRequestLike): Promise<HttpResponseLike> {
|
|
445
|
+
const tooLarge = this.#enforceBodySize(req);
|
|
446
|
+
if(tooLarge) return tooLarge;
|
|
447
|
+
|
|
393
448
|
const envelope = parseJsonBody<SignedEnvelope>(req.body);
|
|
394
449
|
if(!envelope) return this.#respondJson(400, { error: 'invalid_json' }, req);
|
|
395
450
|
|
|
@@ -516,13 +571,70 @@ export class HttpServerTransport implements Transport {
|
|
|
516
571
|
return inbox;
|
|
517
572
|
}
|
|
518
573
|
|
|
519
|
-
#resolveSenderPk(
|
|
574
|
+
#resolveSenderPk(
|
|
575
|
+
did: string,
|
|
576
|
+
opts?: { genesisDocument?: object },
|
|
577
|
+
): CompressedSecp256k1PublicKey | undefined {
|
|
520
578
|
const peerBytes = this.#peers.get(did);
|
|
521
579
|
if(peerBytes) {
|
|
522
580
|
try { return new CompressedSecp256k1PublicKey(peerBytes); }
|
|
523
581
|
catch { /* fall through to the injected resolver */ }
|
|
524
582
|
}
|
|
525
|
-
return this.#resolveSenderPkFn?.(did);
|
|
583
|
+
return this.#resolveSenderPkFn?.(did, opts);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Bootstrap-authenticate a sender that {@link #resolveSenderPk} could not resolve, from a
|
|
588
|
+
* self-verifying COHORT_OPT_IN. An EXTERNAL (x1) did:btcr2 DID commits to the hash of its
|
|
589
|
+
* genesis document, so a genesis carried in-band on the opt-in authenticates the sender's
|
|
590
|
+
* communication key with zero trust. This derives the key through the injected
|
|
591
|
+
* genesis-aware resolver (which rejects a genesis that does not hash to the DID),
|
|
592
|
+
* cross-checks it against the advertised `communicationPk` (so a controller cannot
|
|
593
|
+
* authenticate with one key while advertising another), and verifies the envelope
|
|
594
|
+
* signature against it. Returns the derived key on success, or `undefined` on any
|
|
595
|
+
* failure. It performs no registration and mutates no state: the caller registers the
|
|
596
|
+
* returned key only after the request clears its remaining gates (there is no
|
|
597
|
+
* trust-on-first-use).
|
|
598
|
+
*/
|
|
599
|
+
#bootstrapSenderPk(envelope: SignedEnvelope): CompressedSecp256k1PublicKey | undefined {
|
|
600
|
+
if(!this.#resolveSenderPkFn) return undefined;
|
|
601
|
+
|
|
602
|
+
// Inspect the still-untrusted message only to derive a candidate key; nothing is
|
|
603
|
+
// trusted until the envelope verifies against that key below.
|
|
604
|
+
const flat = flattenMessage(reviveFromWire(envelope.message) as Record<string, unknown>);
|
|
605
|
+
if(flat.type !== COHORT_OPT_IN) return undefined;
|
|
606
|
+
|
|
607
|
+
const genesisDocument = flat.genesisDocument;
|
|
608
|
+
if(!genesisDocument || typeof genesisDocument !== 'object') return undefined;
|
|
609
|
+
|
|
610
|
+
const derived = this.#resolveSenderPkFn(envelope.from, { genesisDocument: genesisDocument as object });
|
|
611
|
+
if(!derived) return undefined;
|
|
612
|
+
|
|
613
|
+
const communicationPk = flat.communicationPk;
|
|
614
|
+
if(!(communicationPk instanceof Uint8Array) || !equalBytes(communicationPk, derived.compressed)) {
|
|
615
|
+
return undefined;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
try {
|
|
619
|
+
verifyEnvelope(envelope, derived, { clockSkewSec: this.#clockSkewSec });
|
|
620
|
+
} catch(err) {
|
|
621
|
+
this.#logger.debug('POST /v1/messages: bootstrap envelope verification failed:', err);
|
|
622
|
+
return undefined;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
return derived;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Reject an over-large request body before it is parsed, so a large fake genesis cannot be
|
|
630
|
+
* parsed and hashed. Returns a 413 response when the body exceeds {@link #maxBodyBytes},
|
|
631
|
+
* or `undefined` to continue.
|
|
632
|
+
*/
|
|
633
|
+
#enforceBodySize(req: HttpRequestLike): HttpResponseLike | undefined {
|
|
634
|
+
if(req.body !== undefined && req.body.length > this.#maxBodyBytes) {
|
|
635
|
+
return this.#respondJson(413, { error: 'payload_too_large' }, req);
|
|
636
|
+
}
|
|
637
|
+
return undefined;
|
|
526
638
|
}
|
|
527
639
|
|
|
528
640
|
#safeWrite(stream: SseStream, event: string, data: string, id?: string): void {
|