@did-btcr2/method 0.26.0 → 0.28.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 +118 -236
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser.js +27665 -23764
- package/dist/browser.mjs +27665 -23764
- package/dist/cjs/index.js +2661 -2239
- package/dist/esm/core/aggregation/cohort.js +178 -0
- package/dist/esm/core/aggregation/cohort.js.map +1 -0
- package/dist/esm/core/aggregation/errors.js +22 -0
- package/dist/esm/core/aggregation/errors.js.map +1 -0
- package/dist/esm/core/{beacon/aggregation/cohort → aggregation}/messages/base.js +0 -1
- package/dist/esm/core/aggregation/messages/base.js.map +1 -0
- package/dist/esm/core/aggregation/messages/constants.js +26 -0
- package/dist/esm/core/aggregation/messages/constants.js.map +1 -0
- package/dist/esm/core/aggregation/messages/factories.js +113 -0
- package/dist/esm/core/aggregation/messages/factories.js.map +1 -0
- package/dist/esm/core/aggregation/messages/guards.js +37 -0
- package/dist/esm/core/aggregation/messages/guards.js.map +1 -0
- package/dist/esm/core/aggregation/messages/index.js +5 -0
- package/dist/esm/core/aggregation/messages/index.js.map +1 -0
- package/dist/esm/core/aggregation/participant.js +376 -0
- package/dist/esm/core/aggregation/participant.js.map +1 -0
- package/dist/esm/core/aggregation/phases.js +39 -0
- package/dist/esm/core/aggregation/phases.js.map +1 -0
- package/dist/esm/core/aggregation/runner/events.js +2 -0
- package/dist/esm/core/aggregation/runner/events.js.map +1 -0
- package/dist/esm/core/aggregation/runner/index.js +5 -0
- package/dist/esm/core/aggregation/runner/index.js.map +1 -0
- package/dist/esm/core/aggregation/runner/participant-runner.js +286 -0
- package/dist/esm/core/aggregation/runner/participant-runner.js.map +1 -0
- package/dist/esm/core/aggregation/runner/service-runner.js +290 -0
- package/dist/esm/core/aggregation/runner/service-runner.js.map +1 -0
- package/dist/esm/core/aggregation/runner/typed-emitter.js +80 -0
- package/dist/esm/core/aggregation/runner/typed-emitter.js.map +1 -0
- package/dist/esm/core/aggregation/service.js +416 -0
- package/dist/esm/core/aggregation/service.js.map +1 -0
- package/dist/esm/core/aggregation/signing-session.js +133 -0
- package/dist/esm/core/aggregation/signing-session.js.map +1 -0
- package/dist/esm/core/aggregation/transport/didcomm.js +32 -0
- package/dist/esm/core/aggregation/transport/didcomm.js.map +1 -0
- package/dist/esm/core/aggregation/transport/error.js +12 -0
- package/dist/esm/core/aggregation/transport/error.js.map +1 -0
- package/dist/esm/core/aggregation/transport/factory.js +20 -0
- package/dist/esm/core/aggregation/transport/factory.js.map +1 -0
- package/dist/esm/core/aggregation/transport/index.js +6 -0
- package/dist/esm/core/aggregation/transport/index.js.map +1 -0
- package/dist/esm/core/aggregation/transport/nostr.js +262 -0
- package/dist/esm/core/aggregation/transport/nostr.js.map +1 -0
- package/dist/esm/core/aggregation/transport/transport.js +2 -0
- package/dist/esm/core/aggregation/transport/transport.js.map +1 -0
- package/dist/esm/core/beacon/beacon.js +80 -0
- package/dist/esm/core/beacon/beacon.js.map +1 -1
- package/dist/esm/core/beacon/cas-beacon.js +15 -56
- package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
- package/dist/esm/core/beacon/error.js +0 -10
- package/dist/esm/core/beacon/error.js.map +1 -1
- package/dist/esm/core/beacon/fee-estimator.js +30 -0
- package/dist/esm/core/beacon/fee-estimator.js.map +1 -0
- package/dist/esm/core/beacon/singleton-beacon.js +10 -53
- package/dist/esm/core/beacon/singleton-beacon.js.map +1 -1
- package/dist/esm/core/beacon/smt-beacon.js +85 -9
- package/dist/esm/core/beacon/smt-beacon.js.map +1 -1
- package/dist/esm/core/identifier.js +13 -0
- package/dist/esm/core/identifier.js.map +1 -1
- package/dist/esm/core/resolver.js +9 -0
- package/dist/esm/core/resolver.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 -42
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/index.js +16 -25
- package/dist/esm/index.js.map +1 -1
- package/dist/types/core/aggregation/cohort.d.ts +94 -0
- package/dist/types/core/aggregation/cohort.d.ts.map +1 -0
- package/dist/types/core/aggregation/errors.d.ts +14 -0
- package/dist/types/core/aggregation/errors.d.ts.map +1 -0
- package/dist/types/core/{beacon/aggregation/cohort → aggregation}/messages/base.d.ts +7 -1
- package/dist/types/core/aggregation/messages/base.d.ts.map +1 -0
- package/dist/types/core/aggregation/messages/constants.d.ts +23 -0
- package/dist/types/core/aggregation/messages/constants.d.ts.map +1 -0
- package/dist/types/core/aggregation/messages/factories.d.ts +177 -0
- package/dist/types/core/aggregation/messages/factories.d.ts.map +1 -0
- package/dist/types/core/aggregation/messages/guards.d.ts +11 -0
- package/dist/types/core/aggregation/messages/guards.d.ts.map +1 -0
- package/dist/types/core/aggregation/messages/index.d.ts +5 -0
- package/dist/types/core/aggregation/messages/index.d.ts.map +1 -0
- package/dist/types/core/aggregation/participant.d.ts +101 -0
- package/dist/types/core/aggregation/participant.d.ts.map +1 -0
- package/dist/types/core/aggregation/phases.d.ts +49 -0
- package/dist/types/core/aggregation/phases.d.ts.map +1 -0
- package/dist/types/core/aggregation/runner/events.d.ts +89 -0
- package/dist/types/core/aggregation/runner/events.d.ts.map +1 -0
- package/dist/types/core/aggregation/runner/index.d.ts +5 -0
- package/dist/types/core/aggregation/runner/index.d.ts.map +1 -0
- package/dist/types/core/aggregation/runner/participant-runner.d.ts +111 -0
- package/dist/types/core/aggregation/runner/participant-runner.d.ts.map +1 -0
- package/dist/types/core/aggregation/runner/service-runner.d.ts +102 -0
- package/dist/types/core/aggregation/runner/service-runner.d.ts.map +1 -0
- package/dist/types/core/aggregation/runner/typed-emitter.d.ts +41 -0
- package/dist/types/core/aggregation/runner/typed-emitter.d.ts.map +1 -0
- package/dist/types/core/aggregation/service.d.ts +112 -0
- package/dist/types/core/aggregation/service.d.ts.map +1 -0
- package/dist/types/core/aggregation/signing-session.d.ts +69 -0
- package/dist/types/core/aggregation/signing-session.d.ts.map +1 -0
- package/dist/types/core/aggregation/transport/didcomm.d.ts +20 -0
- package/dist/types/core/aggregation/transport/didcomm.d.ts.map +1 -0
- package/dist/types/core/{beacon/aggregation/communication → aggregation/transport}/error.d.ts +2 -2
- package/dist/types/core/aggregation/transport/error.d.ts.map +1 -0
- package/dist/types/core/aggregation/transport/factory.d.ts +13 -0
- package/dist/types/core/aggregation/transport/factory.d.ts.map +1 -0
- package/dist/types/core/aggregation/transport/index.d.ts +6 -0
- package/dist/types/core/aggregation/transport/index.d.ts.map +1 -0
- package/dist/types/core/aggregation/transport/nostr.d.ts +55 -0
- package/dist/types/core/aggregation/transport/nostr.d.ts.map +1 -0
- package/dist/types/core/aggregation/transport/transport.d.ts +37 -0
- package/dist/types/core/aggregation/transport/transport.d.ts.map +1 -0
- package/dist/types/core/beacon/beacon.d.ts +37 -2
- package/dist/types/core/beacon/beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/cas-beacon.d.ts +19 -7
- package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/error.d.ts +0 -6
- package/dist/types/core/beacon/error.d.ts.map +1 -1
- package/dist/types/core/beacon/fee-estimator.d.ts +40 -0
- package/dist/types/core/beacon/fee-estimator.d.ts.map +1 -0
- package/dist/types/core/beacon/interfaces.d.ts +8 -0
- package/dist/types/core/beacon/interfaces.d.ts.map +1 -1
- package/dist/types/core/beacon/singleton-beacon.d.ts +9 -2
- package/dist/types/core/beacon/singleton-beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/smt-beacon.d.ts +27 -7
- package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -1
- package/dist/types/core/identifier.d.ts +8 -0
- package/dist/types/core/identifier.d.ts.map +1 -1
- package/dist/types/core/interfaces.d.ts +2 -2
- package/dist/types/core/resolver.d.ts +11 -1
- package/dist/types/core/resolver.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 +11 -25
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +31 -30
- package/src/core/aggregation/cohort.ts +247 -0
- package/src/core/aggregation/errors.ts +25 -0
- package/src/core/{beacon/aggregation/cohort → aggregation}/messages/base.ts +8 -3
- package/src/core/aggregation/messages/constants.ts +28 -0
- package/src/core/aggregation/messages/factories.ts +240 -0
- package/src/core/aggregation/messages/guards.ts +55 -0
- package/src/core/aggregation/messages/index.ts +4 -0
- package/src/core/aggregation/participant.ts +510 -0
- package/src/core/aggregation/phases.ts +82 -0
- package/src/core/aggregation/runner/events.ts +77 -0
- package/src/core/aggregation/runner/index.ts +4 -0
- package/src/core/aggregation/runner/participant-runner.ts +364 -0
- package/src/core/aggregation/runner/service-runner.ts +365 -0
- package/src/core/aggregation/runner/typed-emitter.ts +87 -0
- package/src/core/aggregation/service.ts +547 -0
- package/src/core/aggregation/signing-session.ts +209 -0
- package/src/core/aggregation/transport/didcomm.ts +42 -0
- package/src/core/aggregation/transport/error.ts +13 -0
- package/src/core/aggregation/transport/factory.ts +29 -0
- package/src/core/aggregation/transport/index.ts +5 -0
- package/src/core/aggregation/transport/nostr.ts +333 -0
- package/src/core/aggregation/transport/transport.ts +46 -0
- package/src/core/beacon/beacon.ts +122 -2
- package/src/core/beacon/cas-beacon.ts +28 -76
- package/src/core/beacon/error.ts +0 -12
- package/src/core/beacon/fee-estimator.ts +52 -0
- package/src/core/beacon/interfaces.ts +10 -1
- package/src/core/beacon/singleton-beacon.ts +14 -75
- package/src/core/beacon/smt-beacon.ts +109 -11
- package/src/core/identifier.ts +17 -0
- package/src/core/interfaces.ts +2 -2
- package/src/core/resolver.ts +25 -2
- package/src/core/updater.ts +415 -0
- package/src/did-btcr2.ts +36 -66
- package/src/index.ts +17 -30
- package/dist/esm/core/beacon/aggregation/cohort/index.js +0 -237
- package/dist/esm/core/beacon/aggregation/cohort/index.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/constants.js +0 -11
- package/dist/esm/core/beacon/aggregation/cohort/messages/constants.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/index.js +0 -98
- package/dist/esm/core/beacon/aggregation/cohort/messages/index.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +0 -31
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +0 -29
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +0 -27
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +0 -23
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +0 -28
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +0 -29
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +0 -30
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +0 -30
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +0 -30
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +0 -31
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/cohort/status.js +0 -8
- package/dist/esm/core/beacon/aggregation/cohort/status.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js +0 -121
- package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +0 -245
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/communication/error.js +0 -12
- package/dist/esm/core/beacon/aggregation/communication/error.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/communication/factory.js +0 -21
- package/dist/esm/core/beacon/aggregation/communication/factory.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/communication/service.js +0 -2
- package/dist/esm/core/beacon/aggregation/communication/service.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/coordinator.js +0 -343
- package/dist/esm/core/beacon/aggregation/coordinator.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/participant.js +0 -435
- package/dist/esm/core/beacon/aggregation/participant.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/session/index.js +0 -244
- package/dist/esm/core/beacon/aggregation/session/index.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/session/status.js +0 -11
- package/dist/esm/core/beacon/aggregation/session/status.js.map +0 -1
- package/dist/esm/core/update.js +0 -112
- package/dist/esm/core/update.js.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/index.d.ts +0 -136
- package/dist/types/core/beacon/aggregation/cohort/index.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts +0 -11
- package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts +0 -65
- package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts +0 -29
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts +0 -26
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts +0 -24
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts +0 -20
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts +0 -25
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts +0 -25
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts +0 -26
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts +0 -26
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts +0 -26
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts +0 -27
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/cohort/status.d.ts +0 -8
- package/dist/types/core/beacon/aggregation/cohort/status.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts +0 -89
- package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +0 -103
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/communication/error.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/communication/factory.d.ts +0 -10
- package/dist/types/core/beacon/aggregation/communication/factory.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/communication/service.d.ts +0 -36
- package/dist/types/core/beacon/aggregation/communication/service.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/coordinator.d.ts +0 -116
- package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/participant.d.ts +0 -192
- package/dist/types/core/beacon/aggregation/participant.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/session/index.d.ts +0 -156
- package/dist/types/core/beacon/aggregation/session/index.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/session/status.d.ts +0 -11
- package/dist/types/core/beacon/aggregation/session/status.d.ts.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/beacon/aggregation/cohort/index.ts +0 -305
- package/src/core/beacon/aggregation/cohort/messages/constants.ts +0 -12
- package/src/core/beacon/aggregation/cohort/messages/index.ts +0 -143
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +0 -44
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +0 -40
- package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +0 -35
- package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +0 -34
- package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +0 -36
- package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +0 -39
- package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +0 -40
- package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +0 -40
- package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +0 -40
- package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +0 -41
- package/src/core/beacon/aggregation/cohort/status.ts +0 -7
- package/src/core/beacon/aggregation/communication/adapter/did-comm.ts +0 -148
- package/src/core/beacon/aggregation/communication/adapter/nostr.ts +0 -323
- package/src/core/beacon/aggregation/communication/error.ts +0 -13
- package/src/core/beacon/aggregation/communication/factory.ts +0 -25
- package/src/core/beacon/aggregation/communication/service.ts +0 -42
- package/src/core/beacon/aggregation/coordinator.ts +0 -419
- package/src/core/beacon/aggregation/participant.ts +0 -517
- package/src/core/beacon/aggregation/session/index.ts +0 -301
- package/src/core/beacon/aggregation/session/status.ts +0 -18
- package/src/core/update.ts +0 -158
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cas-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/cas-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"cas-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/cas-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAiB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEhG;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,SAAU,SAAQ,MAAM;IACnC;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;;;;;;;;;OAYG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,mBAAmB;IAsDtB;;;;;;;;;;;;;;;OAeG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,iBAAiB,CAAC;CAuB9B"}
|
|
@@ -2,12 +2,6 @@ import { MethodError } from '@did-btcr2/common';
|
|
|
2
2
|
export declare class BeaconError extends MethodError {
|
|
3
3
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
4
4
|
}
|
|
5
|
-
export declare class BeaconCoordinatorError extends MethodError {
|
|
6
|
-
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
7
|
-
}
|
|
8
|
-
export declare class BeaconParticipantError extends MethodError {
|
|
9
|
-
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
10
|
-
}
|
|
11
5
|
export declare class SingletonBeaconError extends MethodError {
|
|
12
6
|
constructor(message: string, type?: string, data?: Record<string, any>);
|
|
13
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,qBAAa,WAAY,SAAQ,WAAW;gBAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAsB,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGtF;AAED,qBAAa,
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,qBAAa,WAAY,SAAQ,WAAW;gBAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAsB,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGtF;AAED,qBAAa,oBAAqB,SAAQ,WAAW;gBACvC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAA+B,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAG/F;AAED,qBAAa,oBAAqB,SAAQ,WAAW;gBACvC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAA+B,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAG/F;AAED,qBAAa,cAAe,SAAQ,WAAW;gBACjC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAyB,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGzF;AAED,qBAAa,cAAe,SAAQ,WAAW;gBACjC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAyB,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAGzF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Estimates the fee (in satoshis) for a transaction of a given virtual size.
|
|
3
|
+
*
|
|
4
|
+
* Beacons delegate fee calculation to a `FeeEstimator` so that callers can
|
|
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
|
+
}
|
|
40
|
+
//# sourceMappingURL=fee-estimator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fee-estimator.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/fee-estimator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7C;AAED;;;;;;;;;;GAUG;AACH,qBAAa,kBAAmB,YAAW,YAAY;IACrD,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;OAEG;gBACS,YAAY,GAAE,MAAU;IAO9B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAMlD"}
|
|
@@ -57,4 +57,12 @@ export interface BeaconSignal {
|
|
|
57
57
|
*/
|
|
58
58
|
blockMetadata: BlockMetadata;
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Callback for publishing a CAS Announcement to a content-addressed store.
|
|
62
|
+
* The method package defines this type; the api layer provides the implementation
|
|
63
|
+
* (e.g., via CasApi.publish backed by IPFS/Helia).
|
|
64
|
+
*
|
|
65
|
+
* @param announcement The CAS Announcement object (DID → update hash mapping).
|
|
66
|
+
*/
|
|
67
|
+
export type CasPublishFn = (announcement: Record<string, string>) => Promise<void>;
|
|
60
68
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC7C,eAAe,EAAE,kBAAkB,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACtD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC3B;;MAEE;IACH,MAAM,EAAE,MAAM,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AC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -3,6 +3,7 @@ import type { KeyBytes } from '@did-btcr2/common';
|
|
|
3
3
|
import type { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
4
4
|
import type { BeaconProcessResult } from '../resolver.js';
|
|
5
5
|
import type { SidecarData } from '../types.js';
|
|
6
|
+
import type { BroadcastOptions } from './beacon.js';
|
|
6
7
|
import { Beacon } from './beacon.js';
|
|
7
8
|
import type { BeaconService, BeaconSignal } from './interfaces.js';
|
|
8
9
|
/**
|
|
@@ -26,12 +27,18 @@ export declare class SingletonBeacon extends Beacon {
|
|
|
26
27
|
processSignals(signals: Array<BeaconSignal>, sidecar: SidecarData): BeaconProcessResult;
|
|
27
28
|
/**
|
|
28
29
|
* Broadcasts a SingletonBeacon signal to the Bitcoin network.
|
|
30
|
+
*
|
|
31
|
+
* The signal bytes embedded in OP_RETURN are the SHA-256 canonical hash of the signed update.
|
|
32
|
+
* UTXO selection, PSBT construction, fee estimation, signing, and broadcast are delegated to
|
|
33
|
+
* {@link Beacon.buildSignAndBroadcast}.
|
|
34
|
+
*
|
|
29
35
|
* @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
|
|
30
36
|
* @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
|
|
31
37
|
* @param {BitcoinConnection} bitcoin The Bitcoin network connection.
|
|
38
|
+
* @param {BroadcastOptions} [options] Optional broadcast configuration (e.g. fee estimator).
|
|
32
39
|
* @returns {Promise<SignedBTCR2Update>} The signed update that was broadcast.
|
|
33
|
-
* @throws {
|
|
40
|
+
* @throws {BeaconError} if the bitcoin address is invalid, unfunded, or UTXO cannot cover the fee.
|
|
34
41
|
*/
|
|
35
|
-
broadcastSignal(signedUpdate: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinConnection): Promise<SignedBTCR2Update>;
|
|
42
|
+
broadcastSignal(signedUpdate: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinConnection, options?: BroadcastOptions): Promise<SignedBTCR2Update>;
|
|
36
43
|
}
|
|
37
44
|
//# sourceMappingURL=singleton-beacon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"singleton-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/singleton-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"singleton-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/singleton-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAiB,MAAM,iBAAiB,CAAC;AAElF;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,MAAM;IAEzC;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;;OAKG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,mBAAmB;IA0BtB;;;;;;;;;;;;;OAaG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC;CAK9B"}
|
|
@@ -3,10 +3,17 @@ import type { KeyBytes } from '@did-btcr2/common';
|
|
|
3
3
|
import type { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
4
4
|
import type { BeaconProcessResult } from '../resolver.js';
|
|
5
5
|
import type { SidecarData } from '../types.js';
|
|
6
|
+
import type { BroadcastOptions } from './beacon.js';
|
|
6
7
|
import { Beacon } from './beacon.js';
|
|
7
8
|
import type { BeaconService, BeaconSignal } from './interfaces.js';
|
|
8
9
|
/**
|
|
9
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/terminology.html#smt-beacon |
|
|
10
|
+
* Implements {@link https://dcdpr.github.io/did-btcr2/terminology.html#smt-beacon | SMT Beacon}.
|
|
11
|
+
*
|
|
12
|
+
* An SMT (Sparse Merkle Tree) Beacon aggregates updates for multiple DIDs
|
|
13
|
+
* into a single Merkle root hash broadcast on-chain via OP_RETURN.
|
|
14
|
+
* During resolution, the SMT Proof from the sidecar is verified against the
|
|
15
|
+
* on-chain root, and the proof's updateId is used to retrieve the signed update.
|
|
16
|
+
*
|
|
10
17
|
* @class SMTBeacon
|
|
11
18
|
* @type {SMTBeacon}
|
|
12
19
|
* @extends {Beacon}
|
|
@@ -19,20 +26,33 @@ export declare class SMTBeacon extends Beacon {
|
|
|
19
26
|
constructor(service: BeaconService);
|
|
20
27
|
/**
|
|
21
28
|
* Implements {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-smt-beacon | 7.2.e.1 Process SMT Beacon}.
|
|
29
|
+
*
|
|
30
|
+
* For each signal, the signalBytes contain the hex-encoded SMT root hash.
|
|
31
|
+
* This method looks up the SMT Proof from the sidecar by root hash,
|
|
32
|
+
* validates the Merkle inclusion proof, and retrieves the corresponding
|
|
33
|
+
* signed update using the proof's updateId.
|
|
34
|
+
*
|
|
22
35
|
* @param {Array<BeaconSignal>} signals The array of Beacon Signals to process.
|
|
23
36
|
* @param {SidecarData} sidecar The sidecar data associated with the SMT Beacon.
|
|
24
|
-
* @returns {BeaconProcessResult}
|
|
25
|
-
* @throws {SMTBeaconError} if
|
|
37
|
+
* @returns {BeaconProcessResult} Successfully resolved updates and any data needs.
|
|
38
|
+
* @throws {SMTBeaconError} if proof verification fails or proof is malformed.
|
|
26
39
|
*/
|
|
27
40
|
processSignals(signals: Array<BeaconSignal>, sidecar: SidecarData): BeaconProcessResult;
|
|
28
41
|
/**
|
|
29
|
-
*
|
|
42
|
+
* Broadcasts an SMT Beacon signal to the Bitcoin network.
|
|
43
|
+
*
|
|
44
|
+
* Builds a single-entry Sparse Merkle Tree from the signed update, then broadcasts the tree's
|
|
45
|
+
* root hash via OP_RETURN. For multi-party aggregation, use the {@link AggregationService}
|
|
46
|
+
* subsystem directly instead of this method. UTXO selection, PSBT construction, fee estimation,
|
|
47
|
+
* signing, and broadcast are delegated to {@link Beacon.buildSignAndBroadcast}.
|
|
48
|
+
*
|
|
30
49
|
* @param {SignedBTCR2Update} signedUpdate The signed BTCR2 update to broadcast.
|
|
31
50
|
* @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
|
|
32
51
|
* @param {BitcoinConnection} bitcoin The Bitcoin network connection.
|
|
33
|
-
* @
|
|
34
|
-
* @
|
|
52
|
+
* @param {BroadcastOptions} [options] Optional broadcast configuration (e.g. fee estimator).
|
|
53
|
+
* @return {Promise<SignedBTCR2Update>} The signed update that was broadcast.
|
|
54
|
+
* @throws {BeaconError} if the bitcoin address is invalid, unfunded, or UTXO cannot cover the fee.
|
|
35
55
|
*/
|
|
36
|
-
broadcastSignal(signedUpdate: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinConnection): Promise<SignedBTCR2Update>;
|
|
56
|
+
broadcastSignal(signedUpdate: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinConnection, options?: BroadcastOptions): Promise<SignedBTCR2Update>;
|
|
37
57
|
}
|
|
38
58
|
//# sourceMappingURL=smt-beacon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smt-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/smt-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"smt-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/smt-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAiB,MAAM,iBAAiB,CAAC;AAElF;;;;;;;;;;;GAWG;AACH,qBAAa,SAAU,SAAQ,MAAM;IACnC;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;;;;;;;;;OAYG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,mBAAmB;IAiEtB;;;;;;;;;;;;;;OAcG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC;CAgB9B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Bytes, DocumentBytes, KeyBytes, SchnorrKeyPairObject } from '@did-btcr2/common';
|
|
2
|
+
import { CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
|
|
2
3
|
import type { DidCreateOptions } from '../did-btcr2.js';
|
|
3
4
|
/**
|
|
4
5
|
* Components of a did:btcr2 identifier.
|
|
@@ -67,6 +68,13 @@ export declare class Identifier {
|
|
|
67
68
|
keyPair: SchnorrKeyPairObject;
|
|
68
69
|
did: string;
|
|
69
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Extracts the compressed secp256k1 public key from a KEY-type did:btcr2 identifier.
|
|
73
|
+
* @param {string} did The did:btcr2 identifier to extract the public key from.
|
|
74
|
+
* @returns {CompressedSecp256k1PublicKey} The compressed public key.
|
|
75
|
+
* @throws {IdentifierError} If the DID is EXTERNAL type (genesis bytes are a hash, not a pubkey).
|
|
76
|
+
*/
|
|
77
|
+
static getPublicKey(did: string): CompressedSecp256k1PublicKey;
|
|
70
78
|
/**
|
|
71
79
|
* Validates a did:btcr2 identifier.
|
|
72
80
|
* @param {string} identifier The did:btcr2 identifier to validate.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../../src/core/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../../src/core/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9F,OAAO,EAAE,4BAA4B,EAAkB,MAAM,oBAAoB,CAAC;AAElF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;;GAKG;AACH,MAAM,WAAW,aAAc,SAAQ,oBAAoB;IACvD,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,KAAK,CAAC;CACvB;AACD;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;IACrB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,QAAQ,GAAG,aAAa,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM;IAuFxF;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa;IA8HhD;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI;QAAE,OAAO,EAAE,oBAAoB,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;IAYjE;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,4BAA4B;IAW9D;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;CAQ5C"}
|
|
@@ -59,11 +59,11 @@ export interface SMTProof {
|
|
|
59
59
|
*/
|
|
60
60
|
id: string;
|
|
61
61
|
/**
|
|
62
|
-
* Optional 256-bit nonce generated for each update.
|
|
62
|
+
* Optional 256-bit nonce generated for each update. Hex-encoded (64 chars).
|
|
63
63
|
*/
|
|
64
64
|
nonce?: string;
|
|
65
65
|
/**
|
|
66
|
-
* Optional
|
|
66
|
+
* Optional hex-encoded canonical hash of the BTCR2 Signed Update.
|
|
67
67
|
*/
|
|
68
68
|
updateId?: string;
|
|
69
69
|
/**
|
|
@@ -2,6 +2,7 @@ import type { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
|
2
2
|
import { DidDocument } from '../utils/did-document.js';
|
|
3
3
|
import type { BeaconService, BeaconSignal, BlockMetadata } from './beacon/interfaces.js';
|
|
4
4
|
import type { DidComponents } from './identifier.js';
|
|
5
|
+
import type { SMTProof } from './interfaces.js';
|
|
5
6
|
import type { CASAnnouncement, Sidecar, SidecarData } from './types.js';
|
|
6
7
|
/**
|
|
7
8
|
* The response object for DID Resolution.
|
|
@@ -43,8 +44,16 @@ export interface NeedSignedUpdate {
|
|
|
43
44
|
/** The beacon service that produced this signal. */
|
|
44
45
|
readonly beaconServiceId: string;
|
|
45
46
|
}
|
|
47
|
+
/** The resolver needs an SMT Proof whose root hash matches smtRootHash. */
|
|
48
|
+
export interface NeedSMTProof {
|
|
49
|
+
readonly kind: 'NeedSMTProof';
|
|
50
|
+
/** Hex-encoded SHA-256 root hash of the Sparse Merkle Tree. */
|
|
51
|
+
readonly smtRootHash: string;
|
|
52
|
+
/** The beacon service that produced this signal. */
|
|
53
|
+
readonly beaconServiceId: string;
|
|
54
|
+
}
|
|
46
55
|
/** Discriminated union of all data the resolver may request from the caller. */
|
|
47
|
-
export type DataNeed = NeedGenesisDocument | NeedBeaconSignals | NeedCASAnnouncement | NeedSignedUpdate;
|
|
56
|
+
export type DataNeed = NeedGenesisDocument | NeedBeaconSignals | NeedCASAnnouncement | NeedSignedUpdate | NeedSMTProof;
|
|
48
57
|
/**
|
|
49
58
|
* Output of {@link Resolver.resolve}. Analogous to Rust's `ResolverState` enum.
|
|
50
59
|
* Either the resolver needs data from the caller, or resolution is complete.
|
|
@@ -163,5 +172,6 @@ export declare class Resolver {
|
|
|
163
172
|
provide(need: NeedBeaconSignals, data: Map<BeaconService, Array<BeaconSignal>>): void;
|
|
164
173
|
provide(need: NeedCASAnnouncement, data: CASAnnouncement): void;
|
|
165
174
|
provide(need: NeedSignedUpdate, data: SignedBTCR2Update): void;
|
|
175
|
+
provide(need: NeedSMTProof, data: SMTProof): void;
|
|
166
176
|
}
|
|
167
177
|
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/core/resolver.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,wBAAwB,CAAC;AAShC,OAAO,EAAE,WAAW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AG,IAAI;CA0ClD"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { BitcoinConnection } from '@did-btcr2/bitcoin';
|
|
2
|
+
import type { KeyBytes, PatchOperation } from '@did-btcr2/common';
|
|
3
|
+
import { type SignedBTCR2Update, type UnsignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
4
|
+
import { type Btcr2DidDocument, type DidVerificationMethod } from '../utils/did-document.js';
|
|
5
|
+
import type { BeaconService } from './beacon/interfaces.js';
|
|
6
|
+
/**
|
|
7
|
+
* The updater needs the caller to supply a signing key (or a KMS-backed signature)
|
|
8
|
+
* for the given verification method. The unsigned update is attached so the caller
|
|
9
|
+
* can inspect it before producing a signature.
|
|
10
|
+
*/
|
|
11
|
+
export interface NeedSigningKey {
|
|
12
|
+
readonly kind: 'NeedSigningKey';
|
|
13
|
+
/** The verification method ID that requires a signing key. */
|
|
14
|
+
readonly verificationMethodId: string;
|
|
15
|
+
/** The unsigned update that will be signed. */
|
|
16
|
+
readonly unsignedUpdate: UnsignedBTCR2Update;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The updater needs the caller to ensure the beacon address is funded before
|
|
20
|
+
* broadcasting. The caller checks the beacon address for UTXOs, funds it if
|
|
21
|
+
* needed, and then calls `updater.provide(need)` to continue.
|
|
22
|
+
*
|
|
23
|
+
* If the beacon is already funded, the caller can provide immediately (no-op).
|
|
24
|
+
*/
|
|
25
|
+
export interface NeedFunding {
|
|
26
|
+
readonly kind: 'NeedFunding';
|
|
27
|
+
/** The Bitcoin address that must have a spendable UTXO for broadcast. */
|
|
28
|
+
readonly beaconAddress: string;
|
|
29
|
+
/** The beacon service this address belongs to. */
|
|
30
|
+
readonly beaconService: BeaconService;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The updater needs the caller to broadcast the signed update via the beacon.
|
|
34
|
+
*
|
|
35
|
+
* The caller decides how: for single-party beacons, call
|
|
36
|
+
* `Updater.announce(beaconService, signedUpdate, secretKey, bitcoin)` or
|
|
37
|
+
* `BeaconFactory.establish(beaconService).broadcastSignal(...)`. For multi-party
|
|
38
|
+
* aggregate beacons, hand off to the aggregation protocol.
|
|
39
|
+
*
|
|
40
|
+
* After the broadcast succeeds, the caller calls `updater.provide(need)` (with no
|
|
41
|
+
* data) to transition the updater to Complete.
|
|
42
|
+
*/
|
|
43
|
+
export interface NeedBroadcast {
|
|
44
|
+
readonly kind: 'NeedBroadcast';
|
|
45
|
+
/** The beacon service to broadcast through. Inspect `beaconService.type` to decide the path. */
|
|
46
|
+
readonly beaconService: BeaconService;
|
|
47
|
+
/** The signed update ready for broadcast. */
|
|
48
|
+
readonly signedUpdate: SignedBTCR2Update;
|
|
49
|
+
}
|
|
50
|
+
/** Discriminated union of all data needs the updater may request from the caller. */
|
|
51
|
+
export type UpdaterDataNeed = NeedSigningKey | NeedFunding | NeedBroadcast;
|
|
52
|
+
/**
|
|
53
|
+
* The result returned by the updater when it reaches the Complete phase.
|
|
54
|
+
*/
|
|
55
|
+
export interface UpdaterResult {
|
|
56
|
+
/** The signed update that was constructed, signed, and broadcast. */
|
|
57
|
+
signedUpdate: SignedBTCR2Update;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Output of {@link Updater.advance}. Either the updater needs data from the
|
|
61
|
+
* caller, or the update is complete.
|
|
62
|
+
*/
|
|
63
|
+
export type UpdaterState = {
|
|
64
|
+
status: 'action-required';
|
|
65
|
+
needs: ReadonlyArray<UpdaterDataNeed>;
|
|
66
|
+
} | {
|
|
67
|
+
status: 'complete';
|
|
68
|
+
result: UpdaterResult;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Parameters for constructing an {@link Updater}. Built by
|
|
72
|
+
* {@link https://dcdpr.github.io/did-btcr2/operations/update.html | DidBtcr2.update}.
|
|
73
|
+
*/
|
|
74
|
+
export interface UpdaterParams {
|
|
75
|
+
sourceDocument: Btcr2DidDocument;
|
|
76
|
+
patches: PatchOperation[];
|
|
77
|
+
sourceVersionId: number;
|
|
78
|
+
verificationMethod: DidVerificationMethod;
|
|
79
|
+
beaconService: BeaconService;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Sans-I/O state machine for did:btcr2 updates — the counterpart to {@link Resolver}.
|
|
83
|
+
*
|
|
84
|
+
* Created by {@link DidBtcr2.update} (the factory). The caller drives the update by
|
|
85
|
+
* repeatedly calling {@link advance} and {@link provide}:
|
|
86
|
+
*
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const updater = DidBtcr2.update({ sourceDocument, patches, ... });
|
|
89
|
+
* let state = updater.advance();
|
|
90
|
+
*
|
|
91
|
+
* while(state.status === 'action-required') {
|
|
92
|
+
* for(const need of state.needs) {
|
|
93
|
+
* switch(need.kind) {
|
|
94
|
+
* case 'NeedSigningKey':
|
|
95
|
+
* updater.provide(need, secretKeyBytes);
|
|
96
|
+
* break;
|
|
97
|
+
* case 'NeedFunding':
|
|
98
|
+
* // Check UTXOs at need.beaconAddress, fund if needed
|
|
99
|
+
* updater.provide(need);
|
|
100
|
+
* break;
|
|
101
|
+
* case 'NeedBroadcast':
|
|
102
|
+
* await Updater.announce(need.beaconService, need.signedUpdate, secretKey, bitcoin);
|
|
103
|
+
* updater.provide(need);
|
|
104
|
+
* break;
|
|
105
|
+
* }
|
|
106
|
+
* }
|
|
107
|
+
* state = updater.advance();
|
|
108
|
+
* }
|
|
109
|
+
*
|
|
110
|
+
* const { signedUpdate } = state.result;
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* The Updater performs **zero I/O**. All external work (signing with a KMS or raw
|
|
114
|
+
* key, funding checks, Bitcoin transaction construction, broadcast) flows through
|
|
115
|
+
* the advance/provide protocol. This mirrors the {@link Resolver} pattern and makes
|
|
116
|
+
* the update path transport-agnostic and KMS-ready.
|
|
117
|
+
*
|
|
118
|
+
* The class also exposes static utility methods ({@link construct}, {@link sign},
|
|
119
|
+
* {@link announce}) for callers that need direct access to individual update steps
|
|
120
|
+
* outside the state machine (e.g., test vector generation scripts).
|
|
121
|
+
*
|
|
122
|
+
* @class Updater
|
|
123
|
+
*/
|
|
124
|
+
export declare class Updater {
|
|
125
|
+
#private;
|
|
126
|
+
/**
|
|
127
|
+
* @internal — Use {@link DidBtcr2.update} to create instances.
|
|
128
|
+
*/
|
|
129
|
+
constructor(params: UpdaterParams);
|
|
130
|
+
/**
|
|
131
|
+
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/update.html#construct-btcr2-unsigned-update | 7.3.b Construct BTCR2 Unsigned Update}.
|
|
132
|
+
*
|
|
133
|
+
* @param {Btcr2DidDocument} sourceDocument The source DID document to be updated.
|
|
134
|
+
* @param {PatchOperation[]} patches The JSON Patch operations to apply.
|
|
135
|
+
* @param {number} sourceVersionId The version ID of the source document.
|
|
136
|
+
* @returns {UnsignedBTCR2Update} The constructed UnsignedBTCR2Update object.
|
|
137
|
+
* @throws {UpdateError} If the target document fails DID Core validation.
|
|
138
|
+
*/
|
|
139
|
+
static construct(sourceDocument: Btcr2DidDocument, patches: PatchOperation[], sourceVersionId: number): UnsignedBTCR2Update;
|
|
140
|
+
/**
|
|
141
|
+
* Implements subsection {@link http://dcdpr.github.io/did-btcr2/operations/update.html#construct-btcr2-signed-update | 7.3.c Construct BTCR2 Signed Update }.
|
|
142
|
+
*
|
|
143
|
+
* @param {string} did The did-btcr2 identifier to derive the root capability from.
|
|
144
|
+
* @param {UnsignedBTCR2Update} unsignedUpdate The unsigned update to sign.
|
|
145
|
+
* @param {DidVerificationMethod} verificationMethod The verification method for signing.
|
|
146
|
+
* @param {KeyBytes} secretKey The secret key bytes.
|
|
147
|
+
* @returns {SignedBTCR2Update} The signed update with a Data Integrity proof.
|
|
148
|
+
*/
|
|
149
|
+
static sign(did: string, unsignedUpdate: UnsignedBTCR2Update, verificationMethod: DidVerificationMethod, secretKey: KeyBytes): SignedBTCR2Update;
|
|
150
|
+
/**
|
|
151
|
+
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/update.html#announce-did-update | 7.3.d Announce DID Update}.
|
|
152
|
+
* Announces a signed update to the Bitcoin blockchain via the specified beacon.
|
|
153
|
+
*
|
|
154
|
+
* @param {BeaconService} beaconService The beacon service to broadcast through.
|
|
155
|
+
* @param {SignedBTCR2Update} update The signed update to announce.
|
|
156
|
+
* @param {KeyBytes} secretKey The secret key for signing the Bitcoin transaction.
|
|
157
|
+
* @param {BitcoinConnection} bitcoin The Bitcoin network connection.
|
|
158
|
+
* @returns {Promise<SignedBTCR2Update>} The signed update that was broadcast.
|
|
159
|
+
*/
|
|
160
|
+
static announce(beaconService: BeaconService, update: SignedBTCR2Update, secretKey: KeyBytes, bitcoin: BitcoinConnection): Promise<SignedBTCR2Update>;
|
|
161
|
+
/**
|
|
162
|
+
* Advance the state machine. Returns either:
|
|
163
|
+
* - `{ status: 'action-required', needs }` — caller must provide data via {@link provide}
|
|
164
|
+
* - `{ status: 'complete', result }` — update is signed and broadcast
|
|
165
|
+
*/
|
|
166
|
+
advance(): UpdaterState;
|
|
167
|
+
/**
|
|
168
|
+
* Provide data the updater requested in a previous {@link advance} call.
|
|
169
|
+
* Call once per need, then call {@link advance} again to continue.
|
|
170
|
+
*
|
|
171
|
+
* @param need The DataNeed being fulfilled (from the `needs` array).
|
|
172
|
+
* @param data The data payload corresponding to the need kind (omit for NeedFunding/NeedBroadcast).
|
|
173
|
+
*/
|
|
174
|
+
provide(need: NeedSigningKey, data: KeyBytes): void;
|
|
175
|
+
provide(need: NeedFunding): void;
|
|
176
|
+
provide(need: NeedBroadcast): void;
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=updater.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../../../src/core/updater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,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,CAAA;CAAE,CAAC;AAclD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,gBAAgB,CAAC;IACjC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,qBAAqB,CAAC;IAC1C,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,qBAAa,OAAO;;IAWlB;;OAEG;gBACS,MAAM,EAAE,aAAa;IAYjC;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAS,CACd,cAAc,EAAE,gBAAgB,EAChC,OAAO,EAAE,cAAc,EAAE,EACzB,eAAe,EAAE,MAAM,GACtB,mBAAmB;IA6BtB;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,CACT,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,mBAAmB,EACnC,kBAAkB,EAAE,qBAAqB,EACzC,SAAS,EAAE,QAAQ,GAClB,iBAAiB;IAwBpB;;;;;;;;;OASG;WACU,QAAQ,CACnB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,iBAAiB,EACzB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,iBAAiB,CAAC;IAmB7B;;;;OAIG;IACH,OAAO,IAAI,YAAY;IAiEvB;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI;IACnD,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAChC,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;CAoDnC"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { DocumentBytes, HexString, KeyBytes, PatchOperation } from '@did-btcr2/common';
|
|
3
|
-
import type { SignedBTCR2Update } from '@did-btcr2/cryptosuite';
|
|
1
|
+
import type { DocumentBytes, KeyBytes, PatchOperation } from '@did-btcr2/common';
|
|
4
2
|
import type { DidMethod } from '@web5/dids';
|
|
5
3
|
import type { ResolutionOptions } from './core/interfaces.js';
|
|
6
4
|
import { Resolver } from './core/resolver.js';
|
|
5
|
+
import { Updater } from './core/updater.js';
|
|
7
6
|
import type { Btcr2DidDocument, DidVerificationMethod } from './utils/did-document.js';
|
|
8
7
|
export interface DidCreateOptions {
|
|
9
8
|
/** Type of identifier to create (key or external) */
|
|
@@ -71,34 +70,35 @@ export declare class DidBtcr2 implements DidMethod {
|
|
|
71
70
|
*/
|
|
72
71
|
static resolve(did: string, resolutionOptions?: ResolutionOptions): Resolver;
|
|
73
72
|
/**
|
|
74
|
-
* Entry point for section {@link https://dcdpr.github.io/did-btcr2/#
|
|
75
|
-
* See specification for the {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process | Resolve Process}.
|
|
76
|
-
* See {@link Update | Update (class)} for class implementation.
|
|
73
|
+
* Entry point for section {@link https://dcdpr.github.io/did-btcr2/#update | 7.3 Update}.
|
|
77
74
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
75
|
+
* Factory method that validates the update parameters and returns a sans-I/O
|
|
76
|
+
* {@link Updater} state machine. The caller drives the updater through its
|
|
77
|
+
* phases (Construct → Sign → Broadcast → Complete) by calling `advance()` and
|
|
78
|
+
* `provide()`. The method package performs **zero I/O** — signing key retrieval
|
|
79
|
+
* (or KMS delegation) and the on-chain broadcast are the caller's responsibility.
|
|
80
|
+
*
|
|
81
|
+
* For a fully-wired version with Bitcoin broadcast and key handling, see
|
|
82
|
+
* `DidMethodApi.update()` in `@did-btcr2/api`.
|
|
83
|
+
*
|
|
84
|
+
* @param params Update construction parameters.
|
|
82
85
|
* @param {Btcr2DidDocument} params.sourceDocument The DID document being updated.
|
|
83
|
-
* @param {PatchOperation[]} params.patches The
|
|
84
|
-
* @param {
|
|
85
|
-
* @param {string} params.verificationMethodId The
|
|
86
|
-
* @param {string} params.beaconId The beacon ID
|
|
87
|
-
* @
|
|
88
|
-
* @
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* header is not `zQ3s`
|
|
86
|
+
* @param {PatchOperation[]} params.patches The JSON Patch operations to apply.
|
|
87
|
+
* @param {number} params.sourceVersionId The version ID before applying the update.
|
|
88
|
+
* @param {string} params.verificationMethodId The verification method ID to sign with.
|
|
89
|
+
* @param {string} params.beaconId The beacon service ID to broadcast through.
|
|
90
|
+
* @returns {Updater} A sans-I/O state machine for driving the update.
|
|
91
|
+
* @throws {UpdateError} If the verification method is not authorized, not found,
|
|
92
|
+
* not of type `Multikey`, or does not have a `zQ3s` publicKeyMultibase prefix.
|
|
93
|
+
* Also throws if the beacon service is not found.
|
|
92
94
|
*/
|
|
93
|
-
static update({ sourceDocument, patches, sourceVersionId, verificationMethodId, beaconId,
|
|
95
|
+
static update({ sourceDocument, patches, sourceVersionId, verificationMethodId, beaconId, }: {
|
|
94
96
|
sourceDocument: Btcr2DidDocument;
|
|
95
97
|
patches: PatchOperation[];
|
|
96
98
|
sourceVersionId: number;
|
|
97
99
|
verificationMethodId: string;
|
|
98
100
|
beaconId: string;
|
|
99
|
-
|
|
100
|
-
bitcoin?: BitcoinConnection;
|
|
101
|
-
}): Promise<SignedBTCR2Update>;
|
|
101
|
+
}): Updater;
|
|
102
102
|
/**
|
|
103
103
|
* Given the W3C DID Document of a `did:btcr2` identifier, return the signing verification method that will be used
|
|
104
104
|
* for signing messages and credentials. If given, the `methodId` parameter is used to select the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did-btcr2.d.ts","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"did-btcr2.d.ts","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACR,cAAc,EAAC,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AAC,WAAW,EAAE,gBAAgB,EAAG,QAAQ,CAAC,EAAE,MAAM,GAAG,qBAAqB;CA0BlG"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,31 +1,17 @@
|
|
|
1
|
-
export * from './core/
|
|
2
|
-
export * from './core/
|
|
3
|
-
export * from './core/
|
|
4
|
-
export * from './core/
|
|
5
|
-
export * from './core/
|
|
6
|
-
export * from './core/
|
|
7
|
-
export * from './core/
|
|
8
|
-
export * from './core/
|
|
9
|
-
export * from './core/
|
|
10
|
-
export * from './core/beacon/aggregation/cohort/messages/keygen/opt-in.js';
|
|
11
|
-
export * from './core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js';
|
|
12
|
-
export * from './core/beacon/aggregation/cohort/messages/sign/authorization-request.js';
|
|
13
|
-
export * from './core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js';
|
|
14
|
-
export * from './core/beacon/aggregation/cohort/messages/sign/request-signature.js';
|
|
15
|
-
export * from './core/beacon/aggregation/cohort/messages/sign/signature-authorization.js';
|
|
16
|
-
export * from './core/beacon/aggregation/communication/adapter/did-comm.js';
|
|
17
|
-
export * from './core/beacon/aggregation/communication/adapter/nostr.js';
|
|
18
|
-
export * from './core/beacon/aggregation/communication/error.js';
|
|
19
|
-
export * from './core/beacon/aggregation/communication/factory.js';
|
|
20
|
-
export * from './core/beacon/aggregation/communication/service.js';
|
|
21
|
-
export * from './core/beacon/aggregation/coordinator.js';
|
|
22
|
-
export * from './core/beacon/aggregation/participant.js';
|
|
23
|
-
export * from './core/beacon/aggregation/session/index.js';
|
|
24
|
-
export * from './core/beacon/aggregation/session/status.js';
|
|
1
|
+
export * from './core/aggregation/service.js';
|
|
2
|
+
export * from './core/aggregation/participant.js';
|
|
3
|
+
export * from './core/aggregation/cohort.js';
|
|
4
|
+
export * from './core/aggregation/signing-session.js';
|
|
5
|
+
export * from './core/aggregation/phases.js';
|
|
6
|
+
export * from './core/aggregation/errors.js';
|
|
7
|
+
export * from './core/aggregation/messages/index.js';
|
|
8
|
+
export * from './core/aggregation/transport/index.js';
|
|
9
|
+
export * from './core/aggregation/runner/index.js';
|
|
25
10
|
export * from './core/beacon/beacon.js';
|
|
26
11
|
export * from './core/beacon/cas-beacon.js';
|
|
27
12
|
export * from './core/beacon/error.js';
|
|
28
13
|
export * from './core/beacon/factory.js';
|
|
14
|
+
export * from './core/beacon/fee-estimator.js';
|
|
29
15
|
export * from './core/beacon/interfaces.js';
|
|
30
16
|
export * from './core/beacon/signal-discovery.js';
|
|
31
17
|
export * from './core/beacon/singleton-beacon.js';
|
|
@@ -35,7 +21,7 @@ export * from './core/identifier.js';
|
|
|
35
21
|
export * from './core/interfaces.js';
|
|
36
22
|
export * from './core/resolver.js';
|
|
37
23
|
export * from './core/types.js';
|
|
38
|
-
export * from './core/
|
|
24
|
+
export * from './core/updater.js';
|
|
39
25
|
export * from './utils/appendix.js';
|
|
40
26
|
export * from './utils/did-document-builder.js';
|
|
41
27
|
export * from './utils/did-document.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,cAAc,+BAA+B,CAAC;AAC9C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCAAoC,CAAC;AAGnD,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,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"}
|