@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
|
@@ -1,2 +1,436 @@
|
|
|
1
|
-
|
|
1
|
+
import { Logger } from '@did-btcr2/common';
|
|
2
|
+
import { HDKey } from '@scure/bip32';
|
|
3
|
+
import { mnemonicToSeedSync } from '@scure/bip39';
|
|
4
|
+
import * as musig2 from '@scure/btc-signer/musig2';
|
|
5
|
+
import { Transaction } from 'bitcoinjs-lib';
|
|
6
|
+
import { BeaconParticipantError } from '../error.js';
|
|
7
|
+
import { AggregateBeaconCohort } from './cohort/index.js';
|
|
8
|
+
import { BEACON_COHORT_ADVERT, BEACON_COHORT_AGGREGATED_NONCE, BEACON_COHORT_AUTHORIZATION_REQUEST, BEACON_COHORT_OPT_IN_ACCEPT, BEACON_COHORT_READY } from './cohort/messages/constants.js';
|
|
9
|
+
import { BeaconCohortAdvertMessage } from './cohort/messages/keygen/cohort-advert.js';
|
|
10
|
+
import { BeaconCohortReadyMessage } from './cohort/messages/keygen/cohort-ready.js';
|
|
11
|
+
import { BeaconCohortOptInAcceptMessage } from './cohort/messages/keygen/opt-in-accept.js';
|
|
12
|
+
import { BeaconCohortOptInMessage } from './cohort/messages/keygen/opt-in.js';
|
|
13
|
+
import { BeaconCohortSubscribeMessage } from './cohort/messages/keygen/subscribe.js';
|
|
14
|
+
import { BeaconCohortAggregatedNonceMessage } from './cohort/messages/sign/aggregated-nonce.js';
|
|
15
|
+
import { BeaconCohortAuthorizationRequestMessage } from './cohort/messages/sign/authorization-request.js';
|
|
16
|
+
import { BeaconCohortNonceContributionMessage } from './cohort/messages/sign/nonce-contribution.js';
|
|
17
|
+
import { BeaconCohortRequestSignatureMessage } from './cohort/messages/sign/request-signature.js';
|
|
18
|
+
import { BeaconCohortSignatureAuthorizationMessage } from './cohort/messages/sign/signature-authorization.js';
|
|
19
|
+
import { COHORT_STATUS } from './cohort/status.js';
|
|
20
|
+
import { NostrAdapter } from './communication/adapter/nostr.js';
|
|
21
|
+
import { BeaconCohortSigningSession } from './session/index.js';
|
|
22
|
+
/**
|
|
23
|
+
* Represents a participant in the did:btc1 Beacon Aggregation protocol.
|
|
24
|
+
* @class BeaconParticipant
|
|
25
|
+
* @type {BeaconParticipant}
|
|
26
|
+
*/
|
|
27
|
+
export class BeaconParticipant {
|
|
28
|
+
/**
|
|
29
|
+
* The name of the BeaconParticipant service.
|
|
30
|
+
* @type {string}
|
|
31
|
+
*/
|
|
32
|
+
name;
|
|
33
|
+
/**
|
|
34
|
+
* The DID of the BeaconParticipant.
|
|
35
|
+
* @type {Array<string>}
|
|
36
|
+
*/
|
|
37
|
+
did;
|
|
38
|
+
/**
|
|
39
|
+
* The communication protocol used by the BeaconParticipant.
|
|
40
|
+
* @type {CommunicationService}
|
|
41
|
+
*/
|
|
42
|
+
protocol;
|
|
43
|
+
/**
|
|
44
|
+
* The HD key used by the BeaconParticipant.
|
|
45
|
+
* @type {HDKey}
|
|
46
|
+
*/
|
|
47
|
+
hdKey;
|
|
48
|
+
/**
|
|
49
|
+
* The current index for the beacon key.
|
|
50
|
+
* @type {number}
|
|
51
|
+
*/
|
|
52
|
+
beaconKeyIndex = 0;
|
|
53
|
+
/**
|
|
54
|
+
* The coordinator DIDs that the participant is subscribed to.
|
|
55
|
+
* @type {Array<string>}
|
|
56
|
+
*/
|
|
57
|
+
coordinatorDids = new Array();
|
|
58
|
+
/**
|
|
59
|
+
* The cohorts that the participant is part of.
|
|
60
|
+
* @type {Array<AggregateBeaconCohort>}
|
|
61
|
+
*/
|
|
62
|
+
cohorts = new Array();
|
|
63
|
+
/**
|
|
64
|
+
* A mapping of Cohort IDs to HDKey indexes (CohortId => KeyIndex).
|
|
65
|
+
* @type {CohortKeyState}
|
|
66
|
+
*/
|
|
67
|
+
cohortKeyState = new Map();
|
|
68
|
+
/**
|
|
69
|
+
* A mapping of active Session IDs to their sessions (sessionId => BeaconCohortSigningSession).
|
|
70
|
+
* @type {ActiveSigningSessions}
|
|
71
|
+
*/
|
|
72
|
+
activeSigningSessions = new Map();
|
|
73
|
+
/**
|
|
74
|
+
* Creates an instance of BeaconParticipant.
|
|
75
|
+
* @param {BeaconParticipantParams} params The parameters for the participant.
|
|
76
|
+
* @param {Seed | Mnemonic} params.ent The seed or mnemonic to derive the HD key.
|
|
77
|
+
* @param {CommunicationService} params.protocol The communication protocol to use.
|
|
78
|
+
* @param {string} params.did The DID of the participant.
|
|
79
|
+
* @param {string} [params.name] Optional name for the participant. If not provided, a random name will be generated.
|
|
80
|
+
*/
|
|
81
|
+
constructor({ ent, protocol, did, name }) {
|
|
82
|
+
this.did = did;
|
|
83
|
+
this.name = name || `btcr2-beacon-participant-${crypto.randomUUID()}`;
|
|
84
|
+
this.beaconKeyIndex = this.cohortKeyState.size;
|
|
85
|
+
this.hdKey = ent instanceof Uint8Array
|
|
86
|
+
? HDKey.fromMasterSeed(ent)
|
|
87
|
+
: HDKey.fromMasterSeed(mnemonicToSeedSync(ent));
|
|
88
|
+
const { publicKey: pk, privateKey: secret } = this.hdKey.deriveChild(this.beaconKeyIndex);
|
|
89
|
+
if (!pk || !secret) {
|
|
90
|
+
throw new BeaconParticipantError(`Failed to derive HD key for participant ${this.name} at index ${this.beaconKeyIndex}`, 'CONSTRUCTOR_ERROR', { public: pk, secret });
|
|
91
|
+
}
|
|
92
|
+
this.protocol = protocol || new NostrAdapter();
|
|
93
|
+
this.protocol.setKeys({ public: pk, secret });
|
|
94
|
+
this.cohortKeyState.set('__UNSET__', this.beaconKeyIndex);
|
|
95
|
+
Logger.debug(`BeaconParticipant initialized with DID: ${this.did}, Name: ${this.name}, Key Index: ${this.beaconKeyIndex}`);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Setup and start the BeaconParticipant communication protocol..
|
|
99
|
+
* @returns {void}
|
|
100
|
+
*/
|
|
101
|
+
start() {
|
|
102
|
+
Logger.info(`Setting up BeaconParticipant ${this.name} (${this.did}) on ${this.protocol.name} ...`);
|
|
103
|
+
this.protocol.registerMessageHandler(BEACON_COHORT_ADVERT, this._handleCohortAdvert.bind(this));
|
|
104
|
+
this.protocol.registerMessageHandler(BEACON_COHORT_OPT_IN_ACCEPT, this._handleSubscribeAccept.bind(this));
|
|
105
|
+
this.protocol.registerMessageHandler(BEACON_COHORT_READY, this._handleCohortReady.bind(this));
|
|
106
|
+
this.protocol.registerMessageHandler(BEACON_COHORT_AUTHORIZATION_REQUEST, this._handleAuthorizationRequest.bind(this));
|
|
107
|
+
this.protocol.registerMessageHandler(BEACON_COHORT_AGGREGATED_NONCE, this._handleAggregatedNonce.bind(this));
|
|
108
|
+
this.protocol.start();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Retrieves the HD key for a specific cohort based on its ID.
|
|
112
|
+
* @param {string} cohortId The ID of the cohort for which to retrieve the key.
|
|
113
|
+
* @returns {HDKey} The HD key for the cohort, or throws an error if not found.
|
|
114
|
+
* @throws {BeaconParticipantError} If the cohort key state is not found for the given cohort ID.
|
|
115
|
+
*/
|
|
116
|
+
getCohortKey(cohortId) {
|
|
117
|
+
const keyIndex = this.cohortKeyState.get(cohortId);
|
|
118
|
+
if (keyIndex === undefined) {
|
|
119
|
+
throw new BeaconParticipantError(`Cohort key state for cohort ${cohortId} not found.`, 'COHORT_KEY_NOT_FOUND');
|
|
120
|
+
}
|
|
121
|
+
return this.hdKey.deriveChild(keyIndex);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Sets the state of the cohort key for a given cohort ID and key index.
|
|
125
|
+
* @param {string} cohortId The ID of the cohort for which to set the key state.
|
|
126
|
+
* @returns {void}
|
|
127
|
+
*/
|
|
128
|
+
setCohortKey(cohortId) {
|
|
129
|
+
if (this.cohortKeyState.size > 0) {
|
|
130
|
+
this.beaconKeyIndex = this.cohortKeyState.size + 1;
|
|
131
|
+
}
|
|
132
|
+
if (this.cohortKeyState.has(cohortId)) {
|
|
133
|
+
Logger.warn(`Cohort key state for cohort ${cohortId} already exists. Updating key index.`);
|
|
134
|
+
}
|
|
135
|
+
this.cohortKeyState.set(cohortId, this.beaconKeyIndex);
|
|
136
|
+
Logger.info(`Cohort key state updated. Next beacon key index: ${this.beaconKeyIndex + 1}`);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Finalizes the placeholder "__UNSET__" key and assigns it to the provided cohortId.
|
|
140
|
+
* If no "__UNSET__" entry exists, throws an error.
|
|
141
|
+
* If cohortId already exists, logs a warning and does nothing.
|
|
142
|
+
* @param {string} cohortId The ID of the cohort to finalize the unset key for.
|
|
143
|
+
* @throws {BeaconParticipantError} If no "__UNSET__" cohort key state is found.
|
|
144
|
+
* @returns {void}
|
|
145
|
+
*/
|
|
146
|
+
finalizeUnsetCohortKey(cohortId) {
|
|
147
|
+
const unsetKey = '__UNSET__';
|
|
148
|
+
if (!this.cohortKeyState.has(unsetKey)) {
|
|
149
|
+
throw new BeaconParticipantError(`No '__UNSET__' cohort key to finalize for ${this.did}`, 'UNSET_KEY_NOT_FOUND');
|
|
150
|
+
}
|
|
151
|
+
if (this.cohortKeyState.has(cohortId)) {
|
|
152
|
+
Logger.warn(`Cohort key state already exists for ${cohortId}. Skipping migration from '__UNSET__'.`);
|
|
153
|
+
this.cohortKeyState.delete(unsetKey);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.setCohortKey(cohortId);
|
|
157
|
+
this.cohortKeyState.delete(unsetKey);
|
|
158
|
+
Logger.info(`Finalized '__UNSET__' CohortKeyState with ${cohortId} for ${this.did}`);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Handle subscription acceptance from a coordinator.
|
|
162
|
+
* @param {CohortOptInAcceptMessage} message The message containing the subscription acceptance.
|
|
163
|
+
* @returns {Promise<void>}
|
|
164
|
+
*/
|
|
165
|
+
async _handleSubscribeAccept(message) {
|
|
166
|
+
const subscribeAcceptMessage = BeaconCohortOptInAcceptMessage.fromJSON(message);
|
|
167
|
+
const coordinatorDid = subscribeAcceptMessage.from;
|
|
168
|
+
if (!this.coordinatorDids.includes(coordinatorDid)) {
|
|
169
|
+
this.coordinatorDids.push(coordinatorDid);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Handles a cohort advertisement message.
|
|
174
|
+
* @param {Maybe<BeaconCohortAdvertMessage>} message The cohort advertisement message.
|
|
175
|
+
* @returns {Promise<void>}
|
|
176
|
+
*/
|
|
177
|
+
async _handleCohortAdvert(message) {
|
|
178
|
+
Logger.debug('_handleCohortAdvert', message);
|
|
179
|
+
const cohortAdvertMessage = BeaconCohortAdvertMessage.fromJSON(message);
|
|
180
|
+
Logger.info(`Received new cohort announcement from ${cohortAdvertMessage.from}`, cohortAdvertMessage);
|
|
181
|
+
const cohortId = cohortAdvertMessage.body?.cohortId;
|
|
182
|
+
if (!cohortId) {
|
|
183
|
+
Logger.warn('Received malformed cohort advert message: missing cohortId', cohortAdvertMessage);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const network = cohortAdvertMessage.body?.network;
|
|
187
|
+
if (!network) {
|
|
188
|
+
Logger.warn('Received malformed cohort advert message: missing network', cohortAdvertMessage);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const minParticipants = cohortAdvertMessage.body?.cohortSize;
|
|
192
|
+
if (!cohortId || !network || !minParticipants) {
|
|
193
|
+
Logger.warn('Received malformed cohort advert message: missing minParticipants', cohortAdvertMessage);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const from = cohortAdvertMessage.from;
|
|
197
|
+
const cohort = new AggregateBeaconCohort({
|
|
198
|
+
network,
|
|
199
|
+
minParticipants,
|
|
200
|
+
id: cohortId,
|
|
201
|
+
coordinatorDid: from,
|
|
202
|
+
});
|
|
203
|
+
this.cohorts.push(cohort);
|
|
204
|
+
await this.joinCohort(cohort.id, from);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Handles a cohort set message.
|
|
208
|
+
* @param {Maybe<CohortReadyMessage>} message The cohort set message.
|
|
209
|
+
* @returns {Promise<void>}
|
|
210
|
+
*/
|
|
211
|
+
async _handleCohortReady(message) {
|
|
212
|
+
const cohortSetMessage = BeaconCohortReadyMessage.fromJSON(message);
|
|
213
|
+
const cohortId = cohortSetMessage.body?.cohortId;
|
|
214
|
+
const cohort = this.cohorts.find(c => c.id === cohortId);
|
|
215
|
+
if (!cohortId || !cohort) {
|
|
216
|
+
Logger.warn(`Cohort with ID ${cohortId} not found or not joined by participant ${this.did}.`);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
this.finalizeUnsetCohortKey(cohortId);
|
|
220
|
+
const participantPk = this.getCohortKey(cohortId).publicKey?.toHex();
|
|
221
|
+
if (!participantPk) {
|
|
222
|
+
Logger.error(`Failed to derive public key for cohort ${cohortId}`);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const beaconAddress = cohortSetMessage.body?.beaconAddress;
|
|
226
|
+
if (!beaconAddress) {
|
|
227
|
+
Logger.error(`Beacon address not provided in cohort set message for ${cohortId}`);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const cohortKeys = cohortSetMessage.body?.cohortKeys;
|
|
231
|
+
if (!cohortKeys) {
|
|
232
|
+
Logger.error(`Cohort keys not provided in cohort set message for ${cohortId}`);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const keys = cohortKeys.map(key => key.toHex());
|
|
236
|
+
cohort.validateCohort([participantPk], keys, beaconAddress);
|
|
237
|
+
Logger.info(`BeaconParticipant w/ pk ${participantPk} successfully joined cohort ${cohortId} with beacon address ${beaconAddress}.`);
|
|
238
|
+
Logger.info(`Cohort status: ${cohort.status}`);
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Handles an authorization request message.
|
|
242
|
+
* @param {Maybe<CohortAuthorizationRequestMessage>} message The authorization request message.
|
|
243
|
+
* @returns {Promise<void>}
|
|
244
|
+
*/
|
|
245
|
+
async _handleAuthorizationRequest(message) {
|
|
246
|
+
const authRequest = BeaconCohortAuthorizationRequestMessage.fromJSON(message);
|
|
247
|
+
const cohort = this.cohorts.find(c => c.id === authRequest.body?.cohortId);
|
|
248
|
+
if (!cohort) {
|
|
249
|
+
Logger.warn(`Authorization request for unknown cohort ${authRequest.body?.cohortId} from ${authRequest.from}`);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const id = authRequest.body?.sessionId;
|
|
253
|
+
if (!id) {
|
|
254
|
+
Logger.warn(`Authorization request missing session ID from ${authRequest.from}`);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const pendingTx = authRequest.body?.pendingTx;
|
|
258
|
+
if (!pendingTx) {
|
|
259
|
+
Logger.warn(`Authorization request missing pending transaction from ${authRequest.from}`);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
const session = new BeaconCohortSigningSession({
|
|
263
|
+
cohort,
|
|
264
|
+
id,
|
|
265
|
+
pendingTx: Transaction.fromHex(pendingTx),
|
|
266
|
+
});
|
|
267
|
+
this.activeSigningSessions.set(session.id, session);
|
|
268
|
+
const nonceContribution = this.generateNonceContribution(cohort, session);
|
|
269
|
+
await this.sendNonceContribution(cohort, nonceContribution, session);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Handles an aggregated nonce message.
|
|
273
|
+
* @param {Maybe<CohortAggregatedNonceMessage>} message The aggregated nonce message.
|
|
274
|
+
* @returns {Promise<void>}
|
|
275
|
+
*/
|
|
276
|
+
async _handleAggregatedNonce(message) {
|
|
277
|
+
const aggNonceMessage = BeaconCohortAggregatedNonceMessage.fromJSON(message);
|
|
278
|
+
const sessionId = aggNonceMessage.body?.sessionId;
|
|
279
|
+
if (!sessionId) {
|
|
280
|
+
Logger.warn(`Aggregated nonce message missing session ID from ${aggNonceMessage.from}`);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const session = this.activeSigningSessions.get(sessionId);
|
|
284
|
+
if (!session) {
|
|
285
|
+
Logger.warn(`Aggregated nonce message received for unknown session ${sessionId}`);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
const aggregatedNonce = aggNonceMessage.body?.aggregatedNonce;
|
|
289
|
+
if (!aggregatedNonce) {
|
|
290
|
+
Logger.warn(`Aggregated nonce message missing aggregated nonce from ${aggNonceMessage.from}`);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
session.aggregatedNonce = aggregatedNonce;
|
|
294
|
+
const participantSk = this.getCohortKey(session.cohort.id).privateKey;
|
|
295
|
+
if (!participantSk) {
|
|
296
|
+
Logger.error(`Failed to derive secret key for cohort ${session.cohort.id}`);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const partialSig = session.generatePartialSignature(participantSk);
|
|
300
|
+
await this.sendPartialSignature(session, partialSig);
|
|
301
|
+
}
|
|
302
|
+
;
|
|
303
|
+
/**
|
|
304
|
+
* Subscribes to a coordinator's messages.
|
|
305
|
+
* @param {string} coordinatorDid The DID of the coordinator to subscribe to.
|
|
306
|
+
* @returns {Promise<void>}
|
|
307
|
+
*/
|
|
308
|
+
async subscribeToCoordinator(coordinatorDid) {
|
|
309
|
+
if (this.coordinatorDids.includes(coordinatorDid)) {
|
|
310
|
+
Logger.info(`Already subscribed to coordinator ${coordinatorDid}`);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const subMessage = new BeaconCohortSubscribeMessage({ to: coordinatorDid, from: this.did });
|
|
314
|
+
return await this.protocol.sendMessage(subMessage, this.did, coordinatorDid);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Joins a cohort with the given ID and coordinator DID.
|
|
318
|
+
* @param {string} cohortId The ID of the cohort to join.
|
|
319
|
+
* @param {string} coordinatorDid The DID of the cohort coordinator.
|
|
320
|
+
* @returns {Promise<void>}
|
|
321
|
+
*/
|
|
322
|
+
async joinCohort(cohortId, coordinatorDid) {
|
|
323
|
+
Logger.info(`BeaconParticipant ${this.did} joining cohort ${cohortId} with coordinator ${coordinatorDid}`);
|
|
324
|
+
this.finalizeUnsetCohortKey(cohortId);
|
|
325
|
+
const cohort = this.cohorts.find(c => c.id === cohortId);
|
|
326
|
+
if (!cohort) {
|
|
327
|
+
Logger.warn(`Cohort with ID ${cohortId} not found.`);
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
const pk = this.getCohortKey(cohortId).publicKey;
|
|
331
|
+
if (!pk) {
|
|
332
|
+
Logger.error(`Failed to derive public key for cohort ${cohortId} at index ${this.beaconKeyIndex}`);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
this.setCohortKey(cohortId);
|
|
336
|
+
const optInMessage = new BeaconCohortOptInMessage({
|
|
337
|
+
cohortId,
|
|
338
|
+
participantPk: pk,
|
|
339
|
+
from: this.did,
|
|
340
|
+
to: coordinatorDid,
|
|
341
|
+
});
|
|
342
|
+
await this.protocol.sendMessage(optInMessage, this.did, coordinatorDid);
|
|
343
|
+
cohort.status = COHORT_STATUS.COHORT_OPTED_IN;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Requests a signature for the given cohort and data.
|
|
347
|
+
* @param {string} cohortId The ID of the cohort for which to request a signature.
|
|
348
|
+
* @param {string} data The data for which to request a signature.
|
|
349
|
+
* @returns {Promise<boolean>} Whether the signature request was successful.
|
|
350
|
+
*/
|
|
351
|
+
async requestCohortSignature(cohortId, data) {
|
|
352
|
+
const cohort = this.cohorts.find(c => c.id === cohortId);
|
|
353
|
+
if (!cohort) {
|
|
354
|
+
Logger.warn(`Cohort with ID ${cohortId} not found.`);
|
|
355
|
+
return false;
|
|
356
|
+
}
|
|
357
|
+
if (cohort.status !== COHORT_STATUS.COHORT_SET_STATUS) {
|
|
358
|
+
Logger.warn(`Cohort ${cohortId} not in a set state. Current status: ${cohort.status}`);
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
const reqSigMessage = new BeaconCohortRequestSignatureMessage({
|
|
362
|
+
to: cohort.coordinatorDid,
|
|
363
|
+
from: this.did,
|
|
364
|
+
data,
|
|
365
|
+
cohortId
|
|
366
|
+
});
|
|
367
|
+
await this.protocol.sendMessage(reqSigMessage, this.did, cohort.coordinatorDid);
|
|
368
|
+
return true;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Generates a nonce contribution for the given cohort and session.
|
|
372
|
+
* @param {AggregateBeaconCohort} cohort The cohort for which to generate the nonce contribution.
|
|
373
|
+
* @param {BeaconCohortSigningSession} session The session for which to generate the nonce contribution.
|
|
374
|
+
* @returns {Promise<string[]>} An array of nonce points in hexadecimal format.
|
|
375
|
+
*/
|
|
376
|
+
generateNonceContribution(cohort, session) {
|
|
377
|
+
const cohortKey = this.getCohortKey(cohort.id);
|
|
378
|
+
if (!cohortKey) {
|
|
379
|
+
throw new BeaconParticipantError(`Cohort key state not found for cohort ${cohort.id}`, 'COHORT_KEY_NOT_FOUND', cohortKey);
|
|
380
|
+
}
|
|
381
|
+
const { publicKey, privateKey } = cohortKey;
|
|
382
|
+
if (!publicKey || !privateKey) {
|
|
383
|
+
throw new BeaconParticipantError(`Failed to derive public key for cohort ${cohort.id}`, 'PARTICIPANT_PK_NOT_FOUND', cohortKey);
|
|
384
|
+
}
|
|
385
|
+
session.aggregatedNonce ??= session.generateAggregatedNonce();
|
|
386
|
+
return musig2.nonceGen(publicKey, privateKey, session.aggregatedNonce, cohort.trMerkleRoot).public;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Sends a nonce contribution message to the cohort coordinator.
|
|
390
|
+
* @param {AggregateBeaconCohort} cohort The cohort to which the nonce contribution is sent.
|
|
391
|
+
* @param {Uint8Array} nonceContribution The nonce contribution points in hexadecimal format.
|
|
392
|
+
* @param {BeaconCohortSigningSession} session The session associated with the nonce contribution.
|
|
393
|
+
*/
|
|
394
|
+
async sendNonceContribution(cohort, nonceContribution, session) {
|
|
395
|
+
const nonceContributionMessage = BeaconCohortNonceContributionMessage.fromJSON({
|
|
396
|
+
to: cohort.coordinatorDid,
|
|
397
|
+
from: this.did,
|
|
398
|
+
body: {
|
|
399
|
+
sessionId: session.id,
|
|
400
|
+
cohortId: cohort.id,
|
|
401
|
+
nonceContribution
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
await this.protocol.sendMessage(nonceContributionMessage, this.did, cohort.coordinatorDid);
|
|
405
|
+
Logger.info(`Nonce contribution sent for session ${session.id} in cohort ${cohort.id} by participant ${this.did}`);
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Sends a partial signature for the given session.
|
|
409
|
+
* @param {BeaconCohortSigningSession} session The session for which the partial signature is sent.
|
|
410
|
+
* @param {Uint8Array} partialSig The partial signature to send.
|
|
411
|
+
* @returns {Promise<void>}
|
|
412
|
+
*/
|
|
413
|
+
async sendPartialSignature(session, partialSig) {
|
|
414
|
+
const sigAuthMessage = new BeaconCohortSignatureAuthorizationMessage({
|
|
415
|
+
to: session.cohort.coordinatorDid,
|
|
416
|
+
from: this.did,
|
|
417
|
+
cohortId: session.cohort.id,
|
|
418
|
+
sessionId: session.id,
|
|
419
|
+
partialSignature: partialSig,
|
|
420
|
+
});
|
|
421
|
+
await this.protocol.sendMessage(sigAuthMessage, this.did, session.cohort.coordinatorDid);
|
|
422
|
+
Logger.info(`Partial signature sent for session ${session.id} in cohort ${session.cohort.id} by participant ${this.did}`);
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Initializes a new BeaconParticipant instance.
|
|
426
|
+
* @param {Seed | Mnemonic} ent The secret key used for signing.
|
|
427
|
+
* @param {CommunicationService} protocol The communication protocol used by the participant.
|
|
428
|
+
* @param {string} [name] The name of the participant.
|
|
429
|
+
* @param {string} [did] The decentralized identifier (DID) of the participant.
|
|
430
|
+
* @returns {BeaconParticipant} A new instance of BeaconParticipant.
|
|
431
|
+
*/
|
|
432
|
+
static initialize(ent, protocol, did, name) {
|
|
433
|
+
return new BeaconParticipant({ ent, protocol, name, did });
|
|
434
|
+
}
|
|
435
|
+
}
|
|
2
436
|
//# sourceMappingURL=participant.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"participant.js","sourceRoot":"","sources":["../../../../../src/core/beacon/aggregation/participant.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"participant.js","sourceRoot":"","sources":["../../../../../src/core/beacon/aggregation/participant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAS,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,MAAM,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EACL,oBAAoB,EACpB,8BAA8B,EAC9B,mCAAmC,EACnC,2BAA2B,EAC3B,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAuB,MAAM,2CAA2C,CAAC;AAC3G,OAAO,EAAE,wBAAwB,EAAsB,MAAM,0CAA0C,CAAC;AACxG,OAAO,EAAE,8BAA8B,EAA4B,MAAM,2CAA2C,CAAC;AACrH,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAAE,kCAAkC,EAAgC,MAAM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