@did-btcr2/method 0.17.2 → 0.18.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/browser.js +30124 -19552
- package/dist/browser.mjs +30123 -19551
- package/dist/cjs/core/beacon/aggregation/cohort/index.js +225 -0
- package/dist/cjs/core/beacon/aggregation/cohort/index.js.map +1 -0
- package/dist/{esm/core/beacon/aggregation → cjs/core/beacon/aggregation/cohort}/messages/base.js +3 -11
- package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/constants.js +11 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/constants.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/index.js +98 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/index.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +30 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +28 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +26 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +22 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +27 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +28 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +29 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +29 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js +29 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +30 -0
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/cohort/status.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/communication/adapter/did-comm.js +126 -0
- package/dist/cjs/core/beacon/aggregation/communication/adapter/did-comm.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js +230 -0
- package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/communication/error.js +12 -0
- package/dist/cjs/core/beacon/aggregation/communication/error.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/communication/factory.js +21 -0
- package/dist/cjs/core/beacon/aggregation/communication/factory.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/communication/service.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/coordinator.js +282 -56
- package/dist/cjs/core/beacon/aggregation/coordinator.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/participant.js +435 -1
- package/dist/cjs/core/beacon/aggregation/participant.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/session/index.js +233 -0
- package/dist/cjs/core/beacon/aggregation/session/index.js.map +1 -0
- package/dist/cjs/core/beacon/aggregation/session/status.js +11 -0
- package/dist/cjs/core/beacon/aggregation/session/status.js.map +1 -0
- package/dist/cjs/core/beacon/cid-aggregate.js.map +1 -1
- package/dist/cjs/core/beacon/error.js +37 -0
- package/dist/cjs/core/beacon/error.js.map +1 -0
- package/dist/cjs/core/beacon/factory.js.map +1 -1
- package/dist/cjs/core/beacon/singleton.js +8 -5
- package/dist/cjs/core/beacon/singleton.js.map +1 -1
- package/dist/cjs/core/beacon/smt-aggregate.js.map +1 -1
- package/dist/cjs/{utils/beacons.js → core/beacon/utils.js} +4 -4
- package/dist/cjs/core/beacon/utils.js.map +1 -0
- package/dist/cjs/core/crud/read.js +2 -9
- package/dist/cjs/core/crud/read.js.map +1 -1
- package/dist/cjs/core/crud/update.js +18 -19
- package/dist/cjs/core/crud/update.js.map +1 -1
- package/dist/{esm/utils → cjs/core}/identifier.js +18 -3
- package/dist/cjs/core/identifier.js.map +1 -0
- package/dist/cjs/did-btcr2.js +2 -2
- package/dist/cjs/did-btcr2.js.map +1 -1
- package/dist/cjs/index.js +28 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/beacon.js.map +1 -1
- package/dist/cjs/utils/appendix.js +2 -3
- package/dist/cjs/utils/appendix.js.map +1 -1
- package/dist/cjs/utils/did-document.js +4 -6
- package/dist/cjs/utils/did-document.js.map +1 -1
- package/dist/cjs/utils/types.js +2 -0
- package/dist/cjs/utils/types.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/index.js +225 -0
- package/dist/esm/core/beacon/aggregation/cohort/index.js.map +1 -0
- package/dist/{cjs/core/beacon/aggregation → esm/core/beacon/aggregation/cohort}/messages/base.js +3 -11
- package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/constants.js +11 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/constants.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/index.js +98 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/index.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +30 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +28 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +26 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +22 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +27 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +28 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +29 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +29 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +29 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +30 -0
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/cohort/status.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js +126 -0
- package/dist/esm/core/beacon/aggregation/communication/adapter/did-comm.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +230 -0
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/communication/error.js +12 -0
- package/dist/esm/core/beacon/aggregation/communication/error.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/communication/factory.js +21 -0
- package/dist/esm/core/beacon/aggregation/communication/factory.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/communication/service.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/coordinator.js +282 -56
- package/dist/esm/core/beacon/aggregation/coordinator.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/participant.js +435 -1
- package/dist/esm/core/beacon/aggregation/participant.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/session/index.js +233 -0
- package/dist/esm/core/beacon/aggregation/session/index.js.map +1 -0
- package/dist/esm/core/beacon/aggregation/session/status.js +11 -0
- package/dist/esm/core/beacon/aggregation/session/status.js.map +1 -0
- package/dist/esm/core/beacon/cid-aggregate.js.map +1 -1
- package/dist/esm/core/beacon/error.js +37 -0
- package/dist/esm/core/beacon/error.js.map +1 -0
- package/dist/esm/core/beacon/factory.js.map +1 -1
- package/dist/esm/core/beacon/singleton.js +8 -5
- package/dist/esm/core/beacon/singleton.js.map +1 -1
- package/dist/esm/core/beacon/smt-aggregate.js.map +1 -1
- package/dist/esm/{utils/beacons.js → core/beacon/utils.js} +4 -4
- package/dist/esm/core/beacon/utils.js.map +1 -0
- package/dist/esm/core/crud/read.js +2 -9
- package/dist/esm/core/crud/read.js.map +1 -1
- package/dist/esm/core/crud/update.js +18 -19
- package/dist/esm/core/crud/update.js.map +1 -1
- package/dist/{cjs/utils → esm/core}/identifier.js +18 -3
- package/dist/esm/core/identifier.js.map +1 -0
- package/dist/esm/did-btcr2.js +2 -2
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/index.js +28 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/beacon.js.map +1 -1
- package/dist/esm/utils/appendix.js +2 -3
- package/dist/esm/utils/appendix.js.map +1 -1
- package/dist/esm/utils/did-document.js +4 -6
- package/dist/esm/utils/did-document.js.map +1 -1
- package/dist/esm/utils/types.js +2 -0
- package/dist/esm/utils/types.js.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/index.d.ts +135 -0
- package/dist/types/core/beacon/aggregation/cohort/index.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/{messages → cohort/messages}/base.d.ts +13 -8
- package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts +10 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/constants.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts +64 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/index.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts +28 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts +26 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts +23 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts +19 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts +24 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts +24 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts +25 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts +25 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts +25 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts +26 -0
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/cohort/status.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts +88 -0
- package/dist/types/core/beacon/aggregation/communication/adapter/did-comm.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +93 -0
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/communication/error.d.ts +7 -0
- package/dist/types/core/beacon/aggregation/communication/error.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/communication/factory.d.ts +9 -0
- package/dist/types/core/beacon/aggregation/communication/factory.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/communication/service.d.ts +35 -0
- package/dist/types/core/beacon/aggregation/communication/service.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/coordinator.d.ts +79 -26
- package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/participant.d.ts +190 -0
- package/dist/types/core/beacon/aggregation/participant.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/session/index.d.ts +155 -0
- package/dist/types/core/beacon/aggregation/session/index.d.ts.map +1 -0
- package/dist/types/core/beacon/aggregation/session/status.d.ts +10 -0
- package/dist/types/core/beacon/aggregation/session/status.d.ts.map +1 -0
- package/dist/types/core/beacon/cid-aggregate.d.ts +3 -4
- package/dist/types/core/beacon/cid-aggregate.d.ts.map +1 -1
- package/dist/types/core/beacon/error.d.ts +22 -0
- package/dist/types/core/beacon/error.d.ts.map +1 -0
- package/dist/types/core/beacon/factory.d.ts +2 -3
- package/dist/types/core/beacon/factory.d.ts.map +1 -1
- package/dist/types/core/beacon/singleton.d.ts +2 -3
- package/dist/types/core/beacon/singleton.d.ts.map +1 -1
- package/dist/types/core/beacon/smt-aggregate.d.ts +3 -4
- package/dist/types/core/beacon/smt-aggregate.d.ts.map +1 -1
- package/dist/types/{utils/beacons.d.ts → core/beacon/utils.d.ts} +3 -3
- package/dist/types/core/beacon/utils.d.ts.map +1 -0
- package/dist/types/core/crud/read.d.ts +3 -3
- package/dist/types/core/crud/read.d.ts.map +1 -1
- package/dist/types/core/crud/update.d.ts +1 -1
- package/dist/types/core/crud/update.d.ts.map +1 -1
- package/dist/types/{utils → core}/identifier.d.ts +24 -3
- package/dist/types/core/identifier.d.ts.map +1 -0
- package/dist/types/did-btcr2.d.ts +1 -1
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/dist/types/index.d.ts +28 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/interfaces/beacon.d.ts +65 -5
- package/dist/types/interfaces/beacon.d.ts.map +1 -1
- package/dist/types/interfaces/crud.d.ts +1 -1
- package/dist/types/interfaces/crud.d.ts.map +1 -1
- package/dist/types/utils/appendix.d.ts +2 -10
- package/dist/types/utils/appendix.d.ts.map +1 -1
- package/dist/types/utils/did-document-builder.d.ts +1 -1
- package/dist/types/utils/did-document-builder.d.ts.map +1 -1
- package/dist/types/utils/did-document.d.ts +1 -1
- package/dist/types/utils/did-document.d.ts.map +1 -1
- package/dist/types/{types/crud.d.ts → utils/types.d.ts} +2 -2
- package/dist/types/utils/types.d.ts.map +1 -0
- package/package.json +4 -3
- package/src/core/beacon/aggregation/cohort/index.ts +292 -0
- package/src/core/beacon/aggregation/{messages → cohort/messages}/base.ts +14 -16
- package/src/core/beacon/aggregation/cohort/messages/constants.ts +12 -0
- package/src/core/beacon/aggregation/cohort/messages/index.ts +143 -0
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +43 -0
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +39 -0
- package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +34 -0
- package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +33 -0
- package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +35 -0
- package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +38 -0
- package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +39 -0
- package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +39 -0
- package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +39 -0
- package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +40 -0
- package/src/core/beacon/aggregation/communication/adapter/did-comm.ts +153 -0
- package/src/core/beacon/aggregation/communication/adapter/nostr.ts +300 -0
- package/src/core/beacon/aggregation/communication/error.ts +13 -0
- package/src/core/beacon/aggregation/communication/factory.ts +25 -0
- package/src/core/beacon/aggregation/communication/service.ts +42 -0
- package/src/core/beacon/aggregation/coordinator.ts +338 -67
- package/src/core/beacon/aggregation/participant.ts +512 -0
- package/src/core/beacon/aggregation/session/index.ts +289 -0
- package/src/core/beacon/aggregation/session/status.ts +18 -0
- package/src/core/beacon/cid-aggregate.ts +4 -5
- package/src/core/beacon/error.ts +44 -0
- package/src/core/beacon/factory.ts +2 -3
- package/src/core/beacon/singleton.ts +10 -8
- package/src/core/beacon/smt-aggregate.ts +4 -5
- package/src/{utils/beacons.ts → core/beacon/utils.ts} +5 -5
- package/src/core/crud/read.ts +7 -16
- package/src/core/crud/update.ts +25 -22
- package/src/{utils → core}/identifier.ts +35 -5
- package/src/did-btcr2.ts +4 -4
- package/src/index.ts +36 -8
- package/src/interfaces/beacon.ts +75 -5
- package/src/interfaces/crud.ts +1 -1
- package/src/utils/appendix.ts +3 -11
- package/src/utils/did-document-builder.ts +1 -1
- package/src/utils/did-document.ts +4 -7
- package/src/{types/crud.ts → utils/types.ts} +2 -2
- package/dist/cjs/core/beacon/aggregation/messages/advert.js +0 -24
- package/dist/cjs/core/beacon/aggregation/messages/advert.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/messages/base.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/messages/cohort-set.js +0 -25
- package/dist/cjs/core/beacon/aggregation/messages/cohort-set.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/messages/keygen.js +0 -8
- package/dist/cjs/core/beacon/aggregation/messages/keygen.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/messages/opt-in.js +0 -23
- package/dist/cjs/core/beacon/aggregation/messages/opt-in.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/messages/sign.js +0 -7
- package/dist/cjs/core/beacon/aggregation/messages/sign.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/models/cohort/index.js +0 -92
- package/dist/cjs/core/beacon/aggregation/models/cohort/index.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/models/cohort/status.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/protocol/nostr.js +0 -57
- package/dist/cjs/core/beacon/aggregation/protocol/nostr.js.map +0 -1
- package/dist/cjs/core/beacon/aggregation/protocol/service.js.map +0 -1
- package/dist/cjs/core/key-manager/index.js +0 -290
- package/dist/cjs/core/key-manager/index.js.map +0 -1
- package/dist/cjs/core/key-manager/interface.js +0 -2
- package/dist/cjs/core/key-manager/interface.js.map +0 -1
- package/dist/cjs/interfaces/ibeacon.js +0 -2
- package/dist/cjs/interfaces/ibeacon.js.map +0 -1
- package/dist/cjs/types/crud.js +0 -2
- package/dist/cjs/types/crud.js.map +0 -1
- package/dist/cjs/utils/beacons.js.map +0 -1
- package/dist/cjs/utils/identifier.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/messages/advert.js +0 -24
- package/dist/esm/core/beacon/aggregation/messages/advert.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/messages/base.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/messages/cohort-set.js +0 -25
- package/dist/esm/core/beacon/aggregation/messages/cohort-set.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/messages/keygen.js +0 -8
- package/dist/esm/core/beacon/aggregation/messages/keygen.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/messages/opt-in.js +0 -23
- package/dist/esm/core/beacon/aggregation/messages/opt-in.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/messages/sign.js +0 -7
- package/dist/esm/core/beacon/aggregation/messages/sign.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/models/cohort/index.js +0 -92
- package/dist/esm/core/beacon/aggregation/models/cohort/index.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/models/cohort/status.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/protocol/nostr.js +0 -57
- package/dist/esm/core/beacon/aggregation/protocol/nostr.js.map +0 -1
- package/dist/esm/core/beacon/aggregation/protocol/service.js.map +0 -1
- package/dist/esm/core/key-manager/index.js +0 -290
- package/dist/esm/core/key-manager/index.js.map +0 -1
- package/dist/esm/core/key-manager/interface.js +0 -2
- package/dist/esm/core/key-manager/interface.js.map +0 -1
- package/dist/esm/interfaces/ibeacon.js +0 -2
- package/dist/esm/interfaces/ibeacon.js.map +0 -1
- package/dist/esm/types/crud.js +0 -2
- package/dist/esm/types/crud.js.map +0 -1
- package/dist/esm/utils/beacons.js.map +0 -1
- package/dist/esm/utils/identifier.js.map +0 -1
- package/dist/types/core/beacon/aggregation/messages/advert.d.ts +0 -22
- package/dist/types/core/beacon/aggregation/messages/advert.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/messages/base.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/messages/cohort-set.d.ts +0 -23
- package/dist/types/core/beacon/aggregation/messages/cohort-set.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/messages/keygen.d.ts +0 -6
- package/dist/types/core/beacon/aggregation/messages/keygen.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/messages/opt-in.d.ts +0 -22
- package/dist/types/core/beacon/aggregation/messages/opt-in.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/messages/sign.d.ts +0 -5
- package/dist/types/core/beacon/aggregation/messages/sign.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/models/cohort/index.d.ts +0 -77
- package/dist/types/core/beacon/aggregation/models/cohort/index.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/models/cohort/status.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/protocol/nostr.d.ts +0 -36
- package/dist/types/core/beacon/aggregation/protocol/nostr.d.ts.map +0 -1
- package/dist/types/core/beacon/aggregation/protocol/service.d.ts +0 -6
- package/dist/types/core/beacon/aggregation/protocol/service.d.ts.map +0 -1
- package/dist/types/core/key-manager/index.d.ts +0 -145
- package/dist/types/core/key-manager/index.d.ts.map +0 -1
- package/dist/types/core/key-manager/interface.d.ts +0 -113
- package/dist/types/core/key-manager/interface.d.ts.map +0 -1
- package/dist/types/interfaces/ibeacon.d.ts +0 -65
- package/dist/types/interfaces/ibeacon.d.ts.map +0 -1
- package/dist/types/types/crud.d.ts.map +0 -1
- package/dist/types/utils/beacons.d.ts.map +0 -1
- package/dist/types/utils/identifier.d.ts.map +0 -1
- package/src/core/beacon/aggregation/messages/advert.ts +0 -36
- package/src/core/beacon/aggregation/messages/cohort-set.ts +0 -37
- package/src/core/beacon/aggregation/messages/keygen.ts +0 -8
- package/src/core/beacon/aggregation/messages/opt-in.ts +0 -35
- package/src/core/beacon/aggregation/messages/sign.ts +0 -7
- package/src/core/beacon/aggregation/models/cohort/index.ts +0 -112
- package/src/core/beacon/aggregation/protocol/nostr.ts +0 -81
- package/src/core/beacon/aggregation/protocol/service.ts +0 -6
- package/src/core/key-manager/index.ts +0 -364
- package/src/core/key-manager/interface.ts +0 -129
- package/src/interfaces/ibeacon.ts +0 -75
- /package/dist/cjs/core/beacon/aggregation/{models/cohort → cohort}/status.js +0 -0
- /package/dist/cjs/core/beacon/aggregation/{protocol → communication}/service.js +0 -0
- /package/dist/esm/core/beacon/aggregation/{models/cohort → cohort}/status.js +0 -0
- /package/dist/esm/core/beacon/aggregation/{protocol → communication}/service.js +0 -0
- /package/dist/types/core/beacon/aggregation/{models/cohort → cohort}/status.d.ts +0 -0
- /package/src/core/beacon/aggregation/{models/cohort → cohort}/status.ts +0 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { keyAggExport, keyAggregate, sortKeys } from '@scure/btc-signer/musig2';
|
|
2
|
+
import { payments, Transaction } from 'bitcoinjs-lib';
|
|
3
|
+
import { BeaconCoordinatorError } from '../../error.js';
|
|
4
|
+
import { BeaconCohortSigningSession } from '../session/index.js';
|
|
5
|
+
import { BeaconCohortReadyMessage } from './messages/keygen/cohort-ready.js';
|
|
6
|
+
import { COHORT_STATUS } from './status.js';
|
|
7
|
+
export class AggregateBeaconCohort {
|
|
8
|
+
/**
|
|
9
|
+
* Unique identifier for the cohort.
|
|
10
|
+
* @type {string}
|
|
11
|
+
*/
|
|
12
|
+
id;
|
|
13
|
+
/**
|
|
14
|
+
* DID of the coordinator.
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
coordinatorDid;
|
|
18
|
+
/**
|
|
19
|
+
* Minimum number of participants required to finalize the cohort.
|
|
20
|
+
* @type {number}
|
|
21
|
+
*/
|
|
22
|
+
minParticipants;
|
|
23
|
+
/**
|
|
24
|
+
* Status of the cohort.
|
|
25
|
+
* @type {string}
|
|
26
|
+
*/
|
|
27
|
+
status;
|
|
28
|
+
/**
|
|
29
|
+
* Network on which the cohort operates (e.g., 'mainnet', 'testnet').
|
|
30
|
+
* @type {string}
|
|
31
|
+
*/
|
|
32
|
+
network;
|
|
33
|
+
/**
|
|
34
|
+
* Pending signature requests, mapping participant DIDs to their pending signatures.
|
|
35
|
+
* @type {Record<string, string>}
|
|
36
|
+
*/
|
|
37
|
+
pendingSignatureRequests = {};
|
|
38
|
+
/**
|
|
39
|
+
* List of participant DIDs.
|
|
40
|
+
* @type {Array<string>}
|
|
41
|
+
*/
|
|
42
|
+
participants = new Array();
|
|
43
|
+
/**
|
|
44
|
+
* List of cohort keys.
|
|
45
|
+
* @type {Array<Uint8Array>}
|
|
46
|
+
*/
|
|
47
|
+
_cohortKeys = new Array();
|
|
48
|
+
/**
|
|
49
|
+
* Taproot Merkle root for the cohort.
|
|
50
|
+
* @type {Uint8Array}
|
|
51
|
+
*/
|
|
52
|
+
trMerkleRoot = new Uint8Array();
|
|
53
|
+
/**
|
|
54
|
+
* Beacon address for the cohort, calculated from the Taproot multisig.
|
|
55
|
+
* @type {string}
|
|
56
|
+
*/
|
|
57
|
+
beaconAddress = '';
|
|
58
|
+
/**
|
|
59
|
+
* Type of beacon used in the cohort (default is 'SMTAggregateBeacon').
|
|
60
|
+
* @type {string}
|
|
61
|
+
*/
|
|
62
|
+
beaconType;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a new Musig2Cohort instance.
|
|
65
|
+
* @param {Musig2CohortObject} params Parameters for initializing the cohort.
|
|
66
|
+
* @param {string} [params.id] Optional unique identifier for the cohort. If not provided, a random UUID will be generated.
|
|
67
|
+
* @param {number} params.minParticipants Minimum number of participants required to finalize the cohort.
|
|
68
|
+
* @param {string} [params.coordinatorDid] DID of the coordinator managing the cohort.
|
|
69
|
+
* @param {string} params.status Initial status of the cohort (e.g., 'PENDING', 'COHORT_SET').
|
|
70
|
+
* @param {string} params.network Network on which the cohort operates (e.g., 'mainnet', 'testnet').
|
|
71
|
+
*/
|
|
72
|
+
constructor({ id, minParticipants, coordinatorDid, status, network, beaconType }) {
|
|
73
|
+
this.id = id || crypto.randomUUID();
|
|
74
|
+
this.minParticipants = minParticipants || 2;
|
|
75
|
+
this.coordinatorDid = coordinatorDid || '';
|
|
76
|
+
this.status = status || COHORT_STATUS.COHORT_ADVERTISED;
|
|
77
|
+
this.network = network;
|
|
78
|
+
this.beaconType = beaconType || 'SMTAggregateBeacon';
|
|
79
|
+
}
|
|
80
|
+
set cohortKeys(keys) {
|
|
81
|
+
this.cohortKeys = sortKeys(keys);
|
|
82
|
+
}
|
|
83
|
+
validateCohort(participantKeys, cohortKeys, beaconAddress) {
|
|
84
|
+
for (const key of participantKeys) {
|
|
85
|
+
if (!cohortKeys.includes(key)) {
|
|
86
|
+
this.status = COHORT_STATUS.COHORT_FAILED;
|
|
87
|
+
throw new BeaconCoordinatorError(`Participant key ${key} not found in cohort ${this.id}.`, 'COHORT_VALIDATION_ERROR', {
|
|
88
|
+
cohortId: this.id,
|
|
89
|
+
participantKeys: participantKeys,
|
|
90
|
+
cohortKeys: cohortKeys,
|
|
91
|
+
beaconAddress: beaconAddress
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
this.cohortKeys = cohortKeys.map(key => Buffer.from(key, 'hex'));
|
|
96
|
+
const calculatedAddress = this.calulateBeaconAddress();
|
|
97
|
+
if (calculatedAddress !== beaconAddress) {
|
|
98
|
+
this.status = COHORT_STATUS.COHORT_FAILED;
|
|
99
|
+
throw new BeaconCoordinatorError(`Calculated beacon address ${calculatedAddress} does not match provided address ${beaconAddress}.`, 'COHORT_ADDRESS_MISMATCH_ERROR', {
|
|
100
|
+
cohortId: this.id,
|
|
101
|
+
calculatedAddress,
|
|
102
|
+
providedAddress: beaconAddress
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
this.beaconAddress = beaconAddress;
|
|
106
|
+
this.status = COHORT_STATUS.COHORT_SET_STATUS;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Finalizes the cohort by checking if the minimum number of participants is met.
|
|
110
|
+
* If the minimum is met, it sets the status to 'COHORT_SET_STATUS' and calculates the beacon address.
|
|
111
|
+
* @throws {BeaconCoordinatorError} If the number of participants is less than the minimum required.
|
|
112
|
+
* @returns {void}
|
|
113
|
+
*/
|
|
114
|
+
finalize() {
|
|
115
|
+
if (this.participants.length < this.minParticipants) {
|
|
116
|
+
throw new BeaconCoordinatorError('Not enough participants to finalize the cohort', 'FINALIZE_COHORT_ERROR', {
|
|
117
|
+
cohortId: this.id,
|
|
118
|
+
participants: this.participants,
|
|
119
|
+
minParticipants: this.minParticipants
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
this.status = COHORT_STATUS.COHORT_SET_STATUS;
|
|
123
|
+
this.beaconAddress = this.calulateBeaconAddress();
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Calculates the beacon Taproot multisig address for the cohort using participant keys.
|
|
127
|
+
* @returns {string} The Taproot address for the cohort.
|
|
128
|
+
* @throws {BeaconCoordinatorError} If the Taproot address cannot be calculated.
|
|
129
|
+
*/
|
|
130
|
+
calulateBeaconAddress() {
|
|
131
|
+
const keyAggContext = keyAggregate(this.cohortKeys);
|
|
132
|
+
const aggPubkey = keyAggExport(keyAggContext);
|
|
133
|
+
const payment = payments.p2tr({ internalPubkey: aggPubkey });
|
|
134
|
+
if (!payment.hash) {
|
|
135
|
+
throw new BeaconCoordinatorError('Failed to calculate Taproot Merkle root', 'CALCULATE_BEACON_MERKLE_ROOT_ERROR', {
|
|
136
|
+
cohortId: this.id,
|
|
137
|
+
cohortKeys: this.cohortKeys,
|
|
138
|
+
minParticipants: this.minParticipants
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
this.trMerkleRoot = payment.hash;
|
|
142
|
+
if (!payment.address) {
|
|
143
|
+
throw new BeaconCoordinatorError('Failed to calculate Taproot address', 'CALCULATE_BEACON_ADDRESS_ERROR', {
|
|
144
|
+
cohortId: this.id,
|
|
145
|
+
cohortKeys: this.cohortKeys,
|
|
146
|
+
minParticipants: this.minParticipants
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return payment.address;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Generates a CohortReadyMessage to be sent to participants when the cohort is set.
|
|
153
|
+
* @param {string} to The DID of the participant to whom the message is sent.
|
|
154
|
+
* @param {string} from The DID of the coordinator sending the message.
|
|
155
|
+
* @returns {BeaconCohortReadyMessage} The CohortReadyMessage containing the cohort details.
|
|
156
|
+
*/
|
|
157
|
+
getCohortReadyMessage(to, from) {
|
|
158
|
+
if (this.status !== COHORT_STATUS.COHORT_SET_STATUS) {
|
|
159
|
+
throw new BeaconCoordinatorError('Cohort status not "COHORT_SET".');
|
|
160
|
+
}
|
|
161
|
+
return new BeaconCohortReadyMessage({
|
|
162
|
+
to,
|
|
163
|
+
from,
|
|
164
|
+
cohortId: this.id,
|
|
165
|
+
beaconAddress: this.beaconAddress,
|
|
166
|
+
cohortKeys: this.cohortKeys,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Adds a signature request to the pending requests for the cohort.
|
|
171
|
+
* @param {BeaconCohortRequestSignatureMessage} message The signature request message to add.
|
|
172
|
+
* @throws {Error} If a signature request from the same participant already exists.
|
|
173
|
+
*/
|
|
174
|
+
addSignatureRequest(message) {
|
|
175
|
+
if (!this.validateSignatureRequest(message)) {
|
|
176
|
+
throw new BeaconCoordinatorError(`No signature request from ${message.from} in cohort ${this.id}.`);
|
|
177
|
+
}
|
|
178
|
+
if (!message.body?.data) {
|
|
179
|
+
throw new BeaconCoordinatorError(`No signature data in request from ${message.from} in cohort ${this.id}.`);
|
|
180
|
+
}
|
|
181
|
+
this.pendingSignatureRequests[message.from] = message.body.data;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Validates a signature request message to ensure it is from a participant in the cohort.
|
|
185
|
+
* @param {BeaconCohortRequestSignatureMessage} message The signature request message to validate.
|
|
186
|
+
* @returns {boolean} True if the message is valid, false otherwise.
|
|
187
|
+
*/
|
|
188
|
+
validateSignatureRequest(message) {
|
|
189
|
+
const cohortId = message.body?.cohortId;
|
|
190
|
+
if (cohortId !== this.id) {
|
|
191
|
+
console.info(`Signature request for wrong cohort: ${cohortId}.`);
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
if (!this.participants.includes(message.from)) {
|
|
195
|
+
console.info(`Participant ${message.from} not in cohort ${this.id}.`);
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Starts a signing session for the cohort.
|
|
202
|
+
* @returns {BeaconCohortSigningSession} The request signature message for the signing session.
|
|
203
|
+
*/
|
|
204
|
+
startSigningSession() {
|
|
205
|
+
console.debug(`Starting signing session for cohort ${this.id} with status ${this.status}`);
|
|
206
|
+
if (this.status !== COHORT_STATUS.COHORT_SET_STATUS) {
|
|
207
|
+
throw new BeaconCoordinatorError(`Cohort ${this.id} is not set.`);
|
|
208
|
+
}
|
|
209
|
+
// const smtRootBytes = new Uint8Array(32).map(() => Math.floor(Math.random() * 256));
|
|
210
|
+
const cohort = new AggregateBeaconCohort(this);
|
|
211
|
+
return new BeaconCohortSigningSession({
|
|
212
|
+
cohort,
|
|
213
|
+
pendingTx: new Transaction(),
|
|
214
|
+
processedRequests: this.pendingSignatureRequests,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Converts the cohort instance to a JSON object representation.
|
|
219
|
+
* @returns {BeaconCohort} The JSON object representation of the cohort.
|
|
220
|
+
*/
|
|
221
|
+
json() {
|
|
222
|
+
return Object.json(this);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/cohort/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACx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;YACtE,OAAO,KAAK,CAAC;QACf,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;OAGG;IACI,mBAAmB;QACxB,OAAO,CAAC,KAAK,CAAC,uCAAuC,IAAI,CAAC,EAAE,gBAAgB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3F,IAAG,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC,iBAAiB,EAAE,CAAC;YACnD,MAAM,IAAI,sBAAsB,CAAC,UAAU,IAAI,CAAC,EAAE,cAAc,CAAC,CAAC;QACpE,CAAC;QACD,sFAAsF;QACtF,MAAM,MAAM,GAAG,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,IAAI,0BAA0B,CAAC;YACpC,MAAM;YACN,SAAS,EAAW,IAAI,WAAW,EAAE;YACrC,iBAAiB,EAAG,IAAI,CAAC,wBAAwB;SAClD,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACI,IAAI;QACT,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAiB,CAAC;IAC3C,CAAC;CACF"}
|
package/dist/{esm/core/beacon/aggregation → cjs/core/beacon/aggregation/cohort}/messages/base.js
RENAMED
|
@@ -3,18 +3,16 @@ export class BaseMessage {
|
|
|
3
3
|
type;
|
|
4
4
|
to;
|
|
5
5
|
from;
|
|
6
|
-
threadId;
|
|
7
6
|
body;
|
|
8
|
-
constructor({ type, to, from,
|
|
7
|
+
constructor({ type, to, from, body }) {
|
|
9
8
|
this.type = type;
|
|
10
9
|
this.to = to;
|
|
11
10
|
this.from = from;
|
|
12
|
-
this.threadId = threadId;
|
|
13
11
|
this.body = body;
|
|
14
12
|
}
|
|
15
13
|
/**
|
|
16
14
|
* Creates a BaseMessage from a JSON object.
|
|
17
|
-
* @param {Maybe<Base>} data
|
|
15
|
+
* @param {Maybe<Base>} data The JSON object to initialize the BaseMessage.
|
|
18
16
|
* @returns {BaseMessage} The initialized BaseMessage.
|
|
19
17
|
*/
|
|
20
18
|
static fromJSON(data) {
|
|
@@ -25,13 +23,7 @@ export class BaseMessage {
|
|
|
25
23
|
* @returns {Base} The JSON representation of the BaseMessage.
|
|
26
24
|
*/
|
|
27
25
|
json() {
|
|
28
|
-
return
|
|
29
|
-
type: this.type,
|
|
30
|
-
to: this.to,
|
|
31
|
-
from: this.from,
|
|
32
|
-
threadId: this.threadId,
|
|
33
|
-
body: this.body ?? {}
|
|
34
|
-
};
|
|
26
|
+
return Object.json(this);
|
|
35
27
|
}
|
|
36
28
|
}
|
|
37
29
|
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../../../src/core/beacon/aggregation/cohort/messages/base.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAyBrD,MAAM,OAAO,WAAW;IACf,IAAI,CAAS;IACb,EAAE,CAAU;IACZ,IAAI,CAAS;IACb,IAAI,CAAY;IAEvB,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAQ;QACxC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAiB;QACtC,OAAO,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,IAAI;QACT,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAS,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const BEACON_COHORT_MESSAGE_PREFIX = 'https://btcr2.dev';
|
|
2
|
+
export const BEACON_COHORT_ADVERT = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/keygen/beacon/cohort_advert`;
|
|
3
|
+
export const BEACON_COHORT_OPT_IN = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/keygen/beacon/cohort_opt_in`;
|
|
4
|
+
export const BEACON_COHORT_OPT_IN_ACCEPT = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/keygen/beacon/cohort_opt_in_accept`;
|
|
5
|
+
export const BEACON_COHORT_READY = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/keygen/beacon/cohort_ready`;
|
|
6
|
+
export const BEACON_COHORT_REQUEST_SIGNATURE = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/sign/beacon/cohort_request_signature`;
|
|
7
|
+
export const BEACON_COHORT_AUTHORIZATION_REQUEST = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/sign/beacon/cohort_authorization_request`;
|
|
8
|
+
export const BEACON_COHORT_NONCE_CONTRIBUTION = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/sign/beacon/cohort_nonce_contribution`;
|
|
9
|
+
export const BEACON_COHORT_AGGREGATED_NONCE = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/sign/beacon/cohort_aggregated_nonce`;
|
|
10
|
+
export const BEACON_COHORT_SIGNATURE_AUTHORIZATION = `${BEACON_COHORT_MESSAGE_PREFIX}/musig2/sign/beacon/cohort_signature_authorization`;
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../src/core/beacon/aggregation/cohort/messages/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAEhE,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,4BAA4B,qCAAqC,CAAC;AACzG,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,4BAA4B,qCAAqC,CAAC;AACzG,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,4BAA4B,4CAA4C,CAAC;AACvH,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,4BAA4B,oCAAoC,CAAC;AAEvG,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,4BAA4B,8CAA8C,CAAC;AAC7H,MAAM,CAAC,MAAM,mCAAmC,GAAG,GAAG,4BAA4B,kDAAkD,CAAC;AACrI,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAG,4BAA4B,+CAA+C,CAAC;AAC/H,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,4BAA4B,6CAA6C,CAAC;AAC3H,MAAM,CAAC,MAAM,qCAAqC,GAAG,GAAG,4BAA4B,oDAAoD,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { BEACON_COHORT_ADVERT, BEACON_COHORT_AGGREGATED_NONCE, BEACON_COHORT_AUTHORIZATION_REQUEST, BEACON_COHORT_NONCE_CONTRIBUTION, BEACON_COHORT_OPT_IN, BEACON_COHORT_OPT_IN_ACCEPT, BEACON_COHORT_READY, BEACON_COHORT_REQUEST_SIGNATURE, BEACON_COHORT_SIGNATURE_AUTHORIZATION } from './constants.js';
|
|
2
|
+
/**
|
|
3
|
+
* AggregateBeaconMessage is a utility class that provides constants and type checks
|
|
4
|
+
* for various message types used in the aggregate beacon communication protocol.
|
|
5
|
+
* It includes methods to validate message types and retrieve message types from objects.
|
|
6
|
+
* @class AggregateBeaconMessage
|
|
7
|
+
* @type {AggregateBeaconMessageType}
|
|
8
|
+
*/
|
|
9
|
+
export class AggregateBeaconMessage {
|
|
10
|
+
static BEACON_COHORT_ADVERT = BEACON_COHORT_ADVERT;
|
|
11
|
+
static BEACON_COHORT_OPT_IN = BEACON_COHORT_OPT_IN;
|
|
12
|
+
static BEACON_COHORT_READY = BEACON_COHORT_READY;
|
|
13
|
+
static BEACON_COHORT_OPT_IN_ACCEPT = BEACON_COHORT_OPT_IN_ACCEPT;
|
|
14
|
+
static BEACON_COHORT_KEY_GEN_MESSAGES = new Map([
|
|
15
|
+
['BEACON_COHORT_ADVERT', 'BEACON_COHORT_ADVERT'],
|
|
16
|
+
['BEACON_COHORT_OPT_IN', 'BEACON_COHORT_OPT_IN'],
|
|
17
|
+
['BEACON_COHORT_READY', 'BEACON_COHORT_READY'],
|
|
18
|
+
['BEACON_COHORT_OPT_IN_ACCEPT', 'BEACON_COHORT_OPT_IN_ACCEPT'],
|
|
19
|
+
]);
|
|
20
|
+
static BEACON_COHORT_REQUEST_SIGNATURE = BEACON_COHORT_REQUEST_SIGNATURE;
|
|
21
|
+
static BEACON_COHORT_AUTHORIZATION_REQUEST = BEACON_COHORT_AUTHORIZATION_REQUEST;
|
|
22
|
+
static BEACON_COHORT_NONCE_CONTRIBUTION = BEACON_COHORT_NONCE_CONTRIBUTION;
|
|
23
|
+
static BEACON_COHORT_AGGREGATED_NONCE = BEACON_COHORT_AGGREGATED_NONCE;
|
|
24
|
+
static BEACON_COHORT_SIGNATURE_AUTHORIZATION = BEACON_COHORT_SIGNATURE_AUTHORIZATION;
|
|
25
|
+
static BEACON_COHORT_SIGN_MESSAGES = new Map([
|
|
26
|
+
['BEACON_COHORT_REQUEST_SIGNATURE', 'BEACON_COHORT_REQUEST_SIGNATURE'],
|
|
27
|
+
['BEACON_COHORT_AUTHORIZATION_REQUEST', 'BEACON_COHORT_AUTHORIZATION_REQUEST'],
|
|
28
|
+
['BEACON_COHORT_NONCE_CONTRIBUTION', 'BEACON_COHORT_NONCE_CONTRIBUTION'],
|
|
29
|
+
['BEACON_COHORT_AGGREGATED_NONCE', 'BEACON_COHORT_AGGREGATED_NONCE'],
|
|
30
|
+
['BEACON_COHORT_SIGNATURE_AUTHORIZATION', 'BEACON_COHORT_SIGNATURE_AUTHORIZATION'],
|
|
31
|
+
]);
|
|
32
|
+
static ALL_MESSAGES = [
|
|
33
|
+
BEACON_COHORT_ADVERT,
|
|
34
|
+
BEACON_COHORT_OPT_IN,
|
|
35
|
+
BEACON_COHORT_READY,
|
|
36
|
+
BEACON_COHORT_OPT_IN_ACCEPT,
|
|
37
|
+
BEACON_COHORT_REQUEST_SIGNATURE,
|
|
38
|
+
BEACON_COHORT_AUTHORIZATION_REQUEST,
|
|
39
|
+
BEACON_COHORT_NONCE_CONTRIBUTION,
|
|
40
|
+
BEACON_COHORT_AGGREGATED_NONCE,
|
|
41
|
+
BEACON_COHORT_SIGNATURE_AUTHORIZATION
|
|
42
|
+
];
|
|
43
|
+
/**
|
|
44
|
+
* Checks if the name provided is a valid message name.
|
|
45
|
+
* @param {string} type - The type of the message.
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
static isValidType(type) {
|
|
49
|
+
return this.BEACON_COHORT_KEY_GEN_MESSAGES.has(type) || this.BEACON_COHORT_SIGN_MESSAGES.has(type);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Get the message value based on the type.
|
|
53
|
+
* @param {string} type - The type (or name) of the message.
|
|
54
|
+
* @returns {string | undefined} - The corresponding type value.
|
|
55
|
+
*/
|
|
56
|
+
static getMessageValueByType(type) {
|
|
57
|
+
if (!this.isValidType(type)) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
return this.BEACON_COHORT_KEY_GEN_MESSAGES.get(type) || this.BEACON_COHORT_SIGN_MESSAGES.get(type);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Checks if the provided type is a valid AggregateBeaconMessageType.
|
|
64
|
+
* @param {string} type - The message type to check.
|
|
65
|
+
* @returns {boolean} - Returns true if the type is valid, otherwise false.
|
|
66
|
+
*/
|
|
67
|
+
static isValidValue(type) {
|
|
68
|
+
return this.ALL_MESSAGES.includes(type);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Checks if the provided type is a valid KeyGenMessageType.
|
|
72
|
+
* @param {string} value - The message type to check.
|
|
73
|
+
* @returns {boolean} - Returns true if the type is a key generation message type, otherwise false.
|
|
74
|
+
*/
|
|
75
|
+
static isKeyGenMessageValue(value) {
|
|
76
|
+
return this.isValidValue(value) && [
|
|
77
|
+
BEACON_COHORT_ADVERT,
|
|
78
|
+
BEACON_COHORT_READY,
|
|
79
|
+
BEACON_COHORT_OPT_IN,
|
|
80
|
+
BEACON_COHORT_OPT_IN_ACCEPT,
|
|
81
|
+
].includes(value);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Checks if the provided type is a valid SignMessageType.
|
|
85
|
+
* @param {string} value - The message type to check.
|
|
86
|
+
* @returns {boolean} - Returns true if the type is a sign message type, otherwise false.
|
|
87
|
+
*/
|
|
88
|
+
static isSignMessageValue(value) {
|
|
89
|
+
return this.isValidValue(value) && [
|
|
90
|
+
BEACON_COHORT_AGGREGATED_NONCE,
|
|
91
|
+
BEACON_COHORT_AUTHORIZATION_REQUEST,
|
|
92
|
+
BEACON_COHORT_NONCE_CONTRIBUTION,
|
|
93
|
+
BEACON_COHORT_REQUEST_SIGNATURE,
|
|
94
|
+
BEACON_COHORT_SIGNATURE_AUTHORIZATION
|
|
95
|
+
].includes(value);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/core/beacon/aggregation/cohort/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,8BAA8B,EAC9B,mCAAmC,EACnC,gCAAgC,EAChC,oBAAoB,EACpB,2BAA2B,EAC3B,mBAAmB,EACnB,+BAA+B,EAC/B,qCAAqC,EACtC,MAAM,gBAAgB,CAAC;AA4BxB;;;;;;GAMG;AACH,MAAM,OAAO,sBAAsB;IACjC,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,MAAM,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;IACnD,MAAM,CAAC,mBAAmB,GAAG,mBAAmB,CAAC;IACjD,MAAM,CAAC,2BAA2B,GAAG,2BAA2B,CAAC;I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AC3B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,CAAC,8BAA8B,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrG,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,YAAY,CAAC,IAAY;QAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CAAC,KAAa;QACvC,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI;YACjC,oBAAoB;YACpB,mBAAmB;YACnB,oBAAoB;YACpB,2BAA2B;SAC5B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,kBAAkB,CAAC,KAAa;QACrC,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI;YACjC,8BAA8B;YAC9B,mCAAmC;YACnC,gCAAgC;YAChC,+BAA+B;YAC/B,qCAAqC;SACtC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseMessage } from '../base.js';
|
|
2
|
+
import { BEACON_COHORT_ADVERT } from '../constants.js';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a message advertising a cohort to potential participants.
|
|
5
|
+
* @class BeaconCohortAdvertMessage
|
|
6
|
+
* @extends BaseMessage
|
|
7
|
+
* @type {BeaconCohortAdvertMessage}
|
|
8
|
+
*/
|
|
9
|
+
export class BeaconCohortAdvertMessage extends BaseMessage {
|
|
10
|
+
id;
|
|
11
|
+
constructor({ from, id, cohortId, cohortSize, beaconType, network }) {
|
|
12
|
+
const body = { cohortId, cohortSize, beaconType, network };
|
|
13
|
+
const type = BEACON_COHORT_ADVERT;
|
|
14
|
+
super({ from, body, type });
|
|
15
|
+
this.id = id || `${type}/${cohortId}`;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Initializes a BeaconCohortAdvertMessage from a possible CohortAdvertMessage object.
|
|
19
|
+
* @param {CohortAdvertMessage} data The CohortAdvertMessage object to initialize the BeaconCohortAdvertMessage.
|
|
20
|
+
* @returns {BeaconCohortAdvertMessage} The new BeaconCohortAdvertMessage.
|
|
21
|
+
*/
|
|
22
|
+
static fromJSON(data) {
|
|
23
|
+
const message = JSON.parse(data);
|
|
24
|
+
if (message.type !== BEACON_COHORT_ADVERT) {
|
|
25
|
+
throw new Error(`Invalid type: ${message.type}`);
|
|
26
|
+
}
|
|
27
|
+
return new BeaconCohortAdvertMessage(message);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=cohort-advert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cohort-advert.js","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAYvD;;;;;GAKG;AACH,MAAM,OAAO,yBAA0B,SAAQ,WAAW;IACjD,EAAE,CAAS;IAElB,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAuB;QACtF,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;QAC3D,MAAM,IAAI,GAAG,oBAAoB,CAAC;QAClC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5B,IAAI,CAAC,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,IAAI,QAAQ,EAAE,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAgC;QACrD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,OAAO,CAAC,IAAI,KAAK,oBAAoB,EAAC,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseMessage } from '../base.js';
|
|
2
|
+
import { BEACON_COHORT_READY } from '../constants.js';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a message indicating that a cohort has met the required conditions.
|
|
5
|
+
* @class BeaconCohortReadyMessage
|
|
6
|
+
* @extends BaseMessage
|
|
7
|
+
* @type {BeaconCohortReadyMessage}
|
|
8
|
+
*/
|
|
9
|
+
export class BeaconCohortReadyMessage extends BaseMessage {
|
|
10
|
+
constructor({ from, to, cohortId, beaconAddress, cohortKeys }) {
|
|
11
|
+
const body = { cohortId, beaconAddress, cohortKeys };
|
|
12
|
+
const type = BEACON_COHORT_READY;
|
|
13
|
+
super({ from, to, body, type });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Initializes an BeaconCohortReadyMessage from a given OptIn object.
|
|
17
|
+
* @param {CohortReadyMessage} data The CohortReadyMessage object to initialize the BeaconCohortReadyMessage.
|
|
18
|
+
* @returns {BeaconCohortReadyMessage} The new BeaconCohortReadyMessage.
|
|
19
|
+
*/
|
|
20
|
+
static fromJSON(data) {
|
|
21
|
+
const message = JSON.parse(data);
|
|
22
|
+
if (message.type !== BEACON_COHORT_READY) {
|
|
23
|
+
throw new Error(`Invalid type: ${message.type}`);
|
|
24
|
+
}
|
|
25
|
+
return new BeaconCohortReadyMessage(message);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=cohort-ready.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cohort-ready.js","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAWtD;;;;;GAKG;AACH,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IACvD,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAsB;QAC/E,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,CAAC;QACrD,MAAM,IAAI,GAAG,mBAAmB,CAAC;QACjC,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAA+B;QACpD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,OAAO,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { BaseMessage } from '../base.js';
|
|
2
|
+
import { BEACON_COHORT_OPT_IN_ACCEPT } from '../constants.js';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a message for a coordinator accepting a participant subscribe to a cohort.
|
|
5
|
+
* @class BeaconCohortOptInAcceptMessage
|
|
6
|
+
* @extends BaseMessage
|
|
7
|
+
* @type {BeaconCohortOptInAcceptMessage}
|
|
8
|
+
*/
|
|
9
|
+
export class BeaconCohortOptInAcceptMessage extends BaseMessage {
|
|
10
|
+
constructor({ to, from }) {
|
|
11
|
+
super({ to, from, type: BEACON_COHORT_OPT_IN_ACCEPT });
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Initializes a BeaconCohortOptInAcceptMessage from a possible CohortOptInAcceptMessage object.
|
|
15
|
+
* @param {CohortOptInAcceptMessage} data The CohortOptInAcceptMessage object to initialize the BeaconCohortOptInAcceptMessage.
|
|
16
|
+
* @returns {BeaconCohortOptInAcceptMessage} The new BeaconCohortOptInAcceptMessage.
|
|
17
|
+
*/
|
|
18
|
+
static fromJSON(data) {
|
|
19
|
+
const message = JSON.parse(data);
|
|
20
|
+
if (message.type != BEACON_COHORT_OPT_IN_ACCEPT) {
|
|
21
|
+
throw new Error(`Invalid type: ${message.type}`);
|
|
22
|
+
}
|
|
23
|
+
return new BeaconCohortOptInAcceptMessage(message);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=opt-in-accept.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opt-in-accept.js","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAQ9D;;;;;GAKG;AACH,MAAM,OAAO,8BAA+B,SAAQ,WAAW;IAC7D,YAAY,EAAE,EAAE,EAAE,IAAI,EAA4B;QAChD,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,2BAA2B,EAAE,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAqC;QAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,OAAO,CAAC,IAAI,IAAI,2BAA2B,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,8BAA8B,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BaseMessage } from '../base.js';
|
|
2
|
+
import { BEACON_COHORT_OPT_IN } from '../constants.js';
|
|
3
|
+
export class BeaconCohortOptInMessage extends BaseMessage {
|
|
4
|
+
constructor({ from, to, cohortId, participantPk }) {
|
|
5
|
+
const body = { cohortId, participantPk };
|
|
6
|
+
const type = BEACON_COHORT_OPT_IN;
|
|
7
|
+
super({ from, to, body, type });
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Initializes a BeaconCohortOptInMessage from a possible CohortOptInMessage object.
|
|
11
|
+
* @param {CohortOptInMessage} data The CohortOptInMessage object to initialize the BeaconCohortOptInMessage.
|
|
12
|
+
* @returns {BeaconCohortOptInMessage} The new BeaconCohortOptInMessage.
|
|
13
|
+
*/
|
|
14
|
+
static fromJSON(data) {
|
|
15
|
+
const message = JSON.parse(data);
|
|
16
|
+
if (message.type != BEACON_COHORT_OPT_IN) {
|
|
17
|
+
throw new Error(`Invalid type: ${message.type}`);
|
|
18
|
+
}
|
|
19
|
+
return new BeaconCohortOptInMessage(message);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=opt-in.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opt-in.js","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAUvD,MAAM,OAAO,wBAAyB,SAAQ,WAAW;IAEvD,YAAY,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAsB;QACnE,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,oBAAoB,CAAC;QAClC,KAAK,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAA+B;QACpD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,OAAO,CAAC,IAAI,IAAI,oBAAoB,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,wBAAwB,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseMessage } from '../base.js';
|
|
2
|
+
import { BEACON_COHORT_OPT_IN_ACCEPT } from '../constants.js';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a message for subscribing to a cohort.
|
|
5
|
+
* This message is sent by a coordinator to a participant to indicate acceptance in the cohort.
|
|
6
|
+
* @class BeaconCohortSubscribeMessage
|
|
7
|
+
* @extends BaseMessage
|
|
8
|
+
* @type {BeaconCohortSubscribeMessage}
|
|
9
|
+
*/
|
|
10
|
+
export class BeaconCohortSubscribeMessage extends BaseMessage {
|
|
11
|
+
constructor({ to, from }) {
|
|
12
|
+
super({ to, from, type: BEACON_COHORT_OPT_IN_ACCEPT });
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Initializes a BeaconCohortSubscribeMessage from a possible CohortSubscribeMessage object.
|
|
16
|
+
* @param {CohortSubscribeMessage} data The Subscribe object to initialize the SubscribeMessage.
|
|
17
|
+
* @returns {BeaconCohortSubscribeMessage} The serialized SubscribeMessage.
|
|
18
|
+
*/
|
|
19
|
+
static fromJSON(data) {
|
|
20
|
+
const message = JSON.parse(data);
|
|
21
|
+
if (message.type != BEACON_COHORT_OPT_IN_ACCEPT) {
|
|
22
|
+
throw new Error(`Invalid type: ${message.type}`);
|
|
23
|
+
}
|
|
24
|
+
return new BeaconCohortSubscribeMessage(message);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=subscribe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe.js","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAQ9D;;;;;;GAMG;AACH,MAAM,OAAO,4BAA6B,SAAQ,WAAW;IAC3D,YAAY,EAAE,EAAE,EAAE,IAAI,EAA0B;QAC9C,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,2BAA2B,EAAE,CAAC,CAAC;IACzD,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAmC;QACxD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,OAAO,CAAC,IAAI,IAAI,2BAA2B,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,4BAA4B,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseMessage } from '../base.js';
|
|
2
|
+
import { BEACON_COHORT_AGGREGATED_NONCE } from '../constants.js';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a message containing an aggregated nonce for a cohort in the Beacon protocol.
|
|
5
|
+
* @class BeaconCohortAggregatedNonceMessage
|
|
6
|
+
* @extends BaseMessage
|
|
7
|
+
* @type {BeaconCohortAggregatedNonceMessage}
|
|
8
|
+
*/
|
|
9
|
+
export class BeaconCohortAggregatedNonceMessage extends BaseMessage {
|
|
10
|
+
constructor({ to, from, cohortId, sessionId, aggregatedNonce }) {
|
|
11
|
+
const body = { cohortId, sessionId, aggregatedNonce };
|
|
12
|
+
const type = BEACON_COHORT_AGGREGATED_NONCE;
|
|
13
|
+
super({ to, from, body, type });
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Initializes a BeaconCohortAggregatedNonceMessage from a given AggregatedNonce object.
|
|
17
|
+
* @param {CohortAggregatedNonceMessage} data The data object to initialize the BeaconCohortAggregatedNonceMessage.
|
|
18
|
+
* @returns {BeaconCohortAggregatedNonceMessage} The new BeaconCohortAggregatedNonceMessage.
|
|
19
|
+
*/
|
|
20
|
+
static fromJSON(data) {
|
|
21
|
+
const message = JSON.parse(data);
|
|
22
|
+
if (message.type != BEACON_COHORT_AGGREGATED_NONCE) {
|
|
23
|
+
throw new Error(`Invalid type: ${message.type}`);
|
|
24
|
+
}
|
|
25
|
+
return new BeaconCohortAggregatedNonceMessage(message);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=aggregated-nonce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aggregated-nonce.js","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAUjE;;;;;GAKG;AACH,MAAM,OAAO,kCAAmC,SAAQ,WAAW;IACjE,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAgC;QAC1F,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;QACtD,MAAM,IAAI,GAAG,8BAA8B,CAAC;QAC5C,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAAyC;QAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,OAAO,CAAC,IAAI,IAAI,8BAA8B,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,kCAAkC,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseMessage } from '../base.js';
|
|
2
|
+
import { BEACON_COHORT_AUTHORIZATION_REQUEST } from '../constants.js';
|
|
3
|
+
/**
|
|
4
|
+
* Sends the unsigned PSBT that spends the Beacon UTXO (plus any SMT proofs).
|
|
5
|
+
* Asks the cohort to begin a MuSig2 signing session.
|
|
6
|
+
* @class BeaconCohortAuthorizationRequestMessage
|
|
7
|
+
* @extends BaseMessage
|
|
8
|
+
* @type {CohortAuthorizationRequestMessage}
|
|
9
|
+
*/
|
|
10
|
+
export class BeaconCohortAuthorizationRequestMessage extends BaseMessage {
|
|
11
|
+
constructor({ to, from, cohortId, sessionId, pendingTx }) {
|
|
12
|
+
const body = { cohortId, sessionId, pendingTx };
|
|
13
|
+
const type = BEACON_COHORT_AUTHORIZATION_REQUEST;
|
|
14
|
+
super({ to, from, body, type });
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Initializes a BeaconCohortAuthorizationRequestMessage from a given AuthorizationRequest object.
|
|
18
|
+
* @param {CohortAuthorizationRequestMessage} data The data object to initialize the BeaconCohortAuthorizationRequestMessage.
|
|
19
|
+
* @returns {BeaconCohortAuthorizationRequestMessage} The serialized BeaconCohortAuthorizationRequestMessage.
|
|
20
|
+
*/
|
|
21
|
+
static fromJSON(data) {
|
|
22
|
+
const message = JSON.parse(data);
|
|
23
|
+
if (message.type != BEACON_COHORT_AUTHORIZATION_REQUEST) {
|
|
24
|
+
throw new Error(`Invalid type: ${message.type}`);
|
|
25
|
+
}
|
|
26
|
+
return new BeaconCohortAuthorizationRequestMessage(message);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=authorization-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-request.js","sourceRoot":"","sources":["../../../../../../../../src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,mCAAmC,EAAE,MAAM,iBAAiB,CAAC;AAUtE;;;;;;GAMG;AACH,MAAM,OAAO,uCAAwC,SAAQ,WAAW;IACtE,YAAY,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAqC;QACzF,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;QAChD,MAAM,IAAI,GAAG,mCAAmC,CAAC;QACjD,KAAK,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,QAAQ,CAAC,IAA8C;QACnE,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,OAAO,CAAC,IAAI,IAAI,mCAAmC,EAAE,CAAC;YACxD,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QACnD,CAAC;QACD,OAAO,IAAI,uCAAuC,CAAC,OAAO,CAAC,CAAC;IAC9D,CAAC;CACF"}
|