@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,145 +0,0 @@
|
|
|
1
|
-
import { AvailableNetworks } from '@did-btcr2/bitcoin';
|
|
2
|
-
import { HashBytes, Hex, KeyBytes, SchnorrKeyPairObject, SignatureBytes } from '@did-btcr2/common';
|
|
3
|
-
import { SchnorrMultikey } from '@did-btcr2/cryptosuite';
|
|
4
|
-
import { CompressedSecp256k1PublicKey, SchnorrKeyPair } from '@did-btcr2/keypair';
|
|
5
|
-
import { KeyIdentifier } from '@web5/crypto';
|
|
6
|
-
import { Multibase } from 'multiformats';
|
|
7
|
-
import { BitcoinSigner, CryptoSigner, IKeyManager, KeyManagerOptions, KeyManagerParams } from './interface.js';
|
|
8
|
-
export interface SignerParams {
|
|
9
|
-
multikey: SchnorrMultikey;
|
|
10
|
-
network: keyof AvailableNetworks;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Class for managing cryptographic keys for the B DID method.
|
|
14
|
-
* @class KeyManager
|
|
15
|
-
* @type {KeyManager}
|
|
16
|
-
*/
|
|
17
|
-
export declare class KeyManager implements IKeyManager, CryptoSigner, BitcoinSigner {
|
|
18
|
-
#private;
|
|
19
|
-
/**
|
|
20
|
-
* The `activeKeyUri` property is a string that represents the URI of the currently active key.
|
|
21
|
-
* It is used to identify the key that will be used for signing and verifying operations.
|
|
22
|
-
* This property is optional and can be set to a specific key URI when initializing the
|
|
23
|
-
* `KeyManager` instance. If not set, the key manager will use the default key URI.
|
|
24
|
-
* @type {KeyIdentifier}
|
|
25
|
-
*/
|
|
26
|
-
activeKeyUri?: KeyIdentifier;
|
|
27
|
-
/**
|
|
28
|
-
* The `_store` private variable in `KeyManager` is a `KeyValueStore` instance used for
|
|
29
|
-
* storing and managing cryptographic keys. It allows the `KeyManager` class to save,
|
|
30
|
-
* retrieve, and handle keys efficiently within the local Key Management System (KMS) context.
|
|
31
|
-
* This variable can be configured to use different storage backends, like in-memory storage or
|
|
32
|
-
* persistent storage, providing flexibility in key management according to the application's
|
|
33
|
-
* requirements.
|
|
34
|
-
* @private
|
|
35
|
-
* @readonly
|
|
36
|
-
* @type {KeyValueStore<KeyIdentifier, SchnorrKeyPair>} The key store for managing cryptographic keys.
|
|
37
|
-
*/
|
|
38
|
-
private readonly _store;
|
|
39
|
-
/**
|
|
40
|
-
* Creates an instance of KeyManager.
|
|
41
|
-
* @param {?KeyManagerParams} params The parameters to initialize the key manager.
|
|
42
|
-
* @param {KeyValueStore<KeyIdentifier, SchnorrMultikey>} params.store An optional property to specify a custom
|
|
43
|
-
* `KeyValueStore` instance for key management. If not provided, {@link KeyManager} uses a default `MemoryStore`
|
|
44
|
-
* instance. This store is responsible for managing cryptographic keys, allowing them to be retrieved, stored, and
|
|
45
|
-
* managed during cryptographic operations.
|
|
46
|
-
* @param {KeyIdentifier} params.keyUri An optional property to specify the active key URI for the key manager.
|
|
47
|
-
*/
|
|
48
|
-
constructor({ store, keyUri, keys }?: KeyManagerParams);
|
|
49
|
-
/**
|
|
50
|
-
* Gets the singleton instance of the KeyManager.
|
|
51
|
-
* @returns {KeyManager} The singleton instance of the KeyManager.
|
|
52
|
-
*/
|
|
53
|
-
static get instance(): KeyManager;
|
|
54
|
-
/**
|
|
55
|
-
* Signs a transaction using the key associated with the key URI.
|
|
56
|
-
* @param {Hex} txHex The transaction hex to sign.
|
|
57
|
-
* @param {KeyIdentifier} keyUri The URI of the key to sign the transaction with.
|
|
58
|
-
* @returns {Promise<Hex>} A promise resolving to the signed transaction hex.
|
|
59
|
-
*/
|
|
60
|
-
signTransaction(txHex: Hex, keyUri?: KeyIdentifier): Promise<Hex>;
|
|
61
|
-
/**
|
|
62
|
-
* Gets the key pair from the key store and returns a CompressedSecp256k1PublicKey.
|
|
63
|
-
* @param {KeyIdentifier} keyUri The URI of the key to get the public key for.
|
|
64
|
-
* @returns {Promise<CompressedSecp256k1PublicKey>} The public key associated with the key URI.
|
|
65
|
-
*/
|
|
66
|
-
getPublicKey(keyUri?: KeyIdentifier): Promise<CompressedSecp256k1PublicKey>;
|
|
67
|
-
/**
|
|
68
|
-
* Signs the given data using the key associated with the key URI.
|
|
69
|
-
* @param {Hex} data The data to sign.
|
|
70
|
-
* @param {?KeyIdentifier} keyUri The URI of the key to sign the data with.
|
|
71
|
-
* @returns {Promise<SignatureBytes>} A promise resolving to the signature of the data.
|
|
72
|
-
*/
|
|
73
|
-
sign(data: Hex, keyUri?: KeyIdentifier): Promise<SignatureBytes>;
|
|
74
|
-
/**
|
|
75
|
-
* Verifies a signature using the key associated with the key URI.
|
|
76
|
-
* @param {KeyIdentifier} keyUri The URI of the key to verify the signature with.
|
|
77
|
-
* @param {SignatureBytes} signature The signature to verify.
|
|
78
|
-
* @param {Hex} data The data to verify the signature with.
|
|
79
|
-
* @returns {Promise<boolean>} A promise resolving to a boolean indicating the verification result.
|
|
80
|
-
*/
|
|
81
|
-
verify(signature: SignatureBytes, data: Hex, keyUri?: KeyIdentifier): Promise<boolean>;
|
|
82
|
-
/**
|
|
83
|
-
* Gets the key pair from the key store.
|
|
84
|
-
* @param {KeyIdentifier} keyUri The URI of the key to get.
|
|
85
|
-
* @returns {Promise<SchnorrKeyPair>} The key pair associated with the key URI.
|
|
86
|
-
* @throws {KeyManagerError} If the key is not found in the key store.
|
|
87
|
-
*/
|
|
88
|
-
private getKey;
|
|
89
|
-
/**
|
|
90
|
-
* Exports the full multikeypair from the key store.
|
|
91
|
-
* @returns {Promise<SchnorrKeyPair>} The key pair associated with the key URI.
|
|
92
|
-
* @throws {KeyManagerError} If the key is not found in the key store.
|
|
93
|
-
*/
|
|
94
|
-
exportKey(keyUri?: KeyIdentifier): Promise<SchnorrMultikey | undefined>;
|
|
95
|
-
/**
|
|
96
|
-
* Imports a keypair to the store.
|
|
97
|
-
* @param {SchnorrKeyPair} keys The keypair to import.
|
|
98
|
-
* @param {KeyIdentifier} keyUri The URI of the key to import.
|
|
99
|
-
* @param {KeyManagerOptions} options Relevant import options.
|
|
100
|
-
* @param {boolean} options.active A flag to set the key as active (optional, default: false).
|
|
101
|
-
* @returns {Promise<KeyIdentifier>} A promise that resolves to the key identifier of the imported key.
|
|
102
|
-
*/
|
|
103
|
-
importKey(keys: SchnorrKeyPair, keyUri: string, options?: KeyManagerOptions): Promise<KeyIdentifier>;
|
|
104
|
-
/**
|
|
105
|
-
* Computes the hash of the given data.
|
|
106
|
-
* @param {Uint8Array} data The data to hash.
|
|
107
|
-
* @returns {HashBytes} The hash of the data.
|
|
108
|
-
*/
|
|
109
|
-
digest(data: Uint8Array): HashBytes;
|
|
110
|
-
/**
|
|
111
|
-
* Computes the key URI of a given keypair.
|
|
112
|
-
* @param {string} id The fragment identifier (e.g. 'key-1').
|
|
113
|
-
* @param {string} [controller] The DID controller (e.g. 'did:btcr2:xyz').
|
|
114
|
-
* @returns {KeyIdentifier} A full DID fragment URI (e.g. 'did:btcr2:xyz#key-1')
|
|
115
|
-
*/
|
|
116
|
-
static computeKeyUri(id: string, controller: string): KeyIdentifier;
|
|
117
|
-
/**
|
|
118
|
-
* Computes a multibase-compliant URI from a key.
|
|
119
|
-
* @param key A SchnorrKeyPair, CompressedSecp256k1PublicKey, or multibase string
|
|
120
|
-
* @returns {string} A multibase URI (e.g. 'urn:mb:zQ3s...')
|
|
121
|
-
*/
|
|
122
|
-
static toMultibaseUri(data: SchnorrKeyPair | CompressedSecp256k1PublicKey | Multibase<'zQ3s'>): string;
|
|
123
|
-
/**
|
|
124
|
-
* Initializes a singleton KeyManager instance.
|
|
125
|
-
* @param {SchnorrKeyPair} keys The keypair used to initialize the key manager.
|
|
126
|
-
* @returns {void}
|
|
127
|
-
*/
|
|
128
|
-
static initialize(keys: SchnorrKeyPair | SchnorrKeyPairObject, keyUri: string): Promise<KeyManager>;
|
|
129
|
-
/**
|
|
130
|
-
* Retrieves a keypair from the key store using the provided key URI.
|
|
131
|
-
* @public
|
|
132
|
-
* @param {KeyIdentifier} keyUri The URI of the keypair to retrieve.
|
|
133
|
-
* @returns {Promise<SchnorrKeyPair | undefined>} The retrieved keypair, or undefined if not found.
|
|
134
|
-
*/
|
|
135
|
-
static getKeyPair(keyUri?: KeyIdentifier): Promise<SchnorrMultikey | undefined>;
|
|
136
|
-
getKeySigner(keyUri: KeyIdentifier, network: keyof AvailableNetworks): Promise<Signer>;
|
|
137
|
-
}
|
|
138
|
-
export declare class Signer {
|
|
139
|
-
multikey: SchnorrMultikey;
|
|
140
|
-
network: keyof AvailableNetworks;
|
|
141
|
-
constructor(params: SignerParams);
|
|
142
|
-
get publicKey(): KeyBytes;
|
|
143
|
-
sign(hash: Hex): SignatureBytes;
|
|
144
|
-
signSchnorr(hash: Hex): SignatureBytes;
|
|
145
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/key-manager/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EACL,SAAS,EACT,GAAG,EACH,QAAQ,EAIR,oBAAoB,EACpB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGlF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MA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IAI1C;;;;;OAKG;WACW,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,aAAa;IAK1E;;;;OAIG;WACW,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,4BAA4B,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM;IAU7G;;;;OAIG;WACiB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,oBAAoB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAoChH;;;;;OAKG;WACiB,UAAU,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;IAO/E,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;CAOpG;AAED,qBAAa,MAAM;IACV,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,MAAM,iBAAiB,CAAC;gBAE5B,MAAM,EAAE,YAAY;IAKhC,IAAI,SAAS,IAAI,QAAQ,CAGxB;IAEM,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,cAAc;IAI/B,WAAW,CAAC,IAAI,EAAE,GAAG,GAAG,cAAc;CAG9C"}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { HashBytes, Hex, SignatureBytes } from '@did-btcr2/common';
|
|
2
|
-
import { Multikey, SchnorrMultikey } from '@did-btcr2/cryptosuite';
|
|
3
|
-
import { SchnorrKeyPair, CompressedSecp256k1PublicKey } from '@did-btcr2/keypair';
|
|
4
|
-
import { KeyValueStore } from '@web5/common';
|
|
5
|
-
export type KeyManagerOptions = {
|
|
6
|
-
importKey?: boolean;
|
|
7
|
-
active?: boolean;
|
|
8
|
-
};
|
|
9
|
-
/** Alias type for KeyManager keyUri */
|
|
10
|
-
export type KeyIdentifier = string;
|
|
11
|
-
/** Params for initializing a KeyManager class instance. */
|
|
12
|
-
export type KeyManagerParams = {
|
|
13
|
-
/**
|
|
14
|
-
* An optional property to specify a custom `KeyValueStore` instance for key management. If not
|
|
15
|
-
* provided, {@link KeyManager | `KeyManager`} uses a default `MemoryStore` instance.
|
|
16
|
-
* This store is responsible for managing cryptographic keys, allowing them to be retrieved,
|
|
17
|
-
* stored, and managed during cryptographic operations.
|
|
18
|
-
* @type {KeyValueStore<KeyIdentifier, KeyPair>}
|
|
19
|
-
*/
|
|
20
|
-
store?: KeyValueStore<KeyIdentifier, SchnorrMultikey>;
|
|
21
|
-
/**
|
|
22
|
-
* An optional property to specify a key URI for the key manager. If not provided, the key manager
|
|
23
|
-
* will generate a key URI based on the public key of the key pair.
|
|
24
|
-
* @type {KeyIdentifier}
|
|
25
|
-
*/
|
|
26
|
-
keyUri?: KeyIdentifier;
|
|
27
|
-
/**
|
|
28
|
-
* An optional property to specify the DID contoller id.
|
|
29
|
-
* @type {string}
|
|
30
|
-
*/
|
|
31
|
-
id?: string;
|
|
32
|
-
/**
|
|
33
|
-
* An optional property to specify the DID controller.\
|
|
34
|
-
* @type {string}
|
|
35
|
-
*/
|
|
36
|
-
controller?: string;
|
|
37
|
-
/**
|
|
38
|
-
* An optional property to pass in an initial key pair
|
|
39
|
-
* @type {SchnorrKeyPair}
|
|
40
|
-
*/
|
|
41
|
-
keys?: SchnorrKeyPair;
|
|
42
|
-
};
|
|
43
|
-
export type GenerateKeyParams = {
|
|
44
|
-
id: string;
|
|
45
|
-
controller: string;
|
|
46
|
-
options: KeyManagerOptions;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* The interface for the KeyManager class.
|
|
50
|
-
* @interface IKeyManager
|
|
51
|
-
* @type {IKeyManager}
|
|
52
|
-
*/
|
|
53
|
-
export interface IKeyManager {
|
|
54
|
-
/**
|
|
55
|
-
* The URI of the active key.
|
|
56
|
-
* @type {KeyIdentifier}
|
|
57
|
-
*/
|
|
58
|
-
activeKeyUri?: KeyIdentifier;
|
|
59
|
-
/**
|
|
60
|
-
* Exports the full key pair from the key store.
|
|
61
|
-
* @param {KeyIdentifier} keyUri The URI of the key to export.
|
|
62
|
-
* @returns {Promise<Multikey | undefined>} The key pair associated with the key URI.
|
|
63
|
-
* @throws {KeyManagerError} If the key is not found in the key store.
|
|
64
|
-
*/
|
|
65
|
-
exportKey(keyUri?: KeyIdentifier): Promise<Multikey | undefined>;
|
|
66
|
-
/**
|
|
67
|
-
* Gets the public key of a key pair.
|
|
68
|
-
* @param {KeyIdentifier} keyUri The URI of the key to get the public key for.
|
|
69
|
-
* @returns {Promise<CompressedSecp256k1PublicKey>} The public key of the key pair.
|
|
70
|
-
*/
|
|
71
|
-
getPublicKey(keyUri: KeyIdentifier): Promise<CompressedSecp256k1PublicKey>;
|
|
72
|
-
/**
|
|
73
|
-
* Imports a key pair into the key store.
|
|
74
|
-
* @param {SchnorrKeyPair} keyPair The key pair to import.
|
|
75
|
-
* @param {string} keyUri The full DID controller + fragment identifier (e.g. 'did:btcr2:xyz#key-1').
|
|
76
|
-
* @param {KeyManagerOptions} options The options for importing the key pair.
|
|
77
|
-
* @param {boolean} options.active Whether to set the imported key as active.
|
|
78
|
-
* @returns {Promise<KeyIdentifier>} A promise that resolves to the key identifier of the imported key.
|
|
79
|
-
*/
|
|
80
|
-
importKey(keyPair: SchnorrKeyPair, keyUri: string, options: KeyManagerOptions): Promise<KeyIdentifier>;
|
|
81
|
-
}
|
|
82
|
-
export interface CryptoSigner {
|
|
83
|
-
/**
|
|
84
|
-
* Signs a message with a key pair.
|
|
85
|
-
* @param {Hex} data The data to sign.
|
|
86
|
-
* @param {?KeyIdentifier} keyUri The URI of the key to sign the data with.
|
|
87
|
-
* @returns {Promise<SignatureBytes>} The signature of the input data.
|
|
88
|
-
*/
|
|
89
|
-
sign(data: Hex, keyUri?: KeyIdentifier): Promise<SignatureBytes>;
|
|
90
|
-
/**
|
|
91
|
-
* Verifies if a signature was produced by a key pair.
|
|
92
|
-
* @param {SignatureBytes} signature The signature to verify.
|
|
93
|
-
* @param {Hex} data The data that was signed.
|
|
94
|
-
* @param {?KeyIdentifier} keyUri The URI of the key to use for verification.
|
|
95
|
-
* @returns {Promise<boolean>} A promise that resolves if the signature is valid, and rejects otherwise.
|
|
96
|
-
*/
|
|
97
|
-
verify(signature: SignatureBytes, data: Hex, keyUri?: KeyIdentifier): Promise<boolean>;
|
|
98
|
-
/**
|
|
99
|
-
* Returns the sha256 hash of the input data.
|
|
100
|
-
* @param {Uint8Array} data The data to hash.
|
|
101
|
-
* @returns {HashBytes} The sha256 hash of the input data.
|
|
102
|
-
*/
|
|
103
|
-
digest(data: Uint8Array): HashBytes;
|
|
104
|
-
}
|
|
105
|
-
export interface BitcoinSigner {
|
|
106
|
-
/**
|
|
107
|
-
* Signs a Bitcoin transaction with a key pair.
|
|
108
|
-
* @param txHex The hex-encoded transaction to sign.
|
|
109
|
-
* @param keyUri The URI of the key to sign the transaction with.
|
|
110
|
-
* @returns {Promise<Hex>} A promise that resolves to the hex-encoded signed transaction.
|
|
111
|
-
*/
|
|
112
|
-
signTransaction(txHex: Hex, keyUri?: KeyIdentifier): Promise<Hex>;
|
|
113
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/core/key-manager/interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,CAAC;AAEF,uCAAuC;AACvC,MAAM,MAAM,aAAa,GAAG,MAAM,CA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H,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CACnE"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { DidUpdatePayload, UnixTimestamp } from '@did-btcr2/common';
|
|
2
|
-
import { DidServiceEndpoint, DidService as IDidService } from '@web5/dids';
|
|
3
|
-
import { RawTransactionV2, RawTransactionRest } from '@did-btcr2/bitcoin';
|
|
4
|
-
import { SignalsMetadata } from '../types/crud.js';
|
|
5
|
-
/**
|
|
6
|
-
* Beacon interface
|
|
7
|
-
* @interface IBeacon
|
|
8
|
-
* @type {IBeacon}
|
|
9
|
-
*/
|
|
10
|
-
export interface IBeacon {
|
|
11
|
-
/**
|
|
12
|
-
* A unique identifier for the Beacon
|
|
13
|
-
* @type {string}
|
|
14
|
-
*/
|
|
15
|
-
id: string;
|
|
16
|
-
/**
|
|
17
|
-
* The type of the Beacon
|
|
18
|
-
* @type {string}
|
|
19
|
-
*/
|
|
20
|
-
type: string;
|
|
21
|
-
/**
|
|
22
|
-
* The service endpoint of the Beacon
|
|
23
|
-
* @type {string}
|
|
24
|
-
*/
|
|
25
|
-
serviceEndpoint: DidServiceEndpoint;
|
|
26
|
-
/**
|
|
27
|
-
* Returns the Beacon Service object
|
|
28
|
-
* @type {BeaconService}
|
|
29
|
-
*/
|
|
30
|
-
service: BeaconService;
|
|
31
|
-
/**
|
|
32
|
-
* Generates a Beacon Signal Transaction
|
|
33
|
-
* @param {string} didUpdatePayload The DID update payload
|
|
34
|
-
* @returns {BeaconSignal} The Beacon Signal
|
|
35
|
-
*/
|
|
36
|
-
generateSignal(didUpdatePayload: string): BeaconSignal;
|
|
37
|
-
/**
|
|
38
|
-
* Processes a Beacon Signal.
|
|
39
|
-
* @param {RawTransactionV2} signal The raw transaction
|
|
40
|
-
* @param {SidecarData} signalsMetadata The signals metadata from the sidecar data
|
|
41
|
-
* @returns {Promise<DidUpdatePayload | undefined>} The DID update payload
|
|
42
|
-
*/
|
|
43
|
-
processSignal(signal: RawTransactionV2, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload | undefined>;
|
|
44
|
-
/**
|
|
45
|
-
* Broadcasts a signal.
|
|
46
|
-
* @param {DidUpdatePayload} didUpdatePayload The DID update payload.
|
|
47
|
-
* @returns {Promise<SignalMetadata>} The signal metadata.
|
|
48
|
-
*/
|
|
49
|
-
broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata>;
|
|
50
|
-
}
|
|
51
|
-
export interface BeaconService extends IDidService {
|
|
52
|
-
serviceEndpoint: DidServiceEndpoint;
|
|
53
|
-
casType?: string;
|
|
54
|
-
}
|
|
55
|
-
export interface BeaconServiceAddress extends BeaconService {
|
|
56
|
-
address: string;
|
|
57
|
-
}
|
|
58
|
-
export interface BeaconSignal {
|
|
59
|
-
beaconId: string;
|
|
60
|
-
beaconType: string;
|
|
61
|
-
beaconAddress: string;
|
|
62
|
-
tx: RawTransactionRest | RawTransactionV2;
|
|
63
|
-
blockheight: number;
|
|
64
|
-
blocktime: UnixTimestamp;
|
|
65
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ibeacon.d.ts","sourceRoot":"","sources":["../../../src/interfaces/ibeacon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACpB;;;OAGG;IACH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G;WACW,sBAAsB,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,oBAAoB,CAAC;IAIhG;;;;OAIG;WACW,0BAA0B,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAK1G;;;;OAIG;WACW,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,EAAE;CAGtE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../../src/utils/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqD,KAAK,EAAqC,MAAM,mBAAmB,CAAC;AAChI,OAAO,EAAgC,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,qBAAa,UAAU;IACrB;;;;;;;;;;;;;;;;OAgBG;WACW,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE;QAC/D,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;QACzB,YAAY,EAAE,KAAK,CAAC;KACrB,GAAG,MAAM;IAuFV;;;;;;;OAOG;WACW,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa;IA8HvD;;;OAGG;WACW,QAAQ,IAAI;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,UAAU,EAAE;YAAE,UAAU,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE;CAWnG"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { BaseMessage } from './base.js';
|
|
2
|
-
|
|
3
|
-
export type Advert = {
|
|
4
|
-
type?: 'BEACON_ADVERT';
|
|
5
|
-
to: string;
|
|
6
|
-
from: string;
|
|
7
|
-
cohortId: string;
|
|
8
|
-
cohortSize: number;
|
|
9
|
-
network: string;
|
|
10
|
-
threadId?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export class AdvertMessage extends BaseMessage {
|
|
14
|
-
public cohortId: string;
|
|
15
|
-
public cohortSize: number;
|
|
16
|
-
public network: string = 'signet';
|
|
17
|
-
|
|
18
|
-
constructor({ type = 'BEACON_ADVERT', to, from, threadId, cohortId, cohortSize, network }: Advert) {
|
|
19
|
-
super({ type, to, from, threadId, body: { cohortId, cohortSize, network }});
|
|
20
|
-
this.cohortId = cohortId;
|
|
21
|
-
this.cohortSize = cohortSize;
|
|
22
|
-
this.network = network;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Initializes an AdvertMessage from a given Advert object.
|
|
27
|
-
* @param {Advert} data - The Advert object to initialize the AdvertMessage.
|
|
28
|
-
* @returns {object} The serialized AdvertMessage.
|
|
29
|
-
*/
|
|
30
|
-
public static initialize(data: Advert): AdvertMessage {
|
|
31
|
-
if (data.type != 'BEACON_ADVERT'){
|
|
32
|
-
throw new Error(`Invalid type: ${data.type}`);
|
|
33
|
-
}
|
|
34
|
-
return new AdvertMessage(data);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { BaseMessage } from './base.js';
|
|
2
|
-
import { COHORT_SET } from './keygen.js';
|
|
3
|
-
|
|
4
|
-
export type CohortSet = {
|
|
5
|
-
type?: typeof COHORT_SET;
|
|
6
|
-
to: string;
|
|
7
|
-
from: string;
|
|
8
|
-
cohortId: string;
|
|
9
|
-
beaconAddress: string;
|
|
10
|
-
cohortKeys: Array<Uint8Array>;
|
|
11
|
-
threadId?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class CohortSetMessage extends BaseMessage {
|
|
15
|
-
public cohortId: string;
|
|
16
|
-
public beaconAddress: string;
|
|
17
|
-
public cohortKeys: Array<Uint8Array>;
|
|
18
|
-
|
|
19
|
-
constructor({ type = COHORT_SET, to, from, threadId, cohortId, beaconAddress, cohortKeys }: CohortSet) {
|
|
20
|
-
super({ type, to, from, threadId, body: { cohortId, beaconAddress, cohortKeys }});
|
|
21
|
-
this.cohortId = cohortId;
|
|
22
|
-
this.beaconAddress = beaconAddress;
|
|
23
|
-
this.cohortKeys = cohortKeys;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Initializes an CohortSetMessage from a given OptIn object.
|
|
28
|
-
* @param {OptIn} data - The OptIn object to initialize the CohortSetMessage.
|
|
29
|
-
* @returns {object} The serialized CohortSetMessage.
|
|
30
|
-
*/
|
|
31
|
-
public static fromJSON(data: CohortSet): CohortSetMessage {
|
|
32
|
-
if (data.type !== COHORT_SET) {
|
|
33
|
-
throw new Error(`Invalid type: ${data.type}`);
|
|
34
|
-
}
|
|
35
|
-
return new CohortSetMessage(data);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { MESSAGE_PREFIX } from './base.js';
|
|
2
|
-
|
|
3
|
-
export const COHORT_ADVERT = `${MESSAGE_PREFIX}musig2/keygen/cohort_advert`;
|
|
4
|
-
export const COHORT_INVITE = `${MESSAGE_PREFIX}musig2/keygen/cohort_invite`;
|
|
5
|
-
export const OPT_IN = `${MESSAGE_PREFIX}musig2/keygen/opt_in`;
|
|
6
|
-
export const COHORT_SET = `${MESSAGE_PREFIX}musig2/keygen/cohort_set`;
|
|
7
|
-
export const SUBSCRIBE = `${MESSAGE_PREFIX}musig2/keygen/subscribe`;
|
|
8
|
-
export const SUBSCRIBE_ACCEPT = `${MESSAGE_PREFIX}musig2/keygen/subscribe_accept`;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Maybe } from '@did-btcr2/common';
|
|
2
|
-
import { BaseMessage } from './base.js';
|
|
3
|
-
import { OPT_IN } from './keygen.js';
|
|
4
|
-
|
|
5
|
-
export type OptIn = {
|
|
6
|
-
type: typeof OPT_IN;
|
|
7
|
-
to: string;
|
|
8
|
-
from: string;
|
|
9
|
-
cohortId: string;
|
|
10
|
-
participantPk: Uint8Array;
|
|
11
|
-
threadId?: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export class OptInMessage extends BaseMessage {
|
|
15
|
-
public cohortId: string;
|
|
16
|
-
public participantPk: Uint8Array;
|
|
17
|
-
|
|
18
|
-
constructor({ type = OPT_IN, to, from, threadId, cohortId, participantPk }: OptIn) {
|
|
19
|
-
super({ type, to, from, threadId, body: { cohortId, participantPk }});
|
|
20
|
-
this.cohortId = cohortId;
|
|
21
|
-
this.participantPk = participantPk;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Initializes an OptInMessage from a given OptIn object.
|
|
26
|
-
* @param {OptIn} data - The OptIn object to initialize the OptInMessage.
|
|
27
|
-
* @returns {object} The serialized OptInMessage.
|
|
28
|
-
*/
|
|
29
|
-
public static fromJSON(data: Maybe<OptIn>): OptInMessage {
|
|
30
|
-
if (data.type != 'OPT_IN') {
|
|
31
|
-
throw new Error(`Invalid type: ${data.type}`);
|
|
32
|
-
}
|
|
33
|
-
return new OptInMessage(data);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { MESSAGE_PREFIX } from './base.js';
|
|
2
|
-
|
|
3
|
-
export const REQUEST_SIGNATURE = `${MESSAGE_PREFIX}musig2/sign/request_signature`;
|
|
4
|
-
export const AUTHORIZATION_REQUEST = `${MESSAGE_PREFIX}musig2/sign/authorization_request`;
|
|
5
|
-
export const NONCE_CONTRIBUTION = `${MESSAGE_PREFIX}musig2/sign/nonce_contribution`;
|
|
6
|
-
export const AGGREGATED_NONCE = `${MESSAGE_PREFIX}musig2/sign/aggregated_nonce`;
|
|
7
|
-
export const SIGNATURE_AUTHORIZATION = `${MESSAGE_PREFIX}musig2/sign/signature_authorization`;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { TapRootMultiSig } from '@did-btcr2/bitcoin';
|
|
2
|
-
import { COHORT_STATUS, COHORT_STATUS_TYPE } from './status.js';
|
|
3
|
-
|
|
4
|
-
export type Musig2CohortParams = {
|
|
5
|
-
id?: string;
|
|
6
|
-
minParticipants: number;
|
|
7
|
-
status: COHORT_STATUS_TYPE;
|
|
8
|
-
network: string;
|
|
9
|
-
coordinatorDid: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class Musig2Cohort {
|
|
13
|
-
/**
|
|
14
|
-
* Unique identifier for the cohort.
|
|
15
|
-
* @type {string}
|
|
16
|
-
*/
|
|
17
|
-
public id: string;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* DID of the coordinator.
|
|
21
|
-
* @type {string}
|
|
22
|
-
*/
|
|
23
|
-
public coordinatorDid: string;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Minimum number of participants required to finalize the cohort.
|
|
27
|
-
* @type {number}
|
|
28
|
-
*/
|
|
29
|
-
public minParticipants: number;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Status of the cohort.
|
|
33
|
-
* @type {string}
|
|
34
|
-
*/
|
|
35
|
-
public status: COHORT_STATUS_TYPE;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Network on which the cohort operates (e.g., 'mainnet', 'testnet').
|
|
39
|
-
* @type {string}
|
|
40
|
-
*/
|
|
41
|
-
public network: string;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Pending signature requests, mapping participant DIDs to their pending signatures.
|
|
45
|
-
* @type {Record<string, string>}
|
|
46
|
-
*/
|
|
47
|
-
public pendingSignatureRequests: Record<string, string> = {};
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* List of participant DIDs.
|
|
51
|
-
* @type {Array<string>}
|
|
52
|
-
*/
|
|
53
|
-
public participants: Array<string> = new Array<string>();
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* List of cohort keys (public keys).
|
|
57
|
-
* @type {Array<Uint8Array>}
|
|
58
|
-
*/
|
|
59
|
-
public cohortKeys: Array<Uint8Array> = new Array<Uint8Array>();
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Taproot Merkle root for the cohort.
|
|
63
|
-
* @type {Uint8Array}
|
|
64
|
-
*/
|
|
65
|
-
public trMerkleRoot?: Uint8Array;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Beacon address for the cohort, calculated from the Taproot multisig.
|
|
69
|
-
* @type {string}
|
|
70
|
-
*/
|
|
71
|
-
public beaconAddress?: string;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Creates a new Musig2Cohort instance.
|
|
75
|
-
* @param {Musig2CohortParams} params Parameters for initializing the cohort.
|
|
76
|
-
* @param {string} [params.id] Optional unique identifier for the cohort. If not provided, a random UUID will be generated.
|
|
77
|
-
* @param {number} params.minParticipants Minimum number of participants required to finalize the cohort.
|
|
78
|
-
* @param {string} params.coordinatorDid DID of the coordinator managing the cohort.
|
|
79
|
-
* @param {string} params.status Initial status of the cohort (e.g., 'PENDING', 'COHORT_SET').
|
|
80
|
-
* @param {string} params.network Network on which the cohort operates (e.g., 'mainnet', 'testnet').
|
|
81
|
-
*/
|
|
82
|
-
constructor(params: Musig2CohortParams) {
|
|
83
|
-
this.id = params.id || crypto.randomUUID();
|
|
84
|
-
this.minParticipants = params.minParticipants;
|
|
85
|
-
this.coordinatorDid = params.coordinatorDid;
|
|
86
|
-
this.status = params.status as COHORT_STATUS_TYPE || COHORT_STATUS.COHORT_ADVERTISED;
|
|
87
|
-
this.network = params.network;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
public finalize(): void {
|
|
91
|
-
if(this.participants.length < this.minParticipants) {
|
|
92
|
-
throw new Error('Not enough participants to finalize the cohort');
|
|
93
|
-
}
|
|
94
|
-
this.status = COHORT_STATUS.COHORT_SET_STATUS;
|
|
95
|
-
this.beaconAddress = this.calulateBeaconAddress();
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Calculates the beacon Taproot multisig address for the cohort using participant keys.
|
|
100
|
-
* @returns {string} The Taproot address for the cohort.
|
|
101
|
-
* @throws {Error} If the Taproot address cannot be calculated.
|
|
102
|
-
*/
|
|
103
|
-
public calulateBeaconAddress(): string {
|
|
104
|
-
const trMultisig = new TapRootMultiSig(this.cohortKeys, this.cohortKeys.length);
|
|
105
|
-
const branch = trMultisig.musigTree();
|
|
106
|
-
this.trMerkleRoot = branch.hash;
|
|
107
|
-
if(!branch.address) {
|
|
108
|
-
throw new Error('Failed to calculate Taproot address');
|
|
109
|
-
}
|
|
110
|
-
return branch.address;
|
|
111
|
-
}
|
|
112
|
-
}
|