@did-btcr2/method 0.38.0 → 0.40.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/.tsbuildinfo +1 -1
- package/dist/browser.js +24918 -35517
- package/dist/browser.mjs +24918 -35517
- package/dist/cjs/index.js +403 -6066
- package/dist/esm/core/beacon/fee-estimator.js +6 -29
- package/dist/esm/core/beacon/fee-estimator.js.map +1 -1
- package/dist/esm/core/did-sender-resolver.js +26 -0
- package/dist/esm/core/did-sender-resolver.js.map +1 -0
- package/dist/esm/index.js +1 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/types/core/beacon/fee-estimator.d.ts +4 -39
- package/dist/types/core/beacon/fee-estimator.d.ts.map +1 -1
- package/dist/types/core/did-sender-resolver.d.ts +14 -0
- package/dist/types/core/did-sender-resolver.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -16
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/core/beacon/fee-estimator.ts +8 -51
- package/src/core/did-sender-resolver.ts +25 -0
- package/src/index.ts +1 -18
- package/dist/esm/core/aggregation/beacon-strategy.js +0 -76
- package/dist/esm/core/aggregation/beacon-strategy.js.map +0 -1
- package/dist/esm/core/aggregation/cohort.js +0 -316
- package/dist/esm/core/aggregation/cohort.js.map +0 -1
- package/dist/esm/core/aggregation/conditions.js +0 -102
- package/dist/esm/core/aggregation/conditions.js.map +0 -1
- package/dist/esm/core/aggregation/errors.js +0 -22
- package/dist/esm/core/aggregation/errors.js.map +0 -1
- package/dist/esm/core/aggregation/fallback-spend.js +0 -132
- package/dist/esm/core/aggregation/fallback-spend.js.map +0 -1
- package/dist/esm/core/aggregation/logger.js +0 -15
- package/dist/esm/core/aggregation/logger.js.map +0 -1
- package/dist/esm/core/aggregation/messages/base.js +0 -36
- package/dist/esm/core/aggregation/messages/base.js.map +0 -1
- package/dist/esm/core/aggregation/messages/bodies.js +0 -149
- package/dist/esm/core/aggregation/messages/bodies.js.map +0 -1
- package/dist/esm/core/aggregation/messages/constants.js +0 -37
- package/dist/esm/core/aggregation/messages/constants.js.map +0 -1
- package/dist/esm/core/aggregation/messages/factories.js +0 -139
- package/dist/esm/core/aggregation/messages/factories.js.map +0 -1
- package/dist/esm/core/aggregation/messages/guards.js +0 -40
- package/dist/esm/core/aggregation/messages/guards.js.map +0 -1
- package/dist/esm/core/aggregation/messages/index.js +0 -6
- package/dist/esm/core/aggregation/messages/index.js.map +0 -1
- package/dist/esm/core/aggregation/participant.js +0 -588
- package/dist/esm/core/aggregation/participant.js.map +0 -1
- package/dist/esm/core/aggregation/phases.js +0 -45
- package/dist/esm/core/aggregation/phases.js.map +0 -1
- package/dist/esm/core/aggregation/recovery-policy.js +0 -156
- package/dist/esm/core/aggregation/recovery-policy.js.map +0 -1
- package/dist/esm/core/aggregation/recovery-spend.js +0 -106
- package/dist/esm/core/aggregation/recovery-spend.js.map +0 -1
- package/dist/esm/core/aggregation/runner/aggregation-runner.js +0 -75
- package/dist/esm/core/aggregation/runner/aggregation-runner.js.map +0 -1
- package/dist/esm/core/aggregation/runner/events.js +0 -2
- package/dist/esm/core/aggregation/runner/events.js.map +0 -1
- package/dist/esm/core/aggregation/runner/index.js +0 -6
- package/dist/esm/core/aggregation/runner/index.js.map +0 -1
- package/dist/esm/core/aggregation/runner/participant-runner.js +0 -407
- package/dist/esm/core/aggregation/runner/participant-runner.js.map +0 -1
- package/dist/esm/core/aggregation/runner/service-runner.js +0 -699
- package/dist/esm/core/aggregation/runner/service-runner.js.map +0 -1
- package/dist/esm/core/aggregation/runner/typed-emitter.js +0 -80
- package/dist/esm/core/aggregation/runner/typed-emitter.js.map +0 -1
- package/dist/esm/core/aggregation/service.js +0 -774
- package/dist/esm/core/aggregation/service.js.map +0 -1
- package/dist/esm/core/aggregation/signer.js +0 -33
- package/dist/esm/core/aggregation/signer.js.map +0 -1
- package/dist/esm/core/aggregation/signing-session.js +0 -195
- package/dist/esm/core/aggregation/signing-session.js.map +0 -1
- package/dist/esm/core/aggregation/transport/didcomm.js +0 -41
- package/dist/esm/core/aggregation/transport/didcomm.js.map +0 -1
- package/dist/esm/core/aggregation/transport/error.js +0 -12
- package/dist/esm/core/aggregation/transport/error.js.map +0 -1
- package/dist/esm/core/aggregation/transport/factory.js +0 -29
- package/dist/esm/core/aggregation/transport/factory.js.map +0 -1
- package/dist/esm/core/aggregation/transport/http/client.js +0 -350
- package/dist/esm/core/aggregation/transport/http/client.js.map +0 -1
- package/dist/esm/core/aggregation/transport/http/envelope.js +0 -126
- package/dist/esm/core/aggregation/transport/http/envelope.js.map +0 -1
- package/dist/esm/core/aggregation/transport/http/errors.js +0 -11
- package/dist/esm/core/aggregation/transport/http/errors.js.map +0 -1
- package/dist/esm/core/aggregation/transport/http/inbox-buffer.js +0 -45
- package/dist/esm/core/aggregation/transport/http/inbox-buffer.js.map +0 -1
- package/dist/esm/core/aggregation/transport/http/index.js +0 -12
- package/dist/esm/core/aggregation/transport/http/index.js.map +0 -1
- package/dist/esm/core/aggregation/transport/http/nonce-cache.js +0 -38
- package/dist/esm/core/aggregation/transport/http/nonce-cache.js.map +0 -1
- package/dist/esm/core/aggregation/transport/http/protocol.js +0 -28
- package/dist/esm/core/aggregation/transport/http/protocol.js.map +0 -1
- package/dist/esm/core/aggregation/transport/http/rate-limiter.js +0 -45
- package/dist/esm/core/aggregation/transport/http/rate-limiter.js.map +0 -1
- package/dist/esm/core/aggregation/transport/http/request-auth.js +0 -100
- package/dist/esm/core/aggregation/transport/http/request-auth.js.map +0 -1
- package/dist/esm/core/aggregation/transport/http/server.js +0 -481
- package/dist/esm/core/aggregation/transport/http/server.js.map +0 -1
- package/dist/esm/core/aggregation/transport/http/sse-stream.js +0 -110
- package/dist/esm/core/aggregation/transport/http/sse-stream.js.map +0 -1
- package/dist/esm/core/aggregation/transport/http/sse-writer.js +0 -25
- package/dist/esm/core/aggregation/transport/http/sse-writer.js.map +0 -1
- package/dist/esm/core/aggregation/transport/in-memory.js +0 -149
- package/dist/esm/core/aggregation/transport/in-memory.js.map +0 -1
- package/dist/esm/core/aggregation/transport/index.js +0 -8
- package/dist/esm/core/aggregation/transport/index.js.map +0 -1
- package/dist/esm/core/aggregation/transport/nostr.js +0 -491
- package/dist/esm/core/aggregation/transport/nostr.js.map +0 -1
- package/dist/esm/core/aggregation/transport/transport.js +0 -2
- package/dist/esm/core/aggregation/transport/transport.js.map +0 -1
- package/dist/types/core/aggregation/beacon-strategy.d.ts +0 -56
- package/dist/types/core/aggregation/beacon-strategy.d.ts.map +0 -1
- package/dist/types/core/aggregation/cohort.d.ts +0 -182
- package/dist/types/core/aggregation/cohort.d.ts.map +0 -1
- package/dist/types/core/aggregation/conditions.d.ts +0 -86
- package/dist/types/core/aggregation/conditions.d.ts.map +0 -1
- package/dist/types/core/aggregation/errors.d.ts +0 -14
- package/dist/types/core/aggregation/errors.d.ts.map +0 -1
- package/dist/types/core/aggregation/fallback-spend.d.ts +0 -94
- package/dist/types/core/aggregation/fallback-spend.d.ts.map +0 -1
- package/dist/types/core/aggregation/logger.d.ts +0 -22
- package/dist/types/core/aggregation/logger.d.ts.map +0 -1
- package/dist/types/core/aggregation/messages/base.d.ts +0 -58
- package/dist/types/core/aggregation/messages/base.d.ts.map +0 -1
- package/dist/types/core/aggregation/messages/bodies.d.ts +0 -177
- package/dist/types/core/aggregation/messages/bodies.d.ts.map +0 -1
- package/dist/types/core/aggregation/messages/constants.d.ts +0 -31
- package/dist/types/core/aggregation/messages/constants.d.ts.map +0 -1
- package/dist/types/core/aggregation/messages/factories.d.ts +0 -217
- package/dist/types/core/aggregation/messages/factories.d.ts.map +0 -1
- package/dist/types/core/aggregation/messages/guards.d.ts +0 -11
- package/dist/types/core/aggregation/messages/guards.d.ts.map +0 -1
- package/dist/types/core/aggregation/messages/index.d.ts +0 -6
- package/dist/types/core/aggregation/messages/index.d.ts.map +0 -1
- package/dist/types/core/aggregation/participant.d.ts +0 -162
- package/dist/types/core/aggregation/participant.d.ts.map +0 -1
- package/dist/types/core/aggregation/phases.d.ts +0 -55
- package/dist/types/core/aggregation/phases.d.ts.map +0 -1
- package/dist/types/core/aggregation/recovery-policy.d.ts +0 -132
- package/dist/types/core/aggregation/recovery-policy.d.ts.map +0 -1
- package/dist/types/core/aggregation/recovery-spend.d.ts +0 -94
- package/dist/types/core/aggregation/recovery-spend.d.ts.map +0 -1
- package/dist/types/core/aggregation/runner/aggregation-runner.d.ts +0 -72
- package/dist/types/core/aggregation/runner/aggregation-runner.d.ts.map +0 -1
- package/dist/types/core/aggregation/runner/events.d.ts +0 -147
- package/dist/types/core/aggregation/runner/events.d.ts.map +0 -1
- package/dist/types/core/aggregation/runner/index.d.ts +0 -6
- package/dist/types/core/aggregation/runner/index.d.ts.map +0 -1
- package/dist/types/core/aggregation/runner/participant-runner.d.ts +0 -122
- package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +0 -1
- package/dist/types/core/aggregation/runner/service-runner.d.ts +0 -228
- package/dist/types/core/aggregation/runner/service-runner.d.ts.map +0 -1
- package/dist/types/core/aggregation/runner/typed-emitter.d.ts +0 -41
- package/dist/types/core/aggregation/runner/typed-emitter.d.ts.map +0 -1
- package/dist/types/core/aggregation/service.d.ts +0 -177
- package/dist/types/core/aggregation/service.d.ts.map +0 -1
- package/dist/types/core/aggregation/signer.d.ts +0 -50
- package/dist/types/core/aggregation/signer.d.ts.map +0 -1
- package/dist/types/core/aggregation/signing-session.d.ts +0 -81
- package/dist/types/core/aggregation/signing-session.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/didcomm.d.ts +0 -23
- package/dist/types/core/aggregation/transport/didcomm.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/error.d.ts +0 -8
- package/dist/types/core/aggregation/transport/error.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/factory.d.ts +0 -28
- package/dist/types/core/aggregation/transport/factory.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/http/client.d.ts +0 -48
- package/dist/types/core/aggregation/transport/http/client.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/http/envelope.d.ts +0 -64
- package/dist/types/core/aggregation/transport/http/envelope.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/http/errors.d.ts +0 -9
- package/dist/types/core/aggregation/transport/http/errors.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/http/inbox-buffer.d.ts +0 -32
- package/dist/types/core/aggregation/transport/http/inbox-buffer.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/http/index.d.ts +0 -12
- package/dist/types/core/aggregation/transport/http/index.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/http/nonce-cache.d.ts +0 -26
- package/dist/types/core/aggregation/transport/http/nonce-cache.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/http/protocol.d.ts +0 -53
- package/dist/types/core/aggregation/transport/http/protocol.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/http/rate-limiter.d.ts +0 -41
- package/dist/types/core/aggregation/transport/http/rate-limiter.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/http/request-auth.d.ts +0 -50
- package/dist/types/core/aggregation/transport/http/request-auth.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/http/server.d.ts +0 -110
- package/dist/types/core/aggregation/transport/http/server.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/http/sse-stream.d.ts +0 -34
- package/dist/types/core/aggregation/transport/http/sse-stream.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/http/sse-writer.d.ts +0 -12
- package/dist/types/core/aggregation/transport/http/sse-writer.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/in-memory.d.ts +0 -64
- package/dist/types/core/aggregation/transport/in-memory.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/index.d.ts +0 -8
- package/dist/types/core/aggregation/transport/index.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/nostr.d.ts +0 -153
- package/dist/types/core/aggregation/transport/nostr.d.ts.map +0 -1
- package/dist/types/core/aggregation/transport/transport.d.ts +0 -62
- package/dist/types/core/aggregation/transport/transport.d.ts.map +0 -1
- package/src/core/aggregation/beacon-strategy.ts +0 -142
- package/src/core/aggregation/cohort.ts +0 -415
- package/src/core/aggregation/conditions.ts +0 -172
- package/src/core/aggregation/errors.ts +0 -25
- package/src/core/aggregation/fallback-spend.ts +0 -223
- package/src/core/aggregation/logger.ts +0 -33
- package/src/core/aggregation/messages/base.ts +0 -80
- package/src/core/aggregation/messages/bodies.ts +0 -328
- package/src/core/aggregation/messages/constants.ts +0 -40
- package/src/core/aggregation/messages/factories.ts +0 -297
- package/src/core/aggregation/messages/guards.ts +0 -61
- package/src/core/aggregation/messages/index.ts +0 -5
- package/src/core/aggregation/participant.ts +0 -779
- package/src/core/aggregation/phases.ts +0 -91
- package/src/core/aggregation/recovery-policy.ts +0 -237
- package/src/core/aggregation/recovery-spend.ts +0 -192
- package/src/core/aggregation/runner/aggregation-runner.ts +0 -125
- package/src/core/aggregation/runner/events.ts +0 -129
- package/src/core/aggregation/runner/index.ts +0 -5
- package/src/core/aggregation/runner/participant-runner.ts +0 -488
- package/src/core/aggregation/runner/service-runner.ts +0 -888
- package/src/core/aggregation/runner/typed-emitter.ts +0 -87
- package/src/core/aggregation/service.ts +0 -1000
- package/src/core/aggregation/signer.ts +0 -67
- package/src/core/aggregation/signing-session.ts +0 -290
- package/src/core/aggregation/transport/didcomm.ts +0 -59
- package/src/core/aggregation/transport/error.ts +0 -13
- package/src/core/aggregation/transport/factory.ts +0 -65
- package/src/core/aggregation/transport/http/client.ts +0 -409
- package/src/core/aggregation/transport/http/envelope.ts +0 -204
- package/src/core/aggregation/transport/http/errors.ts +0 -11
- package/src/core/aggregation/transport/http/inbox-buffer.ts +0 -53
- package/src/core/aggregation/transport/http/index.ts +0 -11
- package/src/core/aggregation/transport/http/nonce-cache.ts +0 -43
- package/src/core/aggregation/transport/http/protocol.ts +0 -57
- package/src/core/aggregation/transport/http/rate-limiter.ts +0 -75
- package/src/core/aggregation/transport/http/request-auth.ts +0 -164
- package/src/core/aggregation/transport/http/server.ts +0 -615
- package/src/core/aggregation/transport/http/sse-stream.ts +0 -121
- package/src/core/aggregation/transport/http/sse-writer.ts +0 -23
- package/src/core/aggregation/transport/in-memory.ts +0 -178
- package/src/core/aggregation/transport/index.ts +0 -7
- package/src/core/aggregation/transport/nostr.ts +0 -576
- package/src/core/aggregation/transport/transport.ts +0 -79
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* - Environments where a fee rate is supplied out-of-band
|
|
8
|
-
*
|
|
9
|
-
* For mainnet production use, prefer a dynamic estimator that queries current
|
|
10
|
-
* network conditions (mempool APIs, Bitcoin Core RPC).
|
|
11
|
-
*/
|
|
12
|
-
export class StaticFeeEstimator {
|
|
13
|
-
satsPerVbyte;
|
|
14
|
-
/**
|
|
15
|
-
* @param satsPerVbyte Fee rate in satoshis per virtual byte. Default: 5 sat/vB.
|
|
16
|
-
*/
|
|
17
|
-
constructor(satsPerVbyte = 5) {
|
|
18
|
-
if (satsPerVbyte < 0 || !Number.isFinite(satsPerVbyte)) {
|
|
19
|
-
throw new Error(`Invalid satsPerVbyte: ${satsPerVbyte}`);
|
|
20
|
-
}
|
|
21
|
-
this.satsPerVbyte = satsPerVbyte;
|
|
22
|
-
}
|
|
23
|
-
async estimateFee(vsize) {
|
|
24
|
-
if (vsize < 0 || !Number.isFinite(vsize)) {
|
|
25
|
-
throw new Error(`Invalid vsize: ${vsize}`);
|
|
26
|
-
}
|
|
27
|
-
return BigInt(Math.ceil(vsize * this.satsPerVbyte));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
// The FeeEstimator contract and the StaticFeeEstimator implementation live in
|
|
2
|
+
// @did-btcr2/bitcoin, the natural home for a sat/vB fee primitive shared by the
|
|
3
|
+
// single-party and aggregated beacon broadcast paths. They are re-exported here so
|
|
4
|
+
// the @did-btcr2/method public surface is unchanged.
|
|
5
|
+
import { StaticFeeEstimator } from '@did-btcr2/bitcoin';
|
|
6
|
+
export { StaticFeeEstimator };
|
|
30
7
|
/**
|
|
31
8
|
* Default fee estimator used when a caller supplies none: a static 5 sat/vB rate.
|
|
32
9
|
* Suitable for tests and regtest. Production callers should inject a dynamic
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee-estimator.js","sourceRoot":"","sources":["../../../../src/core/beacon/fee-estimator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fee-estimator.js","sourceRoot":"","sources":["../../../../src/core/beacon/fee-estimator.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,gFAAgF;AAChF,mFAAmF;AACnF,qDAAqD;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAG9B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAiB,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
|
|
2
|
+
import { Identifier } from './identifier.js';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a did:btcr2 sender's communication public key from its DID, for the
|
|
5
|
+
* aggregation HTTP transport's `resolveSenderPk` option: a KEY identifier decodes to
|
|
6
|
+
* its genesis public key. The aggregation transport is DID-method-agnostic and does
|
|
7
|
+
* not name `Identifier`; method supplies this resolver when it wires the transport so
|
|
8
|
+
* a sender that is not a pre-registered peer can still be authenticated from its DID.
|
|
9
|
+
*
|
|
10
|
+
* @param did The sender's DID.
|
|
11
|
+
* @returns The sender's compressed public key, or `undefined` when the DID is not a
|
|
12
|
+
* decodable did:btcr2 KEY identifier (resolution then falls back to registered peers).
|
|
13
|
+
*/
|
|
14
|
+
export function resolveBtcr2SenderPk(did) {
|
|
15
|
+
try {
|
|
16
|
+
const components = Identifier.decode(did);
|
|
17
|
+
if (components.idType === 'KEY') {
|
|
18
|
+
return new CompressedSecp256k1PublicKey(components.genesisBytes);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Not a decodable did:btcr2 KEY identifier.
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=did-sender-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-sender-resolver.js","sourceRoot":"","sources":["../../../src/core/did-sender-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1C,IAAG,UAAU,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YAC/B,OAAO,IAAI,4BAA4B,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,4CAA4C;IAC9C,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
// Aggregation
|
|
2
|
-
export * from './core/aggregation/service.js';
|
|
3
|
-
export * from './core/aggregation/participant.js';
|
|
4
|
-
export * from './core/aggregation/signer.js';
|
|
5
|
-
export * from './core/aggregation/conditions.js';
|
|
6
|
-
export * from './core/aggregation/recovery-policy.js';
|
|
7
|
-
export * from './core/aggregation/recovery-spend.js';
|
|
8
|
-
export * from './core/aggregation/fallback-spend.js';
|
|
9
|
-
export * from './core/aggregation/cohort.js';
|
|
10
|
-
export * from './core/aggregation/signing-session.js';
|
|
11
|
-
export * from './core/aggregation/phases.js';
|
|
12
|
-
export * from './core/aggregation/errors.js';
|
|
13
|
-
export * from './core/aggregation/beacon-strategy.js';
|
|
14
|
-
export * from './core/aggregation/logger.js';
|
|
15
|
-
export * from './core/aggregation/messages/index.js';
|
|
16
|
-
export * from './core/aggregation/transport/index.js';
|
|
17
|
-
export * from './core/aggregation/runner/index.js';
|
|
18
1
|
// Beacons
|
|
19
2
|
export * from './core/beacon/beacon.js';
|
|
20
3
|
export * from './core/beacon/cas-beacon.js';
|
|
@@ -27,6 +10,7 @@ export * from './core/beacon/singleton-beacon.js';
|
|
|
27
10
|
export * from './core/beacon/smt-beacon.js';
|
|
28
11
|
export * from './core/beacon/utils.js';
|
|
29
12
|
// Core
|
|
13
|
+
export * from './core/did-sender-resolver.js';
|
|
30
14
|
export * from './core/identifier.js';
|
|
31
15
|
export * from './core/interfaces.js';
|
|
32
16
|
export * from './core/resolver.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AAEvC,OAAO;AACP,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAElC,QAAQ;AACR,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AAExC,SAAS;AACT,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,42 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* plug in different strategies: static fee rates for tests/regtest, mempool
|
|
6
|
-
* APIs for mainnet, Bitcoin Core `estimatesmartfee` RPC for full-node setups,
|
|
7
|
-
* etc.
|
|
8
|
-
*
|
|
9
|
-
* Implementations return the **total fee in satoshis** for a transaction of
|
|
10
|
-
* the given virtual size (`vsize`). Callers pass the vsize; the estimator
|
|
11
|
-
* decides the fee rate and computes the total.
|
|
12
|
-
*/
|
|
13
|
-
export interface FeeEstimator {
|
|
14
|
-
/**
|
|
15
|
-
* Estimate the total fee in satoshis for a transaction of the given vsize.
|
|
16
|
-
* @param vsize Transaction virtual size in vbytes.
|
|
17
|
-
* @returns Total fee in satoshis.
|
|
18
|
-
*/
|
|
19
|
-
estimateFee(vsize: number): Promise<bigint>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Fee estimator that returns a fixed fee rate regardless of network conditions.
|
|
23
|
-
*
|
|
24
|
-
* Suitable for:
|
|
25
|
-
* - Tests (deterministic outputs)
|
|
26
|
-
* - Regtest (no real fee market)
|
|
27
|
-
* - Environments where a fee rate is supplied out-of-band
|
|
28
|
-
*
|
|
29
|
-
* For mainnet production use, prefer a dynamic estimator that queries current
|
|
30
|
-
* network conditions (mempool APIs, Bitcoin Core RPC).
|
|
31
|
-
*/
|
|
32
|
-
export declare class StaticFeeEstimator implements FeeEstimator {
|
|
33
|
-
readonly satsPerVbyte: number;
|
|
34
|
-
/**
|
|
35
|
-
* @param satsPerVbyte Fee rate in satoshis per virtual byte. Default: 5 sat/vB.
|
|
36
|
-
*/
|
|
37
|
-
constructor(satsPerVbyte?: number);
|
|
38
|
-
estimateFee(vsize: number): Promise<bigint>;
|
|
39
|
-
}
|
|
1
|
+
import { StaticFeeEstimator } from '@did-btcr2/bitcoin';
|
|
2
|
+
import type { FeeEstimator } from '@did-btcr2/bitcoin';
|
|
3
|
+
export { StaticFeeEstimator };
|
|
4
|
+
export type { FeeEstimator };
|
|
40
5
|
/**
|
|
41
6
|
* Default fee estimator used when a caller supplies none: a static 5 sat/vB rate.
|
|
42
7
|
* Suitable for tests and regtest. Production callers should inject a dynamic
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee-estimator.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/fee-estimator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fee-estimator.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/fee-estimator.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAC9B,YAAY,EAAE,YAAY,EAAE,CAAC;AAE7B;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,YAAwC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a did:btcr2 sender's communication public key from its DID, for the
|
|
4
|
+
* aggregation HTTP transport's `resolveSenderPk` option: a KEY identifier decodes to
|
|
5
|
+
* its genesis public key. The aggregation transport is DID-method-agnostic and does
|
|
6
|
+
* not name `Identifier`; method supplies this resolver when it wires the transport so
|
|
7
|
+
* a sender that is not a pre-registered peer can still be authenticated from its DID.
|
|
8
|
+
*
|
|
9
|
+
* @param did The sender's DID.
|
|
10
|
+
* @returns The sender's compressed public key, or `undefined` when the DID is not a
|
|
11
|
+
* decodable did:btcr2 KEY identifier (resolution then falls back to registered peers).
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveBtcr2SenderPk(did: string): CompressedSecp256k1PublicKey | undefined;
|
|
14
|
+
//# sourceMappingURL=did-sender-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"did-sender-resolver.d.ts","sourceRoot":"","sources":["../../../src/core/did-sender-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAGlE;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,4BAA4B,GAAG,SAAS,CAU1F"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
export * from './core/aggregation/service.js';
|
|
2
|
-
export * from './core/aggregation/participant.js';
|
|
3
|
-
export * from './core/aggregation/signer.js';
|
|
4
|
-
export * from './core/aggregation/conditions.js';
|
|
5
|
-
export * from './core/aggregation/recovery-policy.js';
|
|
6
|
-
export * from './core/aggregation/recovery-spend.js';
|
|
7
|
-
export * from './core/aggregation/fallback-spend.js';
|
|
8
|
-
export * from './core/aggregation/cohort.js';
|
|
9
|
-
export * from './core/aggregation/signing-session.js';
|
|
10
|
-
export * from './core/aggregation/phases.js';
|
|
11
|
-
export * from './core/aggregation/errors.js';
|
|
12
|
-
export * from './core/aggregation/beacon-strategy.js';
|
|
13
|
-
export * from './core/aggregation/logger.js';
|
|
14
|
-
export * from './core/aggregation/messages/index.js';
|
|
15
|
-
export * from './core/aggregation/transport/index.js';
|
|
16
|
-
export * from './core/aggregation/runner/index.js';
|
|
17
1
|
export * from './core/beacon/beacon.js';
|
|
18
2
|
export * from './core/beacon/cas-beacon.js';
|
|
19
3
|
export * from './core/beacon/error.js';
|
|
@@ -24,6 +8,7 @@ export * from './core/beacon/signal-discovery.js';
|
|
|
24
8
|
export * from './core/beacon/singleton-beacon.js';
|
|
25
9
|
export * from './core/beacon/smt-beacon.js';
|
|
26
10
|
export * from './core/beacon/utils.js';
|
|
11
|
+
export * from './core/did-sender-resolver.js';
|
|
27
12
|
export * from './core/identifier.js';
|
|
28
13
|
export * from './core/interfaces.js';
|
|
29
14
|
export * from './core/resolver.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AAGvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAGlC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,yBAAyB,CAAC;AAGxC,cAAc,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@did-btcr2/method",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Reference implementation for the did:btcr2 DID method written in TypeScript and JavaScript. did:btcr2 is a censorship resistant DID Method using the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the DID document. This is the core method implementation for the did-btcr2-js monorepo.",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -80,11 +80,11 @@
|
|
|
80
80
|
"helia": "^5.5.1",
|
|
81
81
|
"multiformats": "^13.4.2",
|
|
82
82
|
"nostr-tools": "^2.23.3",
|
|
83
|
+
"@did-btcr2/bitcoin": "^0.7.0",
|
|
83
84
|
"@did-btcr2/cryptosuite": "^8.0.0",
|
|
85
|
+
"@did-btcr2/keypair": "^0.13.1",
|
|
84
86
|
"@did-btcr2/common": "^9.1.0",
|
|
85
|
-
"@did-btcr2/
|
|
86
|
-
"@did-btcr2/smt": "^0.3.0",
|
|
87
|
-
"@did-btcr2/keypair": "^0.13.1"
|
|
87
|
+
"@did-btcr2/smt": "^0.3.0"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@eslint/js": "^9.39.4",
|
|
@@ -1,55 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* etc.
|
|
8
|
-
*
|
|
9
|
-
* Implementations return the **total fee in satoshis** for a transaction of
|
|
10
|
-
* the given virtual size (`vsize`). Callers pass the vsize; the estimator
|
|
11
|
-
* decides the fee rate and computes the total.
|
|
12
|
-
*/
|
|
13
|
-
export interface FeeEstimator {
|
|
14
|
-
/**
|
|
15
|
-
* Estimate the total fee in satoshis for a transaction of the given vsize.
|
|
16
|
-
* @param vsize Transaction virtual size in vbytes.
|
|
17
|
-
* @returns Total fee in satoshis.
|
|
18
|
-
*/
|
|
19
|
-
estimateFee(vsize: number): Promise<bigint>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Fee estimator that returns a fixed fee rate regardless of network conditions.
|
|
24
|
-
*
|
|
25
|
-
* Suitable for:
|
|
26
|
-
* - Tests (deterministic outputs)
|
|
27
|
-
* - Regtest (no real fee market)
|
|
28
|
-
* - Environments where a fee rate is supplied out-of-band
|
|
29
|
-
*
|
|
30
|
-
* For mainnet production use, prefer a dynamic estimator that queries current
|
|
31
|
-
* network conditions (mempool APIs, Bitcoin Core RPC).
|
|
32
|
-
*/
|
|
33
|
-
export class StaticFeeEstimator implements FeeEstimator {
|
|
34
|
-
readonly satsPerVbyte: number;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @param satsPerVbyte Fee rate in satoshis per virtual byte. Default: 5 sat/vB.
|
|
38
|
-
*/
|
|
39
|
-
constructor(satsPerVbyte: number = 5) {
|
|
40
|
-
if(satsPerVbyte < 0 || !Number.isFinite(satsPerVbyte)) {
|
|
41
|
-
throw new Error(`Invalid satsPerVbyte: ${satsPerVbyte}`);
|
|
42
|
-
}
|
|
43
|
-
this.satsPerVbyte = satsPerVbyte;
|
|
44
|
-
}
|
|
1
|
+
// The FeeEstimator contract and the StaticFeeEstimator implementation live in
|
|
2
|
+
// @did-btcr2/bitcoin, the natural home for a sat/vB fee primitive shared by the
|
|
3
|
+
// single-party and aggregated beacon broadcast paths. They are re-exported here so
|
|
4
|
+
// the @did-btcr2/method public surface is unchanged.
|
|
5
|
+
import { StaticFeeEstimator } from '@did-btcr2/bitcoin';
|
|
6
|
+
import type { FeeEstimator } from '@did-btcr2/bitcoin';
|
|
45
7
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
throw new Error(`Invalid vsize: ${vsize}`);
|
|
49
|
-
}
|
|
50
|
-
return BigInt(Math.ceil(vsize * this.satsPerVbyte));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
8
|
+
export { StaticFeeEstimator };
|
|
9
|
+
export type { FeeEstimator };
|
|
53
10
|
|
|
54
11
|
/**
|
|
55
12
|
* Default fee estimator used when a caller supplies none: a static 5 sat/vB rate.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
|
|
2
|
+
import { Identifier } from './identifier.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Resolve a did:btcr2 sender's communication public key from its DID, for the
|
|
6
|
+
* aggregation HTTP transport's `resolveSenderPk` option: a KEY identifier decodes to
|
|
7
|
+
* its genesis public key. The aggregation transport is DID-method-agnostic and does
|
|
8
|
+
* not name `Identifier`; method supplies this resolver when it wires the transport so
|
|
9
|
+
* a sender that is not a pre-registered peer can still be authenticated from its DID.
|
|
10
|
+
*
|
|
11
|
+
* @param did The sender's DID.
|
|
12
|
+
* @returns The sender's compressed public key, or `undefined` when the DID is not a
|
|
13
|
+
* decodable did:btcr2 KEY identifier (resolution then falls back to registered peers).
|
|
14
|
+
*/
|
|
15
|
+
export function resolveBtcr2SenderPk(did: string): CompressedSecp256k1PublicKey | undefined {
|
|
16
|
+
try {
|
|
17
|
+
const components = Identifier.decode(did);
|
|
18
|
+
if(components.idType === 'KEY') {
|
|
19
|
+
return new CompressedSecp256k1PublicKey(components.genesisBytes);
|
|
20
|
+
}
|
|
21
|
+
} catch {
|
|
22
|
+
// Not a decodable did:btcr2 KEY identifier.
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
// Aggregation
|
|
2
|
-
export * from './core/aggregation/service.js';
|
|
3
|
-
export * from './core/aggregation/participant.js';
|
|
4
|
-
export * from './core/aggregation/signer.js';
|
|
5
|
-
export * from './core/aggregation/conditions.js';
|
|
6
|
-
export * from './core/aggregation/recovery-policy.js';
|
|
7
|
-
export * from './core/aggregation/recovery-spend.js';
|
|
8
|
-
export * from './core/aggregation/fallback-spend.js';
|
|
9
|
-
export * from './core/aggregation/cohort.js';
|
|
10
|
-
export * from './core/aggregation/signing-session.js';
|
|
11
|
-
export * from './core/aggregation/phases.js';
|
|
12
|
-
export * from './core/aggregation/errors.js';
|
|
13
|
-
export * from './core/aggregation/beacon-strategy.js';
|
|
14
|
-
export * from './core/aggregation/logger.js';
|
|
15
|
-
export * from './core/aggregation/messages/index.js';
|
|
16
|
-
export * from './core/aggregation/transport/index.js';
|
|
17
|
-
export * from './core/aggregation/runner/index.js';
|
|
18
|
-
|
|
19
1
|
// Beacons
|
|
20
2
|
export * from './core/beacon/beacon.js';
|
|
21
3
|
export * from './core/beacon/cas-beacon.js';
|
|
@@ -29,6 +11,7 @@ export * from './core/beacon/smt-beacon.js';
|
|
|
29
11
|
export * from './core/beacon/utils.js';
|
|
30
12
|
|
|
31
13
|
// Core
|
|
14
|
+
export * from './core/did-sender-resolver.js';
|
|
32
15
|
export * from './core/identifier.js';
|
|
33
16
|
export * from './core/interfaces.js';
|
|
34
17
|
export * from './core/resolver.js';
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { canonicalize } from '@did-btcr2/common';
|
|
2
|
-
import { base64UrlToHash, blockHash, didToIndex, hashToBase64Url, verifySerializedProof } from '@did-btcr2/smt';
|
|
3
|
-
const CAS_STRATEGY = {
|
|
4
|
-
type: 'CASBeacon',
|
|
5
|
-
buildAggregatedData(cohort) {
|
|
6
|
-
cohort.buildCASAnnouncement();
|
|
7
|
-
},
|
|
8
|
-
getDistributePayload(cohort) {
|
|
9
|
-
return { casAnnouncement: cohort.casAnnouncement };
|
|
10
|
-
},
|
|
11
|
-
validateParticipantView({ participantDid, included, expectedHash, body }) {
|
|
12
|
-
const casAnnouncement = body.casAnnouncement;
|
|
13
|
-
if (!casAnnouncement)
|
|
14
|
-
return { matches: false };
|
|
15
|
-
if (!included) {
|
|
16
|
-
// Cooperative non-inclusion: the decliner must be ABSENT from the map.
|
|
17
|
-
return { matches: !(participantDid in casAnnouncement), casAnnouncement };
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
matches: casAnnouncement[participantDid] === expectedHash,
|
|
21
|
-
casAnnouncement,
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
const SMT_STRATEGY = {
|
|
26
|
-
type: 'SMTBeacon',
|
|
27
|
-
buildAggregatedData(cohort) {
|
|
28
|
-
cohort.buildSMTTree();
|
|
29
|
-
},
|
|
30
|
-
getDistributePayload(cohort, participantDid) {
|
|
31
|
-
const proof = cohort.smtProofs?.get(participantDid);
|
|
32
|
-
return { smtProof: proof };
|
|
33
|
-
},
|
|
34
|
-
validateParticipantView({ participantDid, included, submittedUpdate, body }) {
|
|
35
|
-
const smtProof = body.smtProof;
|
|
36
|
-
const index = didToIndex(participantDid);
|
|
37
|
-
if (!included) {
|
|
38
|
-
// Cooperative non-inclusion: the proof has a nonce but no updateId by
|
|
39
|
-
// construction. The leaf is SHA-256(SHA-256(nonce)); do NOT run the
|
|
40
|
-
// inclusion-only updateId guard (a missing updateId is correct here).
|
|
41
|
-
if (!smtProof?.nonce || smtProof?.updateId)
|
|
42
|
-
return { matches: false, smtProof };
|
|
43
|
-
const candidateHash = blockHash(blockHash(base64UrlToHash(smtProof.nonce)));
|
|
44
|
-
return { matches: verifySerializedProof(smtProof, index, candidateHash), smtProof };
|
|
45
|
-
}
|
|
46
|
-
if (!smtProof?.updateId || !smtProof?.nonce || !submittedUpdate)
|
|
47
|
-
return { matches: false, smtProof };
|
|
48
|
-
// Verify updateId matches the canonicalized update hash. Proof hash fields
|
|
49
|
-
// are base64url (no padding) per the SMT Proof spec.
|
|
50
|
-
const canonicalBytes = new TextEncoder().encode(canonicalize(submittedUpdate));
|
|
51
|
-
const expectedUpdateId = hashToBase64Url(blockHash(canonicalBytes));
|
|
52
|
-
if (smtProof.updateId !== expectedUpdateId) {
|
|
53
|
-
return { matches: false, smtProof };
|
|
54
|
-
}
|
|
55
|
-
// Verify Merkle inclusion. The leaf is SHA-256(SHA-256(nonce) || SHA-256(update)).
|
|
56
|
-
const candidateHash = blockHash(blockHash(base64UrlToHash(smtProof.nonce)), base64UrlToHash(smtProof.updateId));
|
|
57
|
-
return {
|
|
58
|
-
matches: verifySerializedProof(smtProof, index, candidateHash),
|
|
59
|
-
smtProof,
|
|
60
|
-
};
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
/** Registered strategies keyed by `beaconType` string. */
|
|
64
|
-
const STRATEGIES = new Map([
|
|
65
|
-
[CAS_STRATEGY.type, CAS_STRATEGY],
|
|
66
|
-
[SMT_STRATEGY.type, SMT_STRATEGY],
|
|
67
|
-
]);
|
|
68
|
-
/** Register a custom beacon strategy. Overwrites any existing entry with the same type. */
|
|
69
|
-
export function registerBeaconStrategy(strategy) {
|
|
70
|
-
STRATEGIES.set(strategy.type, strategy);
|
|
71
|
-
}
|
|
72
|
-
/** Look up a registered beacon strategy by type, or undefined if not registered. */
|
|
73
|
-
export function getBeaconStrategy(type) {
|
|
74
|
-
return STRATEGIES.get(type);
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=beacon-strategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"beacon-strategy.js","sourceRoot":"","sources":["../../../../src/core/aggregation/beacon-strategy.ts"],"names":[],"mappings":"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"}
|