@did-btcr2/method 0.18.0 → 0.19.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 +5240 -6079
- package/dist/browser.mjs +5240 -6079
- package/dist/cjs/core/beacon/aggregation/cohort/index.js +3 -3
- package/dist/cjs/core/beacon/aggregation/cohort/index.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js +1 -9
- package/dist/cjs/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
- package/dist/cjs/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
- package/dist/cjs/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/coordinator.js +14 -14
- package/dist/cjs/core/beacon/aggregation/coordinator.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/participant.js +4 -3
- package/dist/cjs/core/beacon/aggregation/participant.js.map +1 -1
- package/dist/cjs/core/beacon/aggregation/session/index.js +1 -1
- package/dist/cjs/core/beacon/aggregation/session/index.js.map +1 -1
- package/dist/cjs/core/beacon/cas-beacon.js +55 -0
- package/dist/cjs/core/beacon/cas-beacon.js.map +1 -0
- package/dist/cjs/core/beacon/factory.js +11 -10
- package/dist/cjs/core/beacon/factory.js.map +1 -1
- package/dist/cjs/core/beacon/interfaces.js +32 -0
- package/dist/cjs/core/beacon/interfaces.js.map +1 -0
- package/dist/cjs/core/beacon/singleton.js +59 -135
- package/dist/cjs/core/beacon/singleton.js.map +1 -1
- package/dist/cjs/core/beacon/smt-beacon.js +56 -0
- package/dist/cjs/core/beacon/smt-beacon.js.map +1 -0
- package/dist/cjs/core/beacon/utils.js +67 -105
- package/dist/cjs/core/beacon/utils.js.map +1 -1
- package/dist/cjs/core/identifier.js +18 -21
- package/dist/cjs/core/identifier.js.map +1 -1
- package/dist/cjs/core/interfaces.js +2 -0
- package/dist/cjs/core/interfaces.js.map +1 -0
- package/dist/cjs/core/resolve.js +511 -0
- package/dist/cjs/core/resolve.js.map +1 -0
- package/dist/cjs/{utils → core}/types.js.map +1 -1
- package/dist/cjs/core/{crud/update.js → update.js} +62 -52
- package/dist/cjs/core/update.js.map +1 -0
- package/dist/cjs/did-btcr2.js +109 -75
- package/dist/cjs/did-btcr2.js.map +1 -1
- package/dist/cjs/index.js +14 -15
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/appendix.js +10 -18
- package/dist/cjs/utils/appendix.js.map +1 -1
- package/dist/cjs/utils/did-document.js +51 -58
- package/dist/cjs/utils/did-document.js.map +1 -1
- package/dist/cjs/utils/general.js +1 -1
- package/dist/cjs/utils/general.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/index.js +3 -3
- package/dist/esm/core/beacon/aggregation/cohort/index.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/base.js +1 -9
- package/dist/esm/core/beacon/aggregation/cohort/messages/base.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/opt-in.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/keygen/subscribe.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/authorization-request.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/request-signature.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js +2 -1
- package/dist/esm/core/beacon/aggregation/cohort/messages/sign/signature-authorization.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js +36 -18
- package/dist/esm/core/beacon/aggregation/communication/adapter/nostr.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/coordinator.js +14 -14
- package/dist/esm/core/beacon/aggregation/coordinator.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/participant.js +4 -3
- package/dist/esm/core/beacon/aggregation/participant.js.map +1 -1
- package/dist/esm/core/beacon/aggregation/session/index.js +1 -1
- package/dist/esm/core/beacon/aggregation/session/index.js.map +1 -1
- package/dist/esm/core/beacon/cas-beacon.js +55 -0
- package/dist/esm/core/beacon/cas-beacon.js.map +1 -0
- package/dist/esm/core/beacon/factory.js +11 -10
- package/dist/esm/core/beacon/factory.js.map +1 -1
- package/dist/esm/core/beacon/interfaces.js +32 -0
- package/dist/esm/core/beacon/interfaces.js.map +1 -0
- package/dist/esm/core/beacon/singleton.js +59 -135
- package/dist/esm/core/beacon/singleton.js.map +1 -1
- package/dist/esm/core/beacon/smt-beacon.js +56 -0
- package/dist/esm/core/beacon/smt-beacon.js.map +1 -0
- package/dist/esm/core/beacon/utils.js +67 -105
- package/dist/esm/core/beacon/utils.js.map +1 -1
- package/dist/esm/core/identifier.js +18 -21
- package/dist/esm/core/identifier.js.map +1 -1
- package/dist/esm/core/interfaces.js +2 -0
- package/dist/esm/core/interfaces.js.map +1 -0
- package/dist/esm/core/resolve.js +511 -0
- package/dist/esm/core/resolve.js.map +1 -0
- package/dist/esm/{utils → core}/types.js.map +1 -1
- package/dist/esm/core/{crud/update.js → update.js} +62 -52
- package/dist/esm/core/update.js.map +1 -0
- package/dist/esm/did-btcr2.js +109 -75
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/index.js +14 -15
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/appendix.js +10 -18
- package/dist/esm/utils/appendix.js.map +1 -1
- package/dist/esm/utils/did-document.js +51 -58
- package/dist/esm/utils/did-document.js.map +1 -1
- package/dist/esm/utils/general.js +1 -1
- package/dist/esm/utils/general.js.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/index.d.ts +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts +0 -7
- package/dist/types/core/beacon/aggregation/cohort/messages/base.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/opt-in.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/keygen/subscribe.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/authorization-request.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/request-signature.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/cohort/messages/sign/signature-authorization.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts +13 -5
- package/dist/types/core/beacon/aggregation/communication/adapter/nostr.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/coordinator.d.ts +17 -29
- package/dist/types/core/beacon/aggregation/coordinator.d.ts.map +1 -1
- package/dist/types/core/beacon/aggregation/participant.d.ts.map +1 -1
- package/dist/types/core/beacon/cas-beacon.d.ts +47 -0
- package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -0
- package/dist/types/core/beacon/factory.d.ts +5 -4
- package/dist/types/core/beacon/factory.d.ts.map +1 -1
- package/dist/types/core/beacon/interfaces.d.ts +98 -0
- package/dist/types/core/beacon/interfaces.d.ts.map +1 -0
- package/dist/types/core/beacon/singleton.d.ts +22 -65
- package/dist/types/core/beacon/singleton.d.ts.map +1 -1
- package/dist/types/core/beacon/smt-beacon.d.ts +48 -0
- package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -0
- package/dist/types/core/beacon/utils.d.ts +19 -97
- package/dist/types/core/beacon/utils.d.ts.map +1 -1
- package/dist/types/core/identifier.d.ts.map +1 -1
- package/dist/types/core/interfaces.d.ts +94 -0
- package/dist/types/core/interfaces.d.ts.map +1 -0
- package/dist/types/core/resolve.d.ts +105 -0
- package/dist/types/core/resolve.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +71 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/core/{crud/update.d.ts → update.d.ts} +21 -20
- package/dist/types/core/update.d.ts.map +1 -0
- package/dist/types/did-btcr2.d.ts +45 -57
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/dist/types/index.d.ts +14 -15
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/utils/appendix.d.ts +5 -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 +31 -29
- package/dist/types/utils/did-document.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/core/beacon/aggregation/cohort/index.ts +3 -3
- package/src/core/beacon/aggregation/cohort/messages/base.ts +1 -12
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-advert.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/cohort-ready.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in-accept.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/opt-in.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/keygen/subscribe.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/aggregated-nonce.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/authorization-request.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/nonce-contribution.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/request-signature.ts +2 -2
- package/src/core/beacon/aggregation/cohort/messages/sign/signature-authorization.ts +2 -2
- package/src/core/beacon/aggregation/communication/adapter/nostr.ts +43 -21
- package/src/core/beacon/aggregation/coordinator.ts +41 -29
- package/src/core/beacon/aggregation/participant.ts +4 -3
- package/src/core/beacon/aggregation/session/index.ts +1 -1
- package/src/core/beacon/cas-beacon.ts +67 -0
- package/src/core/beacon/factory.ts +13 -15
- package/src/core/beacon/interfaces.ts +124 -0
- package/src/core/beacon/singleton.ts +75 -145
- package/src/core/beacon/smt-beacon.ts +70 -0
- package/src/core/beacon/utils.ts +80 -170
- package/src/core/identifier.ts +21 -24
- package/src/core/interfaces.ts +101 -0
- package/src/core/resolve.ts +707 -0
- package/src/core/types.ts +78 -0
- package/src/core/{crud/update.ts → update.ts} +75 -68
- package/src/did-btcr2.ts +152 -92
- package/src/index.ts +14 -24
- package/src/utils/appendix.ts +18 -22
- package/src/utils/did-document-builder.ts +1 -1
- package/src/utils/did-document.ts +67 -71
- package/src/utils/general.ts +1 -1
- package/dist/cjs/core/beacon/cid-aggregate.js +0 -116
- package/dist/cjs/core/beacon/cid-aggregate.js.map +0 -1
- package/dist/cjs/core/beacon/smt-aggregate.js +0 -126
- package/dist/cjs/core/beacon/smt-aggregate.js.map +0 -1
- package/dist/cjs/core/crud/deactivate.js +0 -14
- package/dist/cjs/core/crud/deactivate.js.map +0 -1
- package/dist/cjs/core/crud/read.js +0 -679
- package/dist/cjs/core/crud/read.js.map +0 -1
- package/dist/cjs/core/crud/update.js.map +0 -1
- package/dist/cjs/interfaces/beacon.js +0 -41
- package/dist/cjs/interfaces/beacon.js.map +0 -1
- package/dist/cjs/interfaces/crud.js +0 -2
- package/dist/cjs/interfaces/crud.js.map +0 -1
- package/dist/esm/core/beacon/cid-aggregate.js +0 -116
- package/dist/esm/core/beacon/cid-aggregate.js.map +0 -1
- package/dist/esm/core/beacon/smt-aggregate.js +0 -126
- package/dist/esm/core/beacon/smt-aggregate.js.map +0 -1
- package/dist/esm/core/crud/deactivate.js +0 -14
- package/dist/esm/core/crud/deactivate.js.map +0 -1
- package/dist/esm/core/crud/read.js +0 -679
- package/dist/esm/core/crud/read.js.map +0 -1
- package/dist/esm/core/crud/update.js.map +0 -1
- package/dist/esm/interfaces/beacon.js +0 -41
- package/dist/esm/interfaces/beacon.js.map +0 -1
- package/dist/esm/interfaces/crud.js +0 -2
- package/dist/esm/interfaces/crud.js.map +0 -1
- package/dist/types/core/beacon/cid-aggregate.d.ts +0 -102
- package/dist/types/core/beacon/cid-aggregate.d.ts.map +0 -1
- package/dist/types/core/beacon/smt-aggregate.d.ts +0 -111
- package/dist/types/core/beacon/smt-aggregate.d.ts.map +0 -1
- package/dist/types/core/crud/deactivate.d.ts +0 -13
- package/dist/types/core/crud/deactivate.d.ts.map +0 -1
- package/dist/types/core/crud/read.d.ts +0 -334
- package/dist/types/core/crud/read.d.ts.map +0 -1
- package/dist/types/core/crud/update.d.ts.map +0 -1
- package/dist/types/interfaces/beacon.d.ts +0 -116
- package/dist/types/interfaces/beacon.d.ts.map +0 -1
- package/dist/types/interfaces/crud.d.ts +0 -32
- package/dist/types/interfaces/crud.d.ts.map +0 -1
- package/dist/types/utils/types.d.ts +0 -38
- package/dist/types/utils/types.d.ts.map +0 -1
- package/src/canonicalize.d.ts +0 -6
- package/src/core/beacon/cid-aggregate.ts +0 -153
- package/src/core/beacon/smt-aggregate.ts +0 -135
- package/src/core/crud/deactivate.ts +0 -13
- package/src/core/crud/read.ts +0 -948
- package/src/interfaces/beacon.ts +0 -137
- package/src/interfaces/crud.ts +0 -33
- package/src/utils/types.ts +0 -41
- /package/dist/cjs/{utils → core}/types.js +0 -0
- /package/dist/esm/{utils → core}/types.js +0 -0
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { RawTransactionV2 } from '@did-btcr2/bitcoin';
|
|
2
|
-
import { DidUpdateInvocation, DidUpdatePayload, MethodError } from '@did-btcr2/common';
|
|
3
|
-
import { DidServiceEndpoint } from '@web5/dids';
|
|
4
|
-
import { Beacon, BeaconService, BeaconSignal } from '../../interfaces/beacon.js';
|
|
5
|
-
import { BeaconSidecarData, CIDAggregateSidecar, SignalsMetadata } from '../../utils/types.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#cidaggregate-beacon | 5.2 CIDAggregate Beacon}.
|
|
9
|
-
*
|
|
10
|
-
* A Beacon of the type CIDAggregatoBeacon is a Beacon that publishes Bitcoin transactions containing a Content
|
|
11
|
-
* Identifier (CID) announcing an Aggregated DID Update Bundle. An Aggregated DID Update Bundle is a JSON object that
|
|
12
|
-
* maps did:btcr2 identifiers to CID values for the individual DID Update Payloads. The Aggregated DID Update Bundle CID
|
|
13
|
-
* (bundleCID) SHOULD be resolvable against a Content Addressable Storage (CAS) system such as IPFS, while the CID for
|
|
14
|
-
* the DID Update Payload (payloadCID) MAY be resolvable against a CAS or provided through a Sidecar mechanism. It is
|
|
15
|
-
* RECOMMENDED that this type of Beacon is only included in a DID document if the DID controller is REQUIRED to
|
|
16
|
-
* participate in authorizing Bitcoin transactions from this Beacon. In other words, this Beacon SHOULD identify an
|
|
17
|
-
* n-of-n P2TR Bitcoin address where n is the number of unique DID controllers submitting updates through the Beacon.
|
|
18
|
-
*
|
|
19
|
-
* @class CIDAggregateBeacon
|
|
20
|
-
* @type {CIDAggregateBeacon}
|
|
21
|
-
* @extends {Beacon}
|
|
22
|
-
*/
|
|
23
|
-
export class CIDAggregateBeacon extends Beacon {
|
|
24
|
-
/**
|
|
25
|
-
* Creates an instance of CIDAggregateBeacon.
|
|
26
|
-
* @param {BeaconService} service The service of the Beacon.
|
|
27
|
-
* @param {?BeaconSidecarData} [sidecar] The sidecar data of the Beacon.
|
|
28
|
-
*/
|
|
29
|
-
constructor(service: BeaconService, sidecar?: BeaconSidecarData<CIDAggregateSidecar>) {
|
|
30
|
-
super({ ...service, type: 'CIDAggregateBeacon' }, sidecar);
|
|
31
|
-
}
|
|
32
|
-
get service(): BeaconService {
|
|
33
|
-
return {
|
|
34
|
-
type : this.type,
|
|
35
|
-
id : this.id,
|
|
36
|
-
serviceEndpoint : this.serviceEndpoint
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* TODO: Finish implementation
|
|
43
|
-
*
|
|
44
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#establish-cidaggregate-beacon | 5.2.1 Establish CIDAggregate Beacon}.
|
|
45
|
-
*
|
|
46
|
-
* To establish a CIDAggregatorBeacon, a cohort of cooperating parties SHOULD generate an n-of-n P2TR Bitcoin address
|
|
47
|
-
* where each party contributes a public key. Furthermore, each party SHOULD verify that their key is part of the
|
|
48
|
-
* address and all other keys that are part of the address are keys with controllers able to produce valid signatures.
|
|
49
|
-
* To establish a Beacon there are two roles. One is the cohort participant, they want to join a Beacon cohort and
|
|
50
|
-
* submit a request to do so with a key and proof of control over that key. The other is the Beacon coordinator, they
|
|
51
|
-
* advertise and curate Beacon cohorts by combining Beacon participants into cohorts, verifying proofs of control, and
|
|
52
|
-
* producing Beacon addresses.
|
|
53
|
-
*
|
|
54
|
-
* @param {string} id The identifier of the Beacon.
|
|
55
|
-
* @param {string} type The type of the Beacon.
|
|
56
|
-
* @param {DidServiceEndpoint} serviceEndpoint The service endpoint of the Beacon.
|
|
57
|
-
* @returns {CIDAggregateBeacon} The established CIDAggregate Beacon.
|
|
58
|
-
*/
|
|
59
|
-
static establish(id: string, type: string, serviceEndpoint: DidServiceEndpoint): CIDAggregateBeacon {
|
|
60
|
-
return new CIDAggregateBeacon({ id, type, serviceEndpoint });
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* TODO: Figure out if this is necessary or not.
|
|
66
|
-
* @param {string} didUpdatePayload The DID Update Payload to generate the signal for.
|
|
67
|
-
* @returns {BeaconSignal} The generated signal.
|
|
68
|
-
* @throws {MethodError} if the signal is invalid.
|
|
69
|
-
*/
|
|
70
|
-
generateSignal(didUpdatePayload: string): BeaconSignal {
|
|
71
|
-
throw new MethodError('Method not implemented.', `METHOD_NOT_IMPLEMENTED`, {didUpdatePayload});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* TODO: Finish implementation
|
|
77
|
-
*
|
|
78
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#process-cidaggregate-beacon-signal | 5.2.3 Process CIDAggregate Beacon Signal}.
|
|
79
|
-
*
|
|
80
|
-
* A Beacon Signal from a CIDAggregate Beacon is a Bitcoin transaction that contains the hashBytes of a DID Update
|
|
81
|
-
* Bundle in its first transaction output. The corresponding DID Update Bundle MUST either be provided through Sidecar
|
|
82
|
-
* Data or by converting hashBytes into a IPFS v1 Content Identifier and attempting to retrieve it from Content
|
|
83
|
-
* Addressable Storage. The DID Update Bundle maps from did:btcr2 identifiers to hashes of DID Update payloads
|
|
84
|
-
* applicable for that identifier. Again this algorithm attempts to retrieve and validate the DID Update Payload
|
|
85
|
-
* identified for the identifier being resolved. If successful, the DID Update Payload is returned.
|
|
86
|
-
*
|
|
87
|
-
* The Process CIDAggregate Beacon Signal algorithm is called by the Process Beacon Signals algorithm as part of the
|
|
88
|
-
* Read operation.
|
|
89
|
-
*
|
|
90
|
-
* It takes as inputs a did:btcr2 identifier, Identifier, a Beacon Signal, tx, and a optional
|
|
91
|
-
* object, signalSidecarData, containing any sidecar data provided to the resolver for the Beacon Signal identified by
|
|
92
|
-
* the Bitcoin transaction identifier.
|
|
93
|
-
*
|
|
94
|
-
* It returns the DID Update payload announced by the Beacon Signal for the
|
|
95
|
-
* did:btcr2 identifier being resolved or throws an error.
|
|
96
|
-
*
|
|
97
|
-
* @param {RawTransactionV2} signal Bitcoin transaction representing a Beacon Signal.
|
|
98
|
-
* @param {SignalsMetadata} signalsMetadata Optional sidecar data for the Beacon Signal.
|
|
99
|
-
* @returns {Promise<DidUpdatePayload | undefined>} The DID Update payload announced by the Beacon Signal.
|
|
100
|
-
* @throws {DidError} if the signalTx is invalid or the signalsMetadata is invalid.
|
|
101
|
-
*/
|
|
102
|
-
processSignal(signal: RawTransactionV2, signalsMetadata: SignalsMetadata): Promise<DidUpdateInvocation | undefined> {
|
|
103
|
-
throw new MethodError('Method not implemented.', `METHOD_NOT_IMPLEMENTED`, {signal, signalsMetadata});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* TODO: Finish implementation
|
|
108
|
-
*
|
|
109
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#broadcast-cidaggregate-beacon-signal | 5.2.2 Broadcast CIDAggregate Beacon Signal}.
|
|
110
|
-
*
|
|
111
|
-
* The Broadcast CIDAggregate Beacon Signal algorithm involving two roles: a set of cohort participants and a Beacon
|
|
112
|
-
* coordinator. The Beacon coordinator collects individual DID Update Payload Content Identifiers (CIDs) for specific
|
|
113
|
-
* did:btcr2 idntifiers and aggregates them into a DID Update Bundle, which is then published to a Content Addressable
|
|
114
|
-
* Storage (CAS). The CID for the DID Update Bundle is included in a Partially Signed Bitcoin Transaction (PSBT) transaction
|
|
115
|
-
* output spent from the Beacon’s n-of-n address. Each of the n cohort participants in the Beacon MUST sign the
|
|
116
|
-
* transaction before it can be broadcast to the network. It is RECOMMENDED that cohort participants keep a copy of
|
|
117
|
-
* the DID Update Bundle and separately pin it to the CAS.
|
|
118
|
-
*
|
|
119
|
-
* @param {DidUpdatePayload} didUpdatePayload The verificationMethod object to be used for signing.
|
|
120
|
-
* @returns {SignalsMetadata} Successful output of a bitcoin transaction.
|
|
121
|
-
* @throws {SingletonBeaconError} if the bitcoin address is invalid or unfunded.
|
|
122
|
-
*/
|
|
123
|
-
broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata> {
|
|
124
|
-
throw new MethodError('Method not implemented.', `METHOD_NOT_IMPLEMENTED`, didUpdatePayload);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* TODO: Finish implementation
|
|
129
|
-
*
|
|
130
|
-
* 5.2.1.1 Create CIDAggregate Beacon Advertisement
|
|
131
|
-
* Any entity MAY act in the role of Beacon coordinator, creating a Beacon advertisement that they can broadcast across any medium. A Beacon advertisement specifies the properties of the Beacon that
|
|
132
|
-
* the coordinator intends to establish, including the Beacon Type, cohort size, update frequency, and response latency. Once the advertisement has been created and broadcast, the coordinator waits
|
|
133
|
-
* for enough participants to opt in before establishing the Beacon.
|
|
134
|
-
*
|
|
135
|
-
* 5.2.1.2 CIDAggregate Beacon Opt-in
|
|
136
|
-
* DID controllers who wish to participate in a Beacon cohort first find potential Beacon advertisements that meet their needs. This includes checking the Beacon terms and update frequency, etc. If
|
|
137
|
-
* satisfied, they create a secp256k1 cohort keypair and send an Opt-In request to the endpoint specified in the advertisement.
|
|
138
|
-
*
|
|
139
|
-
* 5.2.1.3 Cohort Set
|
|
140
|
-
* Once a Beacon Aggregator has received enough opt-in responses from participants to satisfy the Beacon properties, they generate the n-of-n P2TR Bitcoin address for the Beacon. The address and all
|
|
141
|
-
* the cohort public keys the address is constructed from are then sent to all participants in a CohortSet message.
|
|
142
|
-
*
|
|
143
|
-
* 5.2.1.4 Add Beacon Service Endpoint to DID Document
|
|
144
|
-
* A participant receiving a CohortSet message first verifies their cohort key is included in the cohort, then calculates the P2TR Beacon address for themselves and verifies it matches the address
|
|
145
|
-
* provided. They MAY wait until the Beacon address is funded before adding the Beacon as a service in the DID document. The following is an example of the Beacon service endpoint the DID controller
|
|
146
|
-
* adds into their DID document, the Beacon address is converted into a URI following BIP21:
|
|
147
|
-
* {
|
|
148
|
-
* "id": "#cidAggregateBeacon",
|
|
149
|
-
* "type": "CIDAggregateBeacon",
|
|
150
|
-
* "serviceEndpoint": "bitcoin:tb1pfdnyc8vxeca2zpsg365sn308dmrpka4e0n9c5axmp2nptdf7j6ts7eqhr8"
|
|
151
|
-
* }
|
|
152
|
-
*/
|
|
153
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { RawTransactionV2 } from '@did-btcr2/bitcoin';
|
|
2
|
-
import { DidUpdatePayload, MethodError } from '@did-btcr2/common';
|
|
3
|
-
import { DidServiceEndpoint } from '@web5/dids';
|
|
4
|
-
import { Beacon, BeaconService, BeaconSignal } from '../../interfaces/beacon.js';
|
|
5
|
-
import { BeaconSidecarData, SignalsMetadata, SMTAggregateSidecar } from '../../utils/types.js';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* TODO: Finish implementation
|
|
9
|
-
*
|
|
10
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#smtaggregate-beacon | 5.3 SMTAggregate Beacon}.
|
|
11
|
-
*
|
|
12
|
-
* A SMTAggregate Beacon is a Beacon whose Beacon Signals are Bitcoin transactions containing the root of a Sparse
|
|
13
|
-
* Merkle Tree (SMT). The SMT root attests to a set of DID Update Payloads, however, the updates themselves MUST be
|
|
14
|
-
* provided along with a proof of inclusion against the SMT root through a Sidecar mechanism during resolution. Using
|
|
15
|
-
* the SMT root a resolver can then verify the inclusion proof for the given DID Update Payload. If a DID document
|
|
16
|
-
* includes a SMTAggregator Beacon in their set of Beacon services, then they MUST provide proofs for each signal that
|
|
17
|
-
* the Beacon broadcasts. If they did not submit an update to their DID in a signal, then they MUST provide a proof of
|
|
18
|
-
* non-inclusion for that signal.
|
|
19
|
-
*
|
|
20
|
-
* @class SMTAggregateBeacon
|
|
21
|
-
* @type {SMTAggregateBeacon}
|
|
22
|
-
* @extends {Beacon}
|
|
23
|
-
*/
|
|
24
|
-
export class SMTAggregateBeacon extends Beacon {
|
|
25
|
-
/**
|
|
26
|
-
* Creates an instance of SMTAggregateBeacon.
|
|
27
|
-
* @param {BeaconService} service The Beacon service.
|
|
28
|
-
* @param {?BeaconSidecarData} [sidecar] Optional sidecar data.
|
|
29
|
-
*/
|
|
30
|
-
constructor(service: BeaconService, sidecar?: BeaconSidecarData<SMTAggregateSidecar>) {
|
|
31
|
-
super({ ...service, type: 'SMTAggregateBeacon' }, sidecar);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Get the Beacon service.
|
|
36
|
-
* @readonly
|
|
37
|
-
* @type {BeaconService} The Beacon service.
|
|
38
|
-
*/
|
|
39
|
-
get service(): BeaconService {
|
|
40
|
-
const service = {
|
|
41
|
-
type : this.type,
|
|
42
|
-
id : this.id,
|
|
43
|
-
serviceEndpoint : this.serviceEndpoint
|
|
44
|
-
};
|
|
45
|
-
return service;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* TODO: Figure out if this is necessary or not.
|
|
50
|
-
* @param {string} didUpdatePayload The DID Update Payload to generate the signal for.
|
|
51
|
-
* @returns {BeaconSignal} The generated signal.
|
|
52
|
-
* @throws {MethodError} if the signal is invalid.
|
|
53
|
-
*/
|
|
54
|
-
public generateSignal(didUpdatePayload: string): BeaconSignal {
|
|
55
|
-
throw new MethodError('Method not implemented.', `METHOD_NOT_IMPLEMENTED`, {didUpdatePayload});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#establish-beacon | 5.3.1 Establish Beacon}.
|
|
60
|
-
*
|
|
61
|
-
* The Establish Beacon algorithm is essentially the same as for the CIDAggregate Beacon in Establish CIDAggregate
|
|
62
|
-
* Beacon. A cohort of DID controllers need to coordinate to produce a Bitcoin address that will act as the Beacon.
|
|
63
|
-
* It is RECOMMENDED this is an n-of-n P2TR address, with n being the set of DID controllers in the cohort. Once the
|
|
64
|
-
* address has been created, and all parties in the cohort acknowledge their intention to participate in that Beacon,
|
|
65
|
-
* each DID controller SHOULD add the Beacon as a service to their DID document.
|
|
66
|
-
*
|
|
67
|
-
* Additionally, the SMTAggregate Beacon cohort participants MUST register the did:btcr2 identifiers they intend use
|
|
68
|
-
* this Beacon with. This is so the Beacon coordinator can generate the necessary proofs of both inclusion and
|
|
69
|
-
* non-inclusion for each DID.
|
|
70
|
-
*
|
|
71
|
-
* Static, convenience method for establishing a Beacon object.
|
|
72
|
-
*
|
|
73
|
-
* @param {string} id The Beacon ID.
|
|
74
|
-
* @param {string} type The Beacon type.
|
|
75
|
-
* @param {DidServiceEndpoint} serviceEndpoint The service endpoint.
|
|
76
|
-
* @returns {Beacon} The Beacon.
|
|
77
|
-
*/
|
|
78
|
-
public static establish(id: string, type: string, serviceEndpoint: DidServiceEndpoint): SMTAggregateBeacon {
|
|
79
|
-
return new SMTAggregateBeacon({ id, type, serviceEndpoint });
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
*
|
|
84
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#broadcast-smtaggregate-beacon-signal | 5.3.2 Broadcast SMTAggregate Beacon Signal}.
|
|
85
|
-
*
|
|
86
|
-
* See {@link Beacon.broadcastSignal | Beacon Interface Method broadcastSignal} for more information.
|
|
87
|
-
*
|
|
88
|
-
* To publish a DID Update Payload, the DID controller MUST get a hash of the DID Update Payload included at the leaf
|
|
89
|
-
* of the Sparse Merkle Tree (SMT) identified by their did:btcr2 identifier and receive an inclusion proof for this
|
|
90
|
-
* data. If a member of the Beacon cohort does not wish to announce an update in a Beacon Signal, they MUST receive
|
|
91
|
-
* and verify a proof of non-inclusion for their DID. Upon verifying the non-inclusion proof against the SMT root
|
|
92
|
-
* contained in the Beacon Signal, they SHOULD accept and authorize the signal following the MuSig2 protocol. Once all
|
|
93
|
-
* members of the cohort have authorized the signal, it can be broadcast as a transaction to the Bitcoin network. DID
|
|
94
|
-
* controllers are responsible for persisting their DID updates and proofs, these will need to be provided through a
|
|
95
|
-
* Sidecar mechanism during a resolution process.
|
|
96
|
-
*
|
|
97
|
-
* @param {DidUpdatePayload} didUpdatePayload The DID Update Payload to broadcast.
|
|
98
|
-
* @returns {Promise<SignalMetadata>} The signal metadata.
|
|
99
|
-
* @throws {MethodError} if the signal is invalid.
|
|
100
|
-
*/
|
|
101
|
-
public broadcastSignal(didUpdatePayload: DidUpdatePayload): Promise<SignalsMetadata> {
|
|
102
|
-
throw new MethodError('Method not implemented.', `METHOD_NOT_IMPLEMENTED`, didUpdatePayload);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#process-smtaggregate-beacon-signal | 5.3.3 Process SMTAggregate Beacon Signal}.
|
|
108
|
-
*
|
|
109
|
-
* See {@link Beacon.processSignal | Beacon Interface Method processSignal} for more information.
|
|
110
|
-
*
|
|
111
|
-
* A Beacon Signal from a SMTAggregate Beacon is a Bitcoin transaction with the first transaction output of the format
|
|
112
|
-
* [OP_RETURN, OP_PUSH32, <32bytes>]. The 32 bytes of data contained within this transaction output represent the root
|
|
113
|
-
* of a Sparse Merkle Tree (SMT). This SMT aggregates a set of hashes of DID Update payloads. In order to process
|
|
114
|
-
* these Beacon Signals, the resolver MUST have been passed Sidecar data for this signal containing either the DID
|
|
115
|
-
* Update payload object and a SMT proof that the hash of this object is in the SMT at the leaf indexed by the
|
|
116
|
-
* did:Identifier being resolved. Or theSidecar data:: MUST contain a proof that the leaf indexed by the
|
|
117
|
-
* did:Identifier is empty, thereby proving that theSMT:: does not contain an update for their identifier.
|
|
118
|
-
*
|
|
119
|
-
* The Process SMTAggregate Beacon Signal is called by the Process Beacon Signals algorithm as part of the Read
|
|
120
|
-
* operation. It takes as inputs a did:btcr2 identifier, Identifier, a Beacon Signal, tx, and a optional object,
|
|
121
|
-
* signalSidecarData, containing any sidecar data provided to the resolver for the Beacon Signal identified by the
|
|
122
|
-
* Bitcoin transaction identifier.
|
|
123
|
-
*
|
|
124
|
-
* It returns the DID Update payload announced by the Beacon Signal for the did:btcr2 identifier being resolved or
|
|
125
|
-
* throws an error.
|
|
126
|
-
*
|
|
127
|
-
* @param {RawTransactionV2} signal The raw transaction signal.
|
|
128
|
-
* @param {SignalsMetadata} signalsMetadata The signals metadata.
|
|
129
|
-
* @returns {Promise<DidUpdatePayload | undefined>} The updated DID document.
|
|
130
|
-
* @throws {MethodError} if the signal is invalid.
|
|
131
|
-
*/
|
|
132
|
-
public processSignal(signal: RawTransactionV2, signalsMetadata: SignalsMetadata): Promise<DidUpdatePayload | undefined> {
|
|
133
|
-
throw new MethodError('Method not implemented.', `METHOD_NOT_IMPLEMENTED`, {signal, signalsMetadata});
|
|
134
|
-
}
|
|
135
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { DidBtcr2 } from '../../did-btcr2.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Implements {@link https://dcdpr.github.io/did-btcr2/#deactivate | 4.4 Deactivate}
|
|
5
|
-
* To deactivate a did:btcr2, the DID controller MUST add the property deactivated with the value true on the DID
|
|
6
|
-
* document. To do this, the DID controller constructs a valid DID Update Payload with a JSON patch that adds this
|
|
7
|
-
* property and announces the payload through a Beacon in their current DID document following the algorithm in Update.
|
|
8
|
-
* Once a did:btcr2 has been deactivated this state is considered permanent and resolution MUST terminate.
|
|
9
|
-
* @class Deactivate
|
|
10
|
-
* @type {Deactivate}
|
|
11
|
-
* @extends {DidBtcr2}
|
|
12
|
-
*/
|
|
13
|
-
export class Deactivate extends DidBtcr2 {}
|