@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,230 @@
|
|
|
1
|
+
import { CompressedSecp256k1PublicKey, SchnorrKeyPair, Secp256k1SecretKey } from '@did-btcr2/keypair';
|
|
2
|
+
import { nonceGen } from '@scure/btc-signer/musig2';
|
|
3
|
+
import { finalizeEvent, nip44 } from 'nostr-tools';
|
|
4
|
+
import { SimplePool } from 'nostr-tools/pool';
|
|
5
|
+
import { Identifier } from '../../../../identifier.js';
|
|
6
|
+
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 '../../cohort/messages/constants.js';
|
|
7
|
+
import { AggregateBeaconMessage } from '../../cohort/messages/index.js';
|
|
8
|
+
import { CommunicationAdapterError } from '../error.js';
|
|
9
|
+
/**
|
|
10
|
+
* DEFAULT_NOSTR_RELAYS provides a list of default Nostr relay URLs for communication.
|
|
11
|
+
* These relays are used to connect to the Nostr network for sending and receiving messages.
|
|
12
|
+
* @constant {Array<string>} DEFAULT_NOSTR_RELAYS
|
|
13
|
+
*/
|
|
14
|
+
export const DEFAULT_NOSTR_RELAYS = [
|
|
15
|
+
'wss://relay.damus.io',
|
|
16
|
+
// 'wss://nos.lol',
|
|
17
|
+
// 'wss://relay.snort.social',
|
|
18
|
+
// 'wss://nostr-pub.wellorder.net',
|
|
19
|
+
];
|
|
20
|
+
export class NostrAdapter {
|
|
21
|
+
/**
|
|
22
|
+
* The name of the NostrAdapter service.
|
|
23
|
+
* @type {string}
|
|
24
|
+
*/
|
|
25
|
+
name = 'nostr';
|
|
26
|
+
/**
|
|
27
|
+
* The configuration for the NostrAdapter.
|
|
28
|
+
* @type {NostrAdapterConfig}
|
|
29
|
+
*/
|
|
30
|
+
config;
|
|
31
|
+
/**
|
|
32
|
+
* A map of message handlers for different message types.
|
|
33
|
+
* @type {Map<string, MessageHandler>}
|
|
34
|
+
*/
|
|
35
|
+
handlers = new Map();
|
|
36
|
+
/**
|
|
37
|
+
* The SimplePool instance for managing Nostr subscriptions.
|
|
38
|
+
* @type {SimplePool}
|
|
39
|
+
*/
|
|
40
|
+
pool;
|
|
41
|
+
/**
|
|
42
|
+
* Constructs a new NostrAdapter instance with the given configuration.
|
|
43
|
+
* @param {NostrAdapterConfig} config - The configuration for the NostrAdapter.
|
|
44
|
+
* If no configuration is provided, a new key pair is generated and default relays are used.
|
|
45
|
+
* @constructor
|
|
46
|
+
*/
|
|
47
|
+
constructor(config = { keys: {}, components: {}, relays: DEFAULT_NOSTR_RELAYS }) {
|
|
48
|
+
this.config = config;
|
|
49
|
+
this.config.keys = this.config.keys || SchnorrKeyPair.generate().raw;
|
|
50
|
+
this.config.did = config.did || Identifier.encode({
|
|
51
|
+
idType: config.components.idType || 'KEY',
|
|
52
|
+
version: config.components.version || 1,
|
|
53
|
+
network: config.components.network || 'signet',
|
|
54
|
+
genesisBytes: this.config.keys.public
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Sets the keys for the NostrAdapter.
|
|
59
|
+
* @param {ServiceAdapterIdentity<RawSchnorrKeyPair>} keys - The key pair to set.
|
|
60
|
+
*/
|
|
61
|
+
setKeys(keys) {
|
|
62
|
+
this.config.keys = keys;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Starts the Nostr communication service by subscribing to relays.
|
|
66
|
+
* @returns {ServiceAdapter<NostrAdapter>} Returns the NostrAdapter instance for method chaining.
|
|
67
|
+
*/
|
|
68
|
+
start() {
|
|
69
|
+
this.pool = new SimplePool();
|
|
70
|
+
this.pool.subscribe(this.config.relays, { kinds: [1] }, {
|
|
71
|
+
onclose: (reasons) => console.log('Subscription to kind 1 closed', reasons),
|
|
72
|
+
onevent: this.onEvent.bind(this),
|
|
73
|
+
});
|
|
74
|
+
// this.pool.subscribe(this.config.relays, { kinds: [1059] } as Filter, {
|
|
75
|
+
// onclose : (reasons: string[]) => console.log('Subscription to kind 1059 closed for reasons:', reasons),
|
|
76
|
+
// onevent : this.onEvent.bind(this),
|
|
77
|
+
// oneose : () => { Logger.info('EOSE kinds 1059'); }
|
|
78
|
+
// });
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Handles incoming Nostr events and dispatches them to the appropriate message handler.
|
|
83
|
+
* @param {Event} event The Nostr event received from the relay.
|
|
84
|
+
*/
|
|
85
|
+
async onEvent(event) {
|
|
86
|
+
// Logger.debug('nostr.onEvent: event.tags', event.tags);
|
|
87
|
+
// Dispatch the event to the registered handler
|
|
88
|
+
const ptags = event.tags.filter(([name, _]) => name === 'p') ?? [];
|
|
89
|
+
// Logger.debug('nostr.onEvent: event.tags.find => ptags', ptags);
|
|
90
|
+
for (const [p, pk] of ptags) {
|
|
91
|
+
if (pk === 'b71d3052dcdc8ba4564388948b655b58aaa7f37497ef1fc98829f9191adc8f85') {
|
|
92
|
+
console.debug('nostr.onEvent: event.tags.find => p, pk', p, pk);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// if(!type && !value) {
|
|
96
|
+
// // Logger.warn(`Event ${event.id} does not have a valid tag, skipping handler dispatch.`);
|
|
97
|
+
// return;
|
|
98
|
+
// }
|
|
99
|
+
// Logger.debug('nostr.onEvent: event.tags.find => type, value', type, value);
|
|
100
|
+
// Logger.debug('nostr.onEvent: event', event);
|
|
101
|
+
// Logger.debug('nostr.onEvent: event.tags', event.tags);
|
|
102
|
+
// if(event.kind === 1 && !AggregateBeaconMessage.isKeyGenMessageValue(value)) {
|
|
103
|
+
// Logger.warn(`Event ${event.id} is not a key generation message type: ${value}, skipping handler dispatch.`);
|
|
104
|
+
// return;
|
|
105
|
+
// }
|
|
106
|
+
// if(event.kind === 1059 && !AggregateBeaconMessage.isSignMessageValue(value)) {
|
|
107
|
+
// Logger.warn(`Event ${event.id} has an invalid title tag: ${value}, skipping handler dispatch.`);
|
|
108
|
+
// return;
|
|
109
|
+
// }
|
|
110
|
+
// const handler = this.handlers.get(value);
|
|
111
|
+
// if (!handler) {
|
|
112
|
+
// Logger.warn(`No handler found for message with tag value: ${value}`);
|
|
113
|
+
// return;
|
|
114
|
+
// }
|
|
115
|
+
// await handler(event);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Registers a message handler for a specific message type.
|
|
119
|
+
* @param {string} messageType The type of message to handle.
|
|
120
|
+
* @param {MessageHandler} handler The handler function that processes the message.
|
|
121
|
+
*/
|
|
122
|
+
registerMessageHandler(messageType, handler) {
|
|
123
|
+
this.handlers.set(messageType, handler);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Sends a message to a recipient using the Nostr protocol.
|
|
127
|
+
* This method is a placeholder and should be implemented with actual Nostr message sending logic.
|
|
128
|
+
* @param {Maybe<AggregateBeaconMessageType>} message The message to send, typically containing the content and metadata.
|
|
129
|
+
* @param {Did} from The identifier of the sender.
|
|
130
|
+
* @param {Did} [to] The identifier of the recipient.
|
|
131
|
+
* @returns {Promise<void>} A promise that resolves when the message is sent.
|
|
132
|
+
*/
|
|
133
|
+
async sendMessage(message, from, to) {
|
|
134
|
+
// Check if the sender and recipient DIDs are valid Btc1 identifiers
|
|
135
|
+
if ([from, to]
|
|
136
|
+
.filter(did => !!did)
|
|
137
|
+
.every(did => !Identifier.isValid(did))) {
|
|
138
|
+
console.error(`Invalid Btc1 identifiers: sender ${from}, recipient ${to}`);
|
|
139
|
+
throw new CommunicationAdapterError(`Invalid identifiers: sender ${from}, recipient ${to}`, 'SEND_MESSAGE_ERROR', { adapter: this.name });
|
|
140
|
+
}
|
|
141
|
+
// Decode the sender and recipient DIDs to get their genesis bytes in hex
|
|
142
|
+
const sender = new CompressedSecp256k1PublicKey(Identifier.decode(from).genesisBytes);
|
|
143
|
+
console.info(`Sending message from ${sender}:`, message);
|
|
144
|
+
// if(message.type === BEACON_COHORT_SUBSCRIBE_ACCEPT) {
|
|
145
|
+
// this.config.coordinatorDids.push(recipient);
|
|
146
|
+
// }
|
|
147
|
+
const tags = [['p', Buffer.from(sender.x).toString('hex')]];
|
|
148
|
+
if (to) {
|
|
149
|
+
const recipient = new CompressedSecp256k1PublicKey(Identifier.decode(to).genesisBytes);
|
|
150
|
+
tags.push(['p', Buffer.from(recipient.x).toString('hex')]);
|
|
151
|
+
}
|
|
152
|
+
if (AggregateBeaconMessage.isKeyGenMessageValue(message.type)) {
|
|
153
|
+
switch (message.type) {
|
|
154
|
+
case BEACON_COHORT_ADVERT:
|
|
155
|
+
console.info('Add tag', ['BEACON_COHORT_ADVERT', message.type]);
|
|
156
|
+
break;
|
|
157
|
+
case BEACON_COHORT_OPT_IN:
|
|
158
|
+
console.info('Add tag', ['BEACON_COHORT_OPT_IN', message.type]);
|
|
159
|
+
break;
|
|
160
|
+
case BEACON_COHORT_OPT_IN_ACCEPT:
|
|
161
|
+
console.info('Add tag', ['BEACON_COHORT_OPT_IN_ACCEPT', message.type]);
|
|
162
|
+
break;
|
|
163
|
+
case BEACON_COHORT_READY:
|
|
164
|
+
console.info('Add tag', ['BEACON_COHORT_READY', message.type]);
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
const event = finalizeEvent({
|
|
168
|
+
kind: 1,
|
|
169
|
+
created_at: Math.floor(Date.now() / 1000),
|
|
170
|
+
tags,
|
|
171
|
+
content: JSON.stringify(message)
|
|
172
|
+
}, this.config.keys.secret);
|
|
173
|
+
console.info(`Sending message kind 1 event ...`, event);
|
|
174
|
+
return this.pool?.publish(this.config.relays, event);
|
|
175
|
+
}
|
|
176
|
+
if (AggregateBeaconMessage.isSignMessageValue(message.type)) {
|
|
177
|
+
switch (message.type) {
|
|
178
|
+
case BEACON_COHORT_REQUEST_SIGNATURE:
|
|
179
|
+
console.info('Add tag', ['BEACON_COHORT_REQUEST_SIGNATURE', message.type]);
|
|
180
|
+
break;
|
|
181
|
+
case BEACON_COHORT_AUTHORIZATION_REQUEST:
|
|
182
|
+
console.info('Add tag', ['BEACON_COHORT_AUTHORIZATION_REQUEST', message.type]);
|
|
183
|
+
break;
|
|
184
|
+
case BEACON_COHORT_NONCE_CONTRIBUTION:
|
|
185
|
+
console.info('Add tag', ['BEACON_COHORT_NONCE_CONTRIBUTION', message.type]);
|
|
186
|
+
break;
|
|
187
|
+
case BEACON_COHORT_AGGREGATED_NONCE:
|
|
188
|
+
console.info('Add tag', ['BEACON_COHORT_AGGREGATED_NONCE', message.type]);
|
|
189
|
+
break;
|
|
190
|
+
case BEACON_COHORT_SIGNATURE_AUTHORIZATION:
|
|
191
|
+
console.info('Add tag', ['BEACON_COHORT_SIGNATURE_AUTHORIZATION', message.type]);
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
const { publicKey, secretKey } = SchnorrKeyPair.generate();
|
|
195
|
+
const content = nip44.encrypt(JSON.stringify(message), secretKey.bytes, nonceGen(publicKey.x).public);
|
|
196
|
+
console.debug('NostrAdapter content:', content);
|
|
197
|
+
const event = finalizeEvent({ content, tags, kind: 1059 }, this.config.keys.secret);
|
|
198
|
+
console.debug('NostrAdapter event:', event);
|
|
199
|
+
return this.pool?.publish(this.config.relays, event);
|
|
200
|
+
}
|
|
201
|
+
console.error(`Unsupported message type: ${message.type}`);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Generates a Nostr identity using the Secp256k1SecretKey and Identifier classes.
|
|
205
|
+
* @param {RawSchnorrKeyPair} [keys] Optional keys to use for identity generation.
|
|
206
|
+
* @returns {ServiceAdapterConfig} The generated Nostr identity configuration.
|
|
207
|
+
*/
|
|
208
|
+
generateIdentity(keys) {
|
|
209
|
+
if (!keys) {
|
|
210
|
+
this.config.keys.secret = Secp256k1SecretKey.random();
|
|
211
|
+
this.config.keys.public = Secp256k1SecretKey.getPublicKey(this.config.keys.secret).compressed;
|
|
212
|
+
this.config.did = Identifier.encode({
|
|
213
|
+
idType: this.config.components.idType || 'KEY',
|
|
214
|
+
version: this.config.components.version || 1,
|
|
215
|
+
network: this.config.components.network || 'signet',
|
|
216
|
+
genesisBytes: this.config.keys.public
|
|
217
|
+
});
|
|
218
|
+
return this.config;
|
|
219
|
+
}
|
|
220
|
+
this.config.keys = keys;
|
|
221
|
+
this.config.did = Identifier.encode({
|
|
222
|
+
idType: this.config.components.idType || 'KEY',
|
|
223
|
+
version: this.config.components.version || 1,
|
|
224
|
+
network: this.config.components.network || 'signet',
|
|
225
|
+
genesisBytes: this.config.keys.public
|
|
226
|
+
});
|
|
227
|
+
return this.config;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=nostr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nostr.js","sourceRoot":"","sources":["../../../../../../../src/core/beacon/aggregation/communication/adapter/nostr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAqB,cAAc,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACzH,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAgC,aAAa,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EACL,oBAAoB,EACpB,8BAA8B,EAC9B,mCAAmC,EACnC,gCA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U,CAAC,MAAM,CACjC;YACE,MAAM,EAAS,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,IAAK,KAAK;YACtD,OAAO,EAAQ,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC;YAClD,OAAO,EAAQ,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,IAAI,QAAQ;YACzD,YAAY,EAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM;SACvC,CACF,CAAC;QACF,OAAO,IAAI,CAAC,MAA8B,CAAC;IAC7C,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MethodError } from '@did-btcr2/common';
|
|
2
|
+
export class CommunicationServiceError extends MethodError {
|
|
3
|
+
constructor(message, type = 'CommunicationServiceError', data) {
|
|
4
|
+
super(message, type, data);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class CommunicationAdapterError extends MethodError {
|
|
8
|
+
constructor(message, type = 'CommunicationAdapterError', data) {
|
|
9
|
+
super(message, type, data);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/communication/error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,yBAA0B,SAAQ,WAAW;IACxD,YAAY,OAAe,EAAE,OAAe,2BAA2B,EAAE,IAA0B;QACjG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,WAAW;IACxD,YAAY,OAAe,EAAE,OAAe,2BAA2B,EAAE,IAA0B;QACjG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NotImplementedError } from '@did-btcr2/common';
|
|
2
|
+
import { NostrAdapter } from './adapter/nostr.js';
|
|
3
|
+
import { CommunicationServiceError } from './error.js';
|
|
4
|
+
/**
|
|
5
|
+
* Communication Factory pattern to create Communication Service instances.
|
|
6
|
+
* @class CommunicationFactory
|
|
7
|
+
* @type {CommunicationFactory}
|
|
8
|
+
*/
|
|
9
|
+
export class CommunicationFactory {
|
|
10
|
+
static establish(service) {
|
|
11
|
+
switch (service.type) {
|
|
12
|
+
case 'nostr':
|
|
13
|
+
return new NostrAdapter();
|
|
14
|
+
case 'didcomm':
|
|
15
|
+
throw new NotImplementedError('DID Comm service not implemented yet.');
|
|
16
|
+
default:
|
|
17
|
+
throw new CommunicationServiceError(`Invalid service type ${service.type}`, 'INVALID_BEACON_ERROR', { service });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/communication/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAGvD;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IAC/B,MAAM,CAAC,SAAS,CAAC,OAAgB;QAC/B,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;YACrB,KAAK,OAAO;gBACV,OAAO,IAAI,YAAY,EAAE,CAAC;YAC5B,KAAK,SAAS;gBACZ,MAAM,IAAI,mBAAmB,CAAC,uCAAuC,CAAC,CAAC;YACzE;gBACE,MAAM,IAAI,yBAAyB,CACjC,wBAAwB,OAAO,CAAC,IAAI,EAAE,EACtC,sBAAsB,EAAE,EAAE,OAAO,EAAE,CACpC,CAAC;QACN,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../../../../src/core/beacon/aggregation/communication/service.ts"],"names":[],"mappings":""}
|