@did-btcr2/method 0.56.0 → 0.59.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/README.md +12 -4
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser.js +3 -3
- package/dist/browser.mjs +3 -3
- package/dist/cjs/index.js +183 -42
- package/dist/esm/core/beacon/beacon.js +19 -2
- package/dist/esm/core/beacon/beacon.js.map +1 -1
- package/dist/esm/core/beacon/cas-beacon.js +7 -6
- package/dist/esm/core/beacon/cas-beacon.js.map +1 -1
- package/dist/esm/core/beacon/factory.js +6 -4
- package/dist/esm/core/beacon/factory.js.map +1 -1
- package/dist/esm/core/beacon/signal-discovery.js +24 -3
- package/dist/esm/core/beacon/signal-discovery.js.map +1 -1
- package/dist/esm/core/beacon/singleton-beacon.js +2 -2
- package/dist/esm/core/beacon/singleton-beacon.js.map +1 -1
- package/dist/esm/core/beacon/smt-beacon.js +7 -6
- package/dist/esm/core/beacon/smt-beacon.js.map +1 -1
- package/dist/esm/core/did-sender-resolver.js +8 -2
- package/dist/esm/core/did-sender-resolver.js.map +1 -1
- package/dist/esm/core/resolver.js +79 -28
- package/dist/esm/core/resolver.js.map +1 -1
- package/dist/esm/core/updater.js +17 -4
- package/dist/esm/core/updater.js.map +1 -1
- package/dist/esm/did-btcr2.js +25 -8
- package/dist/esm/did-btcr2.js.map +1 -1
- package/dist/esm/utils/appendix.js +36 -5
- package/dist/esm/utils/appendix.js.map +1 -1
- package/dist/types/core/beacon/beacon.d.ts +10 -1
- package/dist/types/core/beacon/beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/cas-beacon.d.ts +2 -1
- package/dist/types/core/beacon/cas-beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/factory.d.ts +3 -1
- package/dist/types/core/beacon/factory.d.ts.map +1 -1
- package/dist/types/core/beacon/signal-discovery.d.ts +14 -0
- package/dist/types/core/beacon/signal-discovery.d.ts.map +1 -1
- package/dist/types/core/beacon/singleton-beacon.d.ts +1 -1
- package/dist/types/core/beacon/singleton-beacon.d.ts.map +1 -1
- package/dist/types/core/beacon/smt-beacon.d.ts +2 -1
- package/dist/types/core/beacon/smt-beacon.d.ts.map +1 -1
- package/dist/types/core/did-sender-resolver.d.ts.map +1 -1
- package/dist/types/core/interfaces.d.ts +13 -0
- package/dist/types/core/interfaces.d.ts.map +1 -1
- package/dist/types/core/resolver.d.ts +13 -0
- package/dist/types/core/resolver.d.ts.map +1 -1
- package/dist/types/core/updater.d.ts +11 -4
- package/dist/types/core/updater.d.ts.map +1 -1
- package/dist/types/did-btcr2.d.ts.map +1 -1
- package/dist/types/utils/appendix.d.ts +30 -4
- package/dist/types/utils/appendix.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/core/beacon/beacon.ts +26 -4
- package/src/core/beacon/cas-beacon.ts +7 -6
- package/src/core/beacon/factory.ts +6 -4
- package/src/core/beacon/interfaces.ts +1 -1
- package/src/core/beacon/signal-discovery.ts +25 -3
- package/src/core/beacon/singleton-beacon.ts +2 -2
- package/src/core/beacon/smt-beacon.ts +7 -6
- package/src/core/did-sender-resolver.ts +10 -2
- package/src/core/interfaces.ts +14 -0
- package/src/core/resolver.ts +95 -29
- package/src/core/updater.ts +25 -5
- package/src/did-btcr2.ts +30 -9
- package/src/utils/appendix.ts +37 -5
package/dist/esm/did-btcr2.js
CHANGED
|
@@ -85,7 +85,8 @@ export class DidBtcr2 {
|
|
|
85
85
|
versionId: resolutionOptions.versionId,
|
|
86
86
|
versionTime: resolutionOptions.versionTime,
|
|
87
87
|
genesisDocument: resolutionOptions.sidecar?.genesisDocument,
|
|
88
|
-
maxDiscoveryRounds: resolutionOptions.maxDiscoveryRounds
|
|
88
|
+
maxDiscoveryRounds: resolutionOptions.maxDiscoveryRounds,
|
|
89
|
+
minConf: resolutionOptions.minConf
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
/**
|
|
@@ -112,8 +113,14 @@ export class DidBtcr2 {
|
|
|
112
113
|
* Also throws if the beacon service is not found.
|
|
113
114
|
*/
|
|
114
115
|
static update({ sourceDocument, patches, sourceVersionId, verificationMethodId, beaconId, }) {
|
|
115
|
-
// Validate that the verificationMethodId is authorized for capabilityInvocation
|
|
116
|
-
|
|
116
|
+
// Validate that the verificationMethodId is authorized for capabilityInvocation.
|
|
117
|
+
// Both sides are resolved to absolute DID URLs first, so the caller's spelling of the
|
|
118
|
+
// reference and the document's spelling of the entry may differ: either is legal per
|
|
119
|
+
// DID Core. This is the same rule the read path applies to an update's proof, so an
|
|
120
|
+
// update this factory authorizes is one the resolver will also accept.
|
|
121
|
+
const authorizedMethodId = Appendix.relationshipMethodId(verificationMethodId, sourceDocument.id);
|
|
122
|
+
const authorized = authorizedMethodId !== undefined && sourceDocument.capabilityInvocation?.some(entry => Appendix.relationshipMethodId(entry, sourceDocument.id) === authorizedMethodId);
|
|
123
|
+
if (!authorized) {
|
|
117
124
|
throw new UpdateError('Invalid verificationMethodId: not authorized for capabilityInvocation', INVALID_DID_DOCUMENT, sourceDocument);
|
|
118
125
|
}
|
|
119
126
|
// Get the verification method to be used for signing the update
|
|
@@ -130,9 +137,13 @@ export class DidBtcr2 {
|
|
|
130
137
|
if (!verificationMethod.publicKeyMultibase?.startsWith(MULTIKEY_PUBLIC_KEY_MULTIBASE_PREFIX)) {
|
|
131
138
|
throw new UpdateError(`Invalid verificationMethodId: publicKeyMultibase prefix must start with "${MULTIKEY_PUBLIC_KEY_MULTIBASE_PREFIX}"`, INVALID_DID_DOCUMENT, verificationMethod);
|
|
132
139
|
}
|
|
133
|
-
// Find the beacon service matching the given beaconId
|
|
140
|
+
// Find the beacon service matching the given beaconId. A service `id` may be a relative
|
|
141
|
+
// DID URL, so both sides are resolved against the document before comparison; an
|
|
142
|
+
// unusable beaconId matches nothing rather than matching an unusable service id.
|
|
143
|
+
const targetBeaconId = Appendix.absoluteDidUrl(beaconId, sourceDocument.id);
|
|
134
144
|
const beaconService = sourceDocument.service
|
|
135
|
-
.filter((service) =>
|
|
145
|
+
.filter((service) => targetBeaconId !== undefined
|
|
146
|
+
&& Appendix.absoluteDidUrl(service.id, sourceDocument.id) === targetBeaconId)
|
|
136
147
|
.filter((service) => !!service)
|
|
137
148
|
.shift();
|
|
138
149
|
if (!beaconService) {
|
|
@@ -166,9 +177,15 @@ export class DidBtcr2 {
|
|
|
166
177
|
throw new MethodError(`Method not supported: ${parsedDid.method}`, METHOD_NOT_SUPPORTED, { identifier: didDocument.id });
|
|
167
178
|
}
|
|
168
179
|
// Attempt to find a verification method that matches the given method ID, or if not given,
|
|
169
|
-
// find the first verification method intended for signing claims.
|
|
170
|
-
|
|
171
|
-
|
|
180
|
+
// find the first verification method intended for signing claims. Both sides are resolved
|
|
181
|
+
// to absolute DID URLs first: a document may spell either the verification method `id` or
|
|
182
|
+
// the reference to it as a relative DID URL (`#initialKey`), and the two must still match.
|
|
183
|
+
const targetId = Appendix.absoluteDidUrl(methodId, didDocument.id)
|
|
184
|
+
?? Appendix.relationshipMethodId(didDocument.assertionMethod?.[0], didDocument.id);
|
|
185
|
+
// An unusable target matches nothing: without this guard it compares equal to every
|
|
186
|
+
// method whose own id is unusable, and the document's first malformed method is
|
|
187
|
+
// returned as the signing method.
|
|
188
|
+
const verificationMethod = targetId === undefined ? undefined : didDocument.verificationMethod?.find((vm) => Appendix.absoluteDidUrl(vm.id, didDocument.id) === targetId);
|
|
172
189
|
// If no verification method is found, throw an error
|
|
173
190
|
if (!(verificationMethod && verificationMethod.publicKeyMultibase)) {
|
|
174
191
|
throw new DidError(DidErrorCode.InternalError, 'A verification method intended for signing could not be determined from the DID Document');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did-btcr2.js","sourceRoot":"","sources":["../../src/did-btcr2.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL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Ae,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;QAErF,oFAAoF;QACpF,gFAAgF;QAChF,kCAAkC;QAClC,MAAM,kBAAkB,GAAG,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,kBAAkB,EAAE,IAAI,CAClG,CAAC,EAAyB,EAAE,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,WAAW,CAAC,EAAE,CAAC,KAAK,QAAQ,CAC3F,CAAC;QAEF,qDAAqD;QACrD,IAAI,CAAC,CAAC,kBAAkB,IAAI,kBAAkB,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACnE,MAAM,IAAI,QAAQ,CAChB,YAAY,CAAC,aAAa,EAC1B,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QACD,OAAO,kBAA2C,CAAC;IACrD,CAAC"}
|
|
@@ -8,16 +8,47 @@ import { DidDocumentError } from '@did-btcr2/common';
|
|
|
8
8
|
*/
|
|
9
9
|
export class Appendix {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Resolves a DID URL that may be written as a relative reference against the
|
|
12
|
+
* DID it appears under. DID Core permits the `id` of a verification method or
|
|
13
|
+
* service, and the entries of a verification relationship, to be a relative
|
|
14
|
+
* DID URL such as `#initialKey`; it denotes that fragment of `did`. Absolute
|
|
15
|
+
* DID URLs are returned unchanged, so both spellings of the same reference
|
|
16
|
+
* compare equal without discarding the DID being compared.
|
|
17
|
+
*
|
|
18
|
+
* @param {unknown} input The DID URL to resolve. Non-strings yield `undefined`.
|
|
19
|
+
* @param {string} did The DID the relative reference is resolved against.
|
|
20
|
+
* @returns {string | undefined} The absolute DID URL, or `undefined` if `input` is not a usable string.
|
|
14
21
|
*/
|
|
15
|
-
static
|
|
22
|
+
static absoluteDidUrl(input, did) {
|
|
16
23
|
if (typeof input !== 'string')
|
|
17
24
|
return undefined;
|
|
18
25
|
if (input.length === 0)
|
|
19
26
|
return undefined;
|
|
20
|
-
return input;
|
|
27
|
+
return input.startsWith('#') ? `${did}${input}` : input;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolves a verification relationship entry to the absolute DID URL of the method it
|
|
31
|
+
* names. A relationship entry is either a reference to a method defined elsewhere in the
|
|
32
|
+
* document, or a method embedded inline, which names itself with its own `id`; either
|
|
33
|
+
* spelling may be a relative DID URL.
|
|
34
|
+
*
|
|
35
|
+
* Every comparison of a relationship entry against a method id goes through this helper,
|
|
36
|
+
* on both the read path and the write path, so the two admit exactly the same spellings.
|
|
37
|
+
*
|
|
38
|
+
* Malformed entries yield `undefined` rather than a placeholder string, so two unusable
|
|
39
|
+
* values never compare equal to each other. Callers comparing a resolved entry must still
|
|
40
|
+
* reject an `undefined` target before comparing, or an unusable target matches an
|
|
41
|
+
* unusable entry.
|
|
42
|
+
*
|
|
43
|
+
* @param {unknown} entry The relationship entry: a reference, or an embedded method.
|
|
44
|
+
* @param {string} did The DID the relative reference is resolved against.
|
|
45
|
+
* @returns {string | undefined} The absolute DID URL, or `undefined` if unusable.
|
|
46
|
+
*/
|
|
47
|
+
static relationshipMethodId(entry, did) {
|
|
48
|
+
const id = (typeof entry === 'object' && entry !== null && !Array.isArray(entry))
|
|
49
|
+
? entry.id
|
|
50
|
+
: entry;
|
|
51
|
+
return Appendix.absoluteDidUrl(id, did);
|
|
21
52
|
}
|
|
22
53
|
/**
|
|
23
54
|
* Validates that the given object is a DidVerificationMethod
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appendix.js","sourceRoot":"","sources":["../../../src/utils/appendix.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;;GAKG;AACH,MAA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C/B,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;YAC7B,MAAM,IAAI,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,yBAAyB,YAAY,EAAE,CAAC,CAAC;QACvF,CAAC;QAED,+BAA+B;QAC/B,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;YAC7B,MAAM,IAAI,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,yBAAyB,YAAY,EAAE,CAAC,CAAC;QACvF,CAAC;QAED,wCAAwC;QACxC,MAAM,YAAY,GAAG,GAAG,CAAC;QAEzB,oEAAoE;QACpE,MAAM,UAAU,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;QAEpD,4CAA4C;QAC5C,cAAc,CAAC,EAAE,GAAG,YAAY,CAAC;QAEjC,kDAAkD;QAClD,cAAc,CAAC,UAAU,GAAG,UAAU,CAAC;QAEvC,wDAAwD;QACxD,cAAc,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAE7C,4BAA4B;QAC5B,OAAO,cAAc,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -264,7 +264,16 @@ export declare abstract class SinglePartyBeacon {
|
|
|
264
264
|
* The Beacon service configuration parsed from the DID Document.
|
|
265
265
|
*/
|
|
266
266
|
readonly service: BeaconService;
|
|
267
|
-
|
|
267
|
+
/**
|
|
268
|
+
* The absolute did:btcr2 identifier this beacon instance serves.
|
|
269
|
+
*
|
|
270
|
+
* Injected by the caller rather than recovered from {@link service}. A beacon
|
|
271
|
+
* service `id` is permitted to be a relative DID URL (`#beacon-1`), which
|
|
272
|
+
* carries no DID to strip a fragment from, so deriving the subject from it is
|
|
273
|
+
* only correct for the absolute spelling.
|
|
274
|
+
*/
|
|
275
|
+
readonly did: string;
|
|
276
|
+
constructor(service: BeaconService, did: string);
|
|
268
277
|
/**
|
|
269
278
|
* Processes an array of Beacon Signals to extract BTCR2 Signed Updates.
|
|
270
279
|
* Used during the resolve path.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAqB,MAAM,oBAAoB,CAAC;AACxG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAA4D,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC1G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,iEAAiE;AACjE,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAInF,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conService} service The service of the Beacon.
|
|
57
|
+
* @param {string} did The absolute did:btcr2 identifier this beacon serves.
|
|
57
58
|
*/
|
|
58
|
-
constructor(service: BeaconService);
|
|
59
|
+
constructor(service: BeaconService, did: string);
|
|
59
60
|
/**
|
|
60
61
|
* Implements {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-cas-beacon | 7.2.e.1 Process CAS Beacon}.
|
|
61
62
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cas-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/cas-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAiB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEhG;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C
|
|
1
|
+
{"version":3,"file":"cas-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/cas-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAiB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEhG;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D,UAAU,CAAC,EAAE,YAAY,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C;;;;OAIG;gBACS,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM;IAI/C;;;;;;;;;;;;OAYG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,mBAAmB;IAsDtB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,eAAe,CAAC;CAwB5B"}
|
|
@@ -9,8 +9,10 @@ export declare class BeaconFactory {
|
|
|
9
9
|
/**
|
|
10
10
|
* Establish a Beacon instance based on the provided service and optional sidecar data.
|
|
11
11
|
* @param {BeaconService} service The beacon service configuration.
|
|
12
|
+
* @param {string} did The absolute did:btcr2 identifier the beacon serves. Supplied
|
|
13
|
+
* by the caller because a beacon service `id` may be a relative DID URL.
|
|
12
14
|
* @returns {SinglePartyBeacon} The established Beacon instance.
|
|
13
15
|
*/
|
|
14
|
-
static establish(service: BeaconService): SinglePartyBeacon;
|
|
16
|
+
static establish(service: BeaconService, did: string): SinglePartyBeacon;
|
|
15
17
|
}
|
|
16
18
|
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD;;;;GAIG;AACH,qBAAa,aAAa;IACxB
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/factory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD;;;;GAIG;AACH,qBAAa,aAAa;IACxB;;;;;;OAMG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,iBAAiB;CAYzE"}
|
|
@@ -51,6 +51,20 @@ export declare class BeaconSignalDiscovery {
|
|
|
51
51
|
/**
|
|
52
52
|
* Retrieves the beacon signals for the given array of BeaconService objects
|
|
53
53
|
* using an esplora/electrs REST API connection via a bitcoin I/O driver.
|
|
54
|
+
*
|
|
55
|
+
* The address listing includes mempool transactions. The method skips a
|
|
56
|
+
* transaction whose `status.confirmed` is not `true`. A mempool transaction
|
|
57
|
+
* has no block height and no block time, so it cannot carry block metadata.
|
|
58
|
+
* The specification also says that a resolver must not process an
|
|
59
|
+
* unconfirmed transaction. An absent flag counts as unconfirmed, as it does
|
|
60
|
+
* for UTXO selection. The check runs before the OP_RETURN parse, so a
|
|
61
|
+
* mempool transaction costs no prevout fetch. The {@link fullnode} path
|
|
62
|
+
* needs no such check: it walks mined blocks only.
|
|
63
|
+
*
|
|
64
|
+
* The `confirmations` count uses the block count fetched before the listing.
|
|
65
|
+
* A block that arrives between the two calls yields a count of `0` for its
|
|
66
|
+
* transactions. The resolver then excludes them, because its minimum is at
|
|
67
|
+
* least `1`. An under-count is the safe direction, so keep that order.
|
|
54
68
|
* @param {Array<BeaconService>} beaconServices Array of BeaconService objects to retrieve signals for
|
|
55
69
|
* @param {BitcoinConnection} bitcoin Bitcoin network connection to use for REST calls
|
|
56
70
|
* @returns {Promise<Map<BeaconService, Array<BeaconSignal>>>} Map of beacon service to its discovered signals
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal-discovery.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/signal-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAGA,MAAM,oBAAoB,CAAC;AAM9C,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAWnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAWzF;AAED;;;;;GAKG;AACH,qBAAa,qBAAqB;IAEhC;;;;;;;;;;;;;;;;;;OAkBG;mBACkB,iBAAiB;IA2BtC
|
|
1
|
+
{"version":3,"file":"signal-discovery.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/signal-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAGA,MAAM,oBAAoB,CAAC;AAM9C,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAWnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAWzF;AAED;;;;;GAKG;AACH,qBAAa,qBAAqB;IAEhC;;;;;;;;;;;;;;;;;;OAkBG;mBACkB,iBAAiB;IA2BtC;;;;;;;;;;;;;;;;;;;;OAoBG;WACU,OAAO,CAClB,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,EACpC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IA+EnD;;;;;OAKG;WACU,QAAQ,CACnB,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC,EACpC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;CAgKpD"}
|
|
@@ -17,7 +17,7 @@ export declare class SingletonBeacon extends SinglePartyBeacon {
|
|
|
17
17
|
* Creates an instance of SingletonBeacon.
|
|
18
18
|
* @param {BeaconService} service The BeaconService object representing the funded beacon to announce the update to.
|
|
19
19
|
*/
|
|
20
|
-
constructor(service: BeaconService);
|
|
20
|
+
constructor(service: BeaconService, did: string);
|
|
21
21
|
/**
|
|
22
22
|
* Processes an array of Beacon Signals associated with a Singleton Beacon Service.
|
|
23
23
|
* @param {Array<BeaconSignal>} signals The beacon signals discovered on-chain.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"singleton-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/singleton-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,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AC,eAAe,CAAC;CAK5B"}
|
|
@@ -22,8 +22,9 @@ export declare class SMTBeacon extends SinglePartyBeacon {
|
|
|
22
22
|
/**
|
|
23
23
|
* Creates an instance of SMTBeacon.
|
|
24
24
|
* @param {BeaconService} service The Beacon service.
|
|
25
|
+
* @param {string} did The absolute did:btcr2 identifier this beacon serves.
|
|
25
26
|
*/
|
|
26
|
-
constructor(service: BeaconService);
|
|
27
|
+
constructor(service: BeaconService, did: string);
|
|
27
28
|
/**
|
|
28
29
|
* Implements {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#process-smt-beacon | 7.2.e.1 Process SMT Beacon}.
|
|
29
30
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smt-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/smt-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAiB,MAAM,iBAAiB,CAAC;AAElF;;;;;;;;;;;GAWG;AACH,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C
|
|
1
|
+
{"version":3,"file":"smt-beacon.d.ts","sourceRoot":"","sources":["../../../../src/core/beacon/smt-beacon.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,KAAK,EAAE,mBAAmB,EAAY,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAiB,MAAM,iBAAiB,CAAC;AAElF;;;;;;;;;;;GAWG;AACH,qBAAa,SAAU,SAAQ,iBAAiB;IAC9C;;;;OAIG;gBACS,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM;IAI/C;;;;;;;;;;;;OAYG;IACH,cAAc,CACZ,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAC5B,OAAO,EAAE,WAAW,GACnB,mBAAmB;IAyEtB;;;;;;;;;;;;;;;;OAgBG;IACG,eAAe,CACnB,YAAY,EAAE,iBAAiB,EAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC;CAqB5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did-sender-resolver.d.ts","sourceRoot":"","sources":["../../../src/core/did-sender-resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"did-sender-resolver.d.ts","sourceRoot":"","sources":["../../../src/core/did-sender-resolver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,EAAE,WAAW,EAAyB,MAAM,0BAA0B,CAAC;AAInF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,WAAW,GACpB,4BAA4B,CAiC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE;IAAE,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,GAClC,4BAA4B,GAAG,SAAS,CAkB1C"}
|
|
@@ -41,6 +41,19 @@ export interface ResolutionOptions extends DidResolutionOptions {
|
|
|
41
41
|
* document is well-formed, the resolver simply stopped at the caller's limit.
|
|
42
42
|
*/
|
|
43
43
|
maxDiscoveryRounds?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Minimum number of Bitcoin block confirmations a Beacon Signal transaction
|
|
46
|
+
* must have before resolution processes it. A positive integer, minimum `1`.
|
|
47
|
+
* Defaults to `6` ({@link DEFAULT_MIN_CONF}), the value the specification
|
|
48
|
+
* mandates. A signal below the threshold is excluded from the resolution
|
|
49
|
+
* as if it did not exist yet; the rest of the signals are processed. A lower
|
|
50
|
+
* value shows a fresh update sooner and raises the exposure to a block
|
|
51
|
+
* reorganization. The `confirmations` field of the resolution metadata
|
|
52
|
+
* reports the depth of the last applied signal, so a consumer can judge it.
|
|
53
|
+
* Any other value (`0`, a negative number, a fraction, `NaN`, a string)
|
|
54
|
+
* fails with a `ResolveError` of type `INVALID_OPTIONS`.
|
|
55
|
+
*/
|
|
56
|
+
minConf?: number;
|
|
44
57
|
}
|
|
45
58
|
/**
|
|
46
59
|
* {@link https://dcdpr.github.io/did-btcr2/terminology.html#smt-proof | SMT Proof}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/core/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAA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AEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB"}
|
|
@@ -5,6 +5,14 @@ import type { BeaconService, BeaconSignal, BlockMetadata } from './beacon/interf
|
|
|
5
5
|
import type { DidComponents } from './identifier.js';
|
|
6
6
|
import type { SMTProof } from './interfaces.js';
|
|
7
7
|
import type { CASAnnouncement, Sidecar, SidecarData } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Default minimum number of Bitcoin block confirmations a Beacon Signal
|
|
10
|
+
* transaction must have before resolution processes it. The specification
|
|
11
|
+
* mandates `6` when `ResolutionOptions.minConf` is not set: six confirmations
|
|
12
|
+
* is the accepted standard for a settled Bitcoin transaction. A resolution
|
|
13
|
+
* request can raise or lower it through `minConf`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_MIN_CONF = 6;
|
|
8
16
|
/**
|
|
9
17
|
* The response object for DID Resolution.
|
|
10
18
|
*/
|
|
@@ -107,6 +115,7 @@ export declare class Resolver {
|
|
|
107
115
|
versionTime?: string;
|
|
108
116
|
genesisDocument?: object;
|
|
109
117
|
maxDiscoveryRounds?: number;
|
|
118
|
+
minConf?: number;
|
|
110
119
|
});
|
|
111
120
|
/**
|
|
112
121
|
* Implements subsection {@link https://dcdpr.github.io/did-btcr2/operations/resolve.html#if-genesis_bytes-is-a-secp256k1-public-key | 7.2.d.1 if genesis bytes is a secp256k1 Public Key}.
|
|
@@ -138,6 +147,10 @@ export declare class Resolver {
|
|
|
138
147
|
* Version counter and update-hash history carried from earlier discovery rounds.
|
|
139
148
|
* Standalone callers omit it and start fresh at version 1 with an empty history.
|
|
140
149
|
* @returns {DidResolutionResponse} The updated DID Document, number of confirmations, and version id.
|
|
150
|
+
*
|
|
151
|
+
* Confirmation depth is not checked here. The BeaconProcess phase excludes a
|
|
152
|
+
* signal below `ResolutionOptions.minConf` before its update reaches this method,
|
|
153
|
+
* so every tuple here comes from a block at or above the threshold.
|
|
141
154
|
*/
|
|
142
155
|
static updates(currentDocument: DidDocument, unsortedUpdates: Array<[SignedBTCR2Update, BlockMetadata]>, versionTime?: string, versionId?: string, resolutionState?: {
|
|
143
156
|
currentVersionId: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/core/resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/core/resolver.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EACV,iBAAiB,EAElB,MAAM,mBAAmB,CAAC;AAS3B,OAAO,EAAE,WAAW,EAAwB,MAAM,0BAA0B,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEzF,OAAO,KAAK,EAAE,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAGxE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE;QACR,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,CAAA;CACF;AAED,4EAA4E;AAC5E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,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MG;IACH,OAAO,IAAI,aAAa;IAyMxB;;;;;;;;OAQG;IACH,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IACtD,OAAO,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC,GAAG,IAAI;IACrF,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,eAAe,GAAG,IAAI;IAC/D,OAAO,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAC9D,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI;CAuFlD"}
|
|
@@ -49,8 +49,8 @@ export interface FundingProof {
|
|
|
49
49
|
* The updater needs the caller to broadcast the signed update via the beacon.
|
|
50
50
|
*
|
|
51
51
|
* The caller decides how: for single-party beacons, call
|
|
52
|
-
* `Updater.announce(beaconService, signedUpdate, signer, bitcoin, options?)` or
|
|
53
|
-
* `BeaconFactory.establish(beaconService).broadcastSignal(...)`. For multi-party
|
|
52
|
+
* `Updater.announce(beaconService, did, signedUpdate, signer, bitcoin, options?)` or
|
|
53
|
+
* `BeaconFactory.establish(beaconService, did).broadcastSignal(...)`. For multi-party
|
|
54
54
|
* aggregate beacons, hand off to the aggregation protocol.
|
|
55
55
|
*
|
|
56
56
|
* Both single-party paths return a `BroadcastResult`; capture it. Beyond the txid,
|
|
@@ -67,6 +67,11 @@ export interface NeedBroadcast {
|
|
|
67
67
|
readonly beaconService: BeaconService;
|
|
68
68
|
/** The signed update ready for broadcast. */
|
|
69
69
|
readonly signedUpdate: SignedBTCR2Update;
|
|
70
|
+
/**
|
|
71
|
+
* The DID being updated. Supplied because a beacon service `id` may be a
|
|
72
|
+
* relative DID URL and so cannot be used to recover the subject.
|
|
73
|
+
*/
|
|
74
|
+
readonly did: string;
|
|
70
75
|
}
|
|
71
76
|
/** Discriminated union of all data needs the updater may request from the caller. */
|
|
72
77
|
export type UpdaterDataNeed = NeedSigningKey | NeedFunding | NeedBroadcast;
|
|
@@ -124,7 +129,7 @@ export interface UpdaterParams {
|
|
|
124
129
|
* // Capture the BroadcastResult: broadcast.txid, plus broadcast.announcement
|
|
125
130
|
* // (CAS beacons) and broadcast.proof (SMT beacons; must be retained, the
|
|
126
131
|
* // proof's nonce exists nowhere else).
|
|
127
|
-
* const broadcast = await Updater.announce(need.beaconService, need.signedUpdate, signer, bitcoin);
|
|
132
|
+
* const broadcast = await Updater.announce(need.beaconService, need.did, need.signedUpdate, signer, bitcoin);
|
|
128
133
|
* updater.provide(need);
|
|
129
134
|
* break;
|
|
130
135
|
* }
|
|
@@ -178,6 +183,8 @@ export declare class Updater {
|
|
|
178
183
|
* Announces a signed update to the Bitcoin blockchain via the specified beacon.
|
|
179
184
|
*
|
|
180
185
|
* @param {BeaconService} beaconService The beacon service to broadcast through.
|
|
186
|
+
* @param {string} did The DID being updated. Required because a beacon service
|
|
187
|
+
* `id` may be a relative DID URL and so cannot supply the subject.
|
|
181
188
|
* @param {SignedBTCR2Update} update The signed update to announce.
|
|
182
189
|
* @param {Signer} signer Signer that produces the ECDSA signature for the Bitcoin transaction.
|
|
183
190
|
* @param {BitcoinConnection} bitcoin The Bitcoin network connection.
|
|
@@ -187,7 +194,7 @@ export declare class Updater {
|
|
|
187
194
|
* @returns {Promise<BroadcastResult>} The broadcast artifacts: the signed update, the signal
|
|
188
195
|
* txid, and any per-beacon-type sidecar data (CAS announcement / SMT proof).
|
|
189
196
|
*/
|
|
190
|
-
static announce(beaconService: BeaconService, update: SignedBTCR2Update, signer: Signer, bitcoin: BitcoinConnection, options?: CASBroadcastOptions): Promise<BroadcastResult>;
|
|
197
|
+
static announce(beaconService: BeaconService, did: string, update: SignedBTCR2Update, signer: Signer, bitcoin: BitcoinConnection, options?: CASBroadcastOptions): Promise<BroadcastResult>;
|
|
191
198
|
/**
|
|
192
199
|
* Advance the state machine. Returns either:
|
|
193
200
|
* - `{ status: 'action-required', needs }` caller must provide data via {@link provide}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../../../src/core/updater.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGxD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAA4B,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC1G,OAAO,EAAe,KAAK,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC1G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAI5D;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,8DAA8D;IAC9D,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,+CAA+C;IAC/C,QAAQ,CAAC,cAAc,EAAE,mBAAmB,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,kDAAkD;IAClD,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;CACvC;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,yFAAyF;IACzF,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,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,UAAU,EAAE,MAAM,CAAW;IAEpC;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,QAAQ,GAAG,aAAa,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,MAAM;IAezF;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,OAAO,CACZ,GAAG,EAAE,MAAM,EACX,iBAAiB,GAAE,iBAAsB,GACxC,QAAQ;IAwBX;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CAAC,MAAM,CAAC,EACZ,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,QAAQ,GACT,EAAE;QACD,cAAc,EAAE,gBAAgB,CAAC;QACjC,OAAO,EAAE,cAAc,EAAE,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;QACxB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,OAAO;IAwEX;;;;;;;;;OASG;IACH,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,gBAAgB,EAAG,QAAQ,CAAC,EAAE,MAAM,GAAG,qBAAqB;CAiClG"}
|
|
@@ -8,11 +8,37 @@ import type { RootCapability } from '../core/interfaces.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class Appendix {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Resolves a DID URL that may be written as a relative reference against the
|
|
12
|
+
* DID it appears under. DID Core permits the `id` of a verification method or
|
|
13
|
+
* service, and the entries of a verification relationship, to be a relative
|
|
14
|
+
* DID URL such as `#initialKey`; it denotes that fragment of `did`. Absolute
|
|
15
|
+
* DID URLs are returned unchanged, so both spellings of the same reference
|
|
16
|
+
* compare equal without discarding the DID being compared.
|
|
17
|
+
*
|
|
18
|
+
* @param {unknown} input The DID URL to resolve. Non-strings yield `undefined`.
|
|
19
|
+
* @param {string} did The DID the relative reference is resolved against.
|
|
20
|
+
* @returns {string | undefined} The absolute DID URL, or `undefined` if `input` is not a usable string.
|
|
21
|
+
*/
|
|
22
|
+
static absoluteDidUrl(input: unknown, did: string): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves a verification relationship entry to the absolute DID URL of the method it
|
|
25
|
+
* names. A relationship entry is either a reference to a method defined elsewhere in the
|
|
26
|
+
* document, or a method embedded inline, which names itself with its own `id`; either
|
|
27
|
+
* spelling may be a relative DID URL.
|
|
28
|
+
*
|
|
29
|
+
* Every comparison of a relationship entry against a method id goes through this helper,
|
|
30
|
+
* on both the read path and the write path, so the two admit exactly the same spellings.
|
|
31
|
+
*
|
|
32
|
+
* Malformed entries yield `undefined` rather than a placeholder string, so two unusable
|
|
33
|
+
* values never compare equal to each other. Callers comparing a resolved entry must still
|
|
34
|
+
* reject an `undefined` target before comparing, or an unusable target matches an
|
|
35
|
+
* unusable entry.
|
|
36
|
+
*
|
|
37
|
+
* @param {unknown} entry The relationship entry: a reference, or an embedded method.
|
|
38
|
+
* @param {string} did The DID the relative reference is resolved against.
|
|
39
|
+
* @returns {string | undefined} The absolute DID URL, or `undefined` if unusable.
|
|
14
40
|
*/
|
|
15
|
-
static
|
|
41
|
+
static relationshipMethodId(entry: unknown, did: string): string | undefined;
|
|
16
42
|
/**
|
|
17
43
|
* Validates that the given object is a DidVerificationMethod
|
|
18
44
|
* @param {unknown} obj The object to validate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appendix.d.ts","sourceRoot":"","sources":["../../../src/utils/appendix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,qBAAqB,EAAC,MAAM,YAAY,CAAC;AAO3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB
|
|
1
|
+
{"version":3,"file":"appendix.d.ts","sourceRoot":"","sources":["../../../src/utils/appendix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,qBAAqB,EAAC,MAAM,YAAY,CAAC;AAO3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;GAKG;AACH,qBAAa,QAAQ;IACnB;;;;;;;;;;;OAWG;WACW,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAM7E;;;;;;;;;;;;;;;;;OAiBG;WACW,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAOnF;;;;OAIG;WACW,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,qBAAqB;IAcjF;;;;OAIG;WACW,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,UAAU;IAW3D;;;;;OAKG;WACW,sBAAsB,CAAC,WAAW,EAAE,WAAW,GAAG,qBAAqB,EAAE;IAgBvF;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc;IAU/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;WACW,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,cAAc;CA8CtE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@did-btcr2/method",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Reference implementation for the did:btcr2 DID method written in TypeScript and JavaScript. did:btcr2 is a censorship resistant DID Method using the Bitcoin blockchain as a Verifiable Data Registry to announce changes to the DID document. This is the core method implementation for the did-btcr2-js monorepo.",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
"@scure/base": "^1.2.6",
|
|
70
70
|
"@scure/btc-signer": "^1.8.1",
|
|
71
71
|
"@web5/dids": "^1.2.0",
|
|
72
|
-
"@did-btcr2/
|
|
73
|
-
"@did-btcr2/bitcoin": "^0.10.0",
|
|
74
|
-
"@did-btcr2/smt": "^0.3.0",
|
|
72
|
+
"@did-btcr2/bitcoin": "^0.11.0",
|
|
75
73
|
"@did-btcr2/cryptosuite": "^10.0.0",
|
|
76
|
-
"@did-btcr2/
|
|
74
|
+
"@did-btcr2/common": "^9.4.0",
|
|
75
|
+
"@did-btcr2/keypair": "^0.13.1",
|
|
76
|
+
"@did-btcr2/smt": "^0.3.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@eslint/js": "^9.39.4",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AddressUtxo, BitcoinConnection, BTCNetwork } from '@did-btcr2/bitcoin';
|
|
1
|
+
import type { AddressUtxo, BitcoinConnection, BTCNetwork, TransactionStatus } from '@did-btcr2/bitcoin';
|
|
2
2
|
import type { KeyBytes } from '@did-btcr2/common';
|
|
3
3
|
import type { SignedBTCR2Update } from '../btcr2-update.js';
|
|
4
4
|
import type { Signer } from '@did-btcr2/keypair';
|
|
@@ -280,13 +280,24 @@ export function opReturnScript(signalBytes: Uint8Array): Uint8Array {
|
|
|
280
280
|
*/
|
|
281
281
|
export const SPENDABLE_DUST_LIMIT_SATS = 546;
|
|
282
282
|
|
|
283
|
+
/** A UTXO whose status carries the block fields: the confirmed arm of {@link TransactionStatus}. */
|
|
284
|
+
type ConfirmedUtxo = AddressUtxo & { status: Extract<TransactionStatus, { confirmed: true }> };
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* True if the UTXO is confirmed. Narrows the status to the confirmed arm, so the
|
|
288
|
+
* block height reads as a number. An absent flag counts as unconfirmed.
|
|
289
|
+
*/
|
|
290
|
+
function isConfirmedUtxo(utxo: AddressUtxo): utxo is ConfirmedUtxo {
|
|
291
|
+
return utxo.status.confirmed === true;
|
|
292
|
+
}
|
|
293
|
+
|
|
283
294
|
/**
|
|
284
295
|
* Deterministic ordering for spendable UTXO selection: deepest first (ascending
|
|
285
296
|
* block height, so the most-confirmed UTXO sorts first), tie-broken by `txid` then
|
|
286
297
|
* `vout`. The tie-break makes the winner independent of the order the REST API
|
|
287
298
|
* returns UTXOs in, so retries and independent resolvers converge on the same input.
|
|
288
299
|
*/
|
|
289
|
-
function byDepthThenId(a:
|
|
300
|
+
function byDepthThenId(a: ConfirmedUtxo, b: ConfirmedUtxo): number {
|
|
290
301
|
if(a.status.block_height !== b.status.block_height) {
|
|
291
302
|
return a.status.block_height - b.status.block_height;
|
|
292
303
|
}
|
|
@@ -321,7 +332,7 @@ export function selectSpendableUtxo(utxos: Array<AddressUtxo>, address?: string)
|
|
|
321
332
|
'UNFUNDED_BEACON_ADDRESS', { address }
|
|
322
333
|
);
|
|
323
334
|
}
|
|
324
|
-
const confirmed = utxos.filter(
|
|
335
|
+
const confirmed = utxos.filter(isConfirmedUtxo);
|
|
325
336
|
const spendable = confirmed.filter(utxo => utxo.value > SPENDABLE_DUST_LIMIT_SATS);
|
|
326
337
|
if(!spendable.length) {
|
|
327
338
|
const reason = confirmed.length === 0
|
|
@@ -544,8 +555,19 @@ export abstract class SinglePartyBeacon {
|
|
|
544
555
|
*/
|
|
545
556
|
readonly service: BeaconService;
|
|
546
557
|
|
|
547
|
-
|
|
558
|
+
/**
|
|
559
|
+
* The absolute did:btcr2 identifier this beacon instance serves.
|
|
560
|
+
*
|
|
561
|
+
* Injected by the caller rather than recovered from {@link service}. A beacon
|
|
562
|
+
* service `id` is permitted to be a relative DID URL (`#beacon-1`), which
|
|
563
|
+
* carries no DID to strip a fragment from, so deriving the subject from it is
|
|
564
|
+
* only correct for the absolute spelling.
|
|
565
|
+
*/
|
|
566
|
+
readonly did: string;
|
|
567
|
+
|
|
568
|
+
constructor(service: BeaconService, did: string) {
|
|
548
569
|
this.service = service;
|
|
570
|
+
this.did = did;
|
|
549
571
|
}
|
|
550
572
|
|
|
551
573
|
/**
|