@did-btcr2/method 0.59.0 → 0.61.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 +2 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser.js +3 -3
- package/dist/browser.mjs +3 -3
- package/dist/cjs/index.js +956 -783
- package/dist/esm/core/btcr2-update.js +28 -1
- package/dist/esm/core/btcr2-update.js.map +1 -1
- package/dist/esm/core/identifier.js +175 -23
- package/dist/esm/core/identifier.js.map +1 -1
- package/dist/esm/core/resolver.js +14 -1
- package/dist/esm/core/resolver.js.map +1 -1
- package/dist/esm/core/updater.js +8 -12
- package/dist/esm/core/updater.js.map +1 -1
- package/dist/esm/utils/appendix.js +2 -1
- package/dist/esm/utils/appendix.js.map +1 -1
- package/dist/types/core/btcr2-update.d.ts +22 -3
- package/dist/types/core/btcr2-update.d.ts.map +1 -1
- package/dist/types/core/identifier.d.ts +67 -0
- package/dist/types/core/identifier.d.ts.map +1 -1
- package/dist/types/core/resolver.d.ts +2 -1
- package/dist/types/core/resolver.d.ts.map +1 -1
- package/dist/types/core/updater.d.ts.map +1 -1
- package/dist/types/utils/appendix.d.ts +2 -1
- package/dist/types/utils/appendix.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/core/btcr2-update.ts +36 -3
- package/src/core/identifier.ts +267 -22
- package/src/core/resolver.ts +21 -1
- package/src/core/updater.ts +8 -12
- package/src/utils/appendix.ts +2 -1
package/src/core/updater.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { canonicalHash, INVALID_DID_UPDATE, JSONPatch, UpdateError } from '@did-
|
|
|
4
4
|
import { SchnorrMultikey } from '@did-btcr2/cryptosuite';
|
|
5
5
|
import type { Signer } from '@did-btcr2/keypair';
|
|
6
6
|
import type { Btcr2DataIntegrityConfig, SignedBTCR2Update, UnsignedBTCR2Update } from './btcr2-update.js';
|
|
7
|
+
import { BTCR2_UPDATE_CONTEXT } from './btcr2-update.js';
|
|
7
8
|
import { DidDocument, type Btcr2DidDocument, type DidVerificationMethod } from '../utils/did-document.js';
|
|
8
9
|
import type { BroadcastResult } from './beacon/beacon.js';
|
|
9
10
|
import type { CASBroadcastOptions } from './beacon/cas-beacon.js';
|
|
@@ -214,12 +215,9 @@ export class Updater {
|
|
|
214
215
|
sourceVersionId: number,
|
|
215
216
|
): UnsignedBTCR2Update {
|
|
216
217
|
const unsignedUpdate: UnsignedBTCR2Update = {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
'https://w3id.org/json-ld-patch/v1',
|
|
221
|
-
'https://btcr2.dev/context/v1'
|
|
222
|
-
],
|
|
218
|
+
// The array the specification pins, as a fresh copy: the update is a plain JSON
|
|
219
|
+
// object that callers may edit, and the shared constant is frozen.
|
|
220
|
+
'@context' : [ ...BTCR2_UPDATE_CONTEXT ],
|
|
223
221
|
patch : patches,
|
|
224
222
|
targetHash : '',
|
|
225
223
|
targetVersionId : sourceVersionId + 1,
|
|
@@ -311,12 +309,10 @@ export class Updater {
|
|
|
311
309
|
}
|
|
312
310
|
|
|
313
311
|
const config: Btcr2DataIntegrityConfig = {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
'https://btcr2.dev/context/v1'
|
|
319
|
-
],
|
|
312
|
+
// The proof must carry the same array as the update. The cryptosuite copies the
|
|
313
|
+
// document @context into the proof when the document has one, so the two arrays
|
|
314
|
+
// are equal by construction; this value is the fallback for a document without one.
|
|
315
|
+
'@context' : [ ...BTCR2_UPDATE_CONTEXT ],
|
|
320
316
|
cryptosuite : 'bip340-jcs-2025',
|
|
321
317
|
type : 'DataIntegrityProof',
|
|
322
318
|
// The proof names the signing method by absolute DID URL, even when the document
|
package/src/utils/appendix.ts
CHANGED
|
@@ -161,9 +161,10 @@ export class Appendix {
|
|
|
161
161
|
* ```
|
|
162
162
|
* {
|
|
163
163
|
* "@context": [
|
|
164
|
+
* "https://w3id.org/json-ld-patch/v1",
|
|
164
165
|
* "https://w3id.org/zcap/v1",
|
|
165
166
|
* "https://w3id.org/security/data-integrity/v2",
|
|
166
|
-
* "https://
|
|
167
|
+
* "https://btcr2.dev/context/v1"
|
|
167
168
|
* ],
|
|
168
169
|
* "patch": [
|
|
169
170
|
* {
|