@twin.org/standards-w3c-did 0.0.2-next.14 → 0.0.2-next.16

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.
@@ -156,7 +156,7 @@ class DataIntegrityProofSignerVerifier {
156
156
  /**
157
157
  * Runtime name for the class.
158
158
  */
159
- CLASS_NAME = "DataIntegrityProofSignerVerifier";
159
+ static CLASS_NAME = "DataIntegrityProofSignerVerifier";
160
160
  /**
161
161
  * Create a proof for the given data.
162
162
  * @param unsecuredDocument The data to create the proof for.
@@ -165,12 +165,12 @@ class DataIntegrityProofSignerVerifier {
165
165
  * @returns The created proof.
166
166
  */
167
167
  async createProof(unsecuredDocument, unsignedProof, signKey) {
168
- core.Guards.object(this.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
169
- core.Guards.object(this.CLASS_NAME, "unsignedProof", unsignedProof);
170
- core.Guards.object(this.CLASS_NAME, "signKey", signKey);
168
+ core.Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
169
+ core.Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "unsignedProof", unsignedProof);
170
+ core.Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "signKey", signKey);
171
171
  const rawKeys = await web.Jwk.toRaw(signKey);
172
172
  if (!core.Is.uint8Array(rawKeys.privateKey)) {
173
- throw new core.GeneralError(this.CLASS_NAME, "missingPrivateKey");
173
+ throw new core.GeneralError(DataIntegrityProofSignerVerifier.CLASS_NAME, "missingPrivateKey");
174
174
  }
175
175
  const unsecuredDocumentClone = core.ObjectHelper.clone(unsecuredDocument);
176
176
  const signedProof = core.ObjectHelper.clone(unsignedProof);
@@ -189,13 +189,13 @@ class DataIntegrityProofSignerVerifier {
189
189
  * @returns True if the credential was verified.
190
190
  */
191
191
  async verifyProof(securedDocument, signedProof, verifyKey) {
192
- core.Guards.object(this.CLASS_NAME, "securedDocument", securedDocument);
193
- core.Guards.object(this.CLASS_NAME, "signedProof", signedProof);
194
- core.Guards.stringValue(this.CLASS_NAME, "signedProof.proofValue", signedProof.proofValue);
195
- core.Guards.object(this.CLASS_NAME, "verifyKey", verifyKey);
192
+ core.Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "securedDocument", securedDocument);
193
+ core.Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "signedProof", signedProof);
194
+ core.Guards.stringValue(DataIntegrityProofSignerVerifier.CLASS_NAME, "signedProof.proofValue", signedProof.proofValue);
195
+ core.Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "verifyKey", verifyKey);
196
196
  const rawKeys = await web.Jwk.toRaw(verifyKey);
197
197
  if (!core.Is.uint8Array(rawKeys.publicKey)) {
198
- throw new core.GeneralError(this.CLASS_NAME, "missingPublicKey");
198
+ throw new core.GeneralError(DataIntegrityProofSignerVerifier.CLASS_NAME, "missingPublicKey");
199
199
  }
200
200
  const combinedHash = await this.createHash(securedDocument, signedProof);
201
201
  return crypto.Ed25519.verify(rawKeys.publicKey, combinedHash, core.Converter.base58ToBytes(signedProof.proofValue.slice(1)));
@@ -207,16 +207,16 @@ class DataIntegrityProofSignerVerifier {
207
207
  * @returns The created hash.
208
208
  */
209
209
  async createHash(unsecuredDocument, unsignedProof) {
210
- core.Guards.object(this.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
211
- core.Guards.object(this.CLASS_NAME, "unsignedProof", unsignedProof);
212
- core.Guards.stringValue(this.CLASS_NAME, "unsignedProof.cryptosuite", unsignedProof.cryptosuite);
213
- core.Guards.stringValue(this.CLASS_NAME, "unsignedProof.verificationMethod", unsignedProof.verificationMethod);
210
+ core.Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
211
+ core.Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "unsignedProof", unsignedProof);
212
+ core.Guards.stringValue(DataIntegrityProofSignerVerifier.CLASS_NAME, "unsignedProof.cryptosuite", unsignedProof.cryptosuite);
213
+ core.Guards.stringValue(DataIntegrityProofSignerVerifier.CLASS_NAME, "unsignedProof.verificationMethod", unsignedProof.verificationMethod);
214
214
  const unsecuredDocumentClone = core.ObjectHelper.clone(unsecuredDocument);
215
215
  const proofOptionsClone = core.ObjectHelper.clone(unsignedProof);
216
216
  delete unsecuredDocumentClone.proof;
217
217
  delete proofOptionsClone.proofValue;
218
218
  if (proofOptionsClone.cryptosuite !== DidCryptoSuites.EdDSAJcs2022) {
219
- throw new core.GeneralError(this.CLASS_NAME, "cryptosuiteNotSupported", {
219
+ throw new core.GeneralError(DataIntegrityProofSignerVerifier.CLASS_NAME, "cryptosuiteNotSupported", {
220
220
  cryptoSuite: proofOptionsClone.cryptosuite
221
221
  });
222
222
  }
@@ -239,7 +239,7 @@ class JsonWebSignature2020SignerVerifier {
239
239
  /**
240
240
  * Runtime name for the class.
241
241
  */
242
- CLASS_NAME = "JsonWebSignature2020SignerVerifier";
242
+ static CLASS_NAME = "JsonWebSignature2020SignerVerifier";
243
243
  /**
244
244
  * Create a proof for the given data.
245
245
  * @param unsecuredDocument The data to create the proof for.
@@ -248,9 +248,9 @@ class JsonWebSignature2020SignerVerifier {
248
248
  * @returns The created proof.
249
249
  */
250
250
  async createProof(unsecuredDocument, unsignedProof, signKey) {
251
- core.Guards.object(this.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
252
- core.Guards.object(this.CLASS_NAME, "unsignedProof", unsignedProof);
253
- core.Guards.object(this.CLASS_NAME, "signKey", signKey);
251
+ core.Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
252
+ core.Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "unsignedProof", unsignedProof);
253
+ core.Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "signKey", signKey);
254
254
  const unsecuredDocumentClone = core.ObjectHelper.clone(unsecuredDocument);
255
255
  unsecuredDocumentClone["@context"] = dataJsonLd.JsonLdProcessor.combineContexts(unsecuredDocumentClone["@context"], DidContexts.ContextSecurityJws2020);
256
256
  const hash = await this.createHash(unsecuredDocument, unsignedProof);
@@ -269,12 +269,12 @@ class JsonWebSignature2020SignerVerifier {
269
269
  * @returns True if the credential was verified.
270
270
  */
271
271
  async verifyProof(securedDocument, signedProof, verifyKey) {
272
- core.Guards.object(this.CLASS_NAME, "securedDocument", securedDocument);
273
- core.Guards.object(this.CLASS_NAME, "signedProof", signedProof);
274
- core.Guards.object(this.CLASS_NAME, "verifyKey", verifyKey);
272
+ core.Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "securedDocument", securedDocument);
273
+ core.Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "signedProof", signedProof);
274
+ core.Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "verifyKey", verifyKey);
275
275
  const jws = signedProof.jws;
276
276
  if (!core.Is.stringValue(jws)) {
277
- throw new core.GeneralError(this.CLASS_NAME, "jwsMissing");
277
+ throw new core.GeneralError(JsonWebSignature2020SignerVerifier.CLASS_NAME, "missingJws");
278
278
  }
279
279
  const hash = await this.createHash(securedDocument, signedProof);
280
280
  const cryptoKey = await web.Jwk.toCryptoKey(verifyKey);
@@ -287,9 +287,9 @@ class JsonWebSignature2020SignerVerifier {
287
287
  * @returns The created hash.
288
288
  */
289
289
  async createHash(unsecuredDocument, unsignedProof) {
290
- core.Guards.object(this.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
291
- core.Guards.object(this.CLASS_NAME, "unsignedProof", unsignedProof);
292
- core.Guards.stringValue(this.CLASS_NAME, "unsignedProof.verificationMethod", unsignedProof.verificationMethod);
290
+ core.Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
291
+ core.Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "unsignedProof", unsignedProof);
292
+ core.Guards.stringValue(JsonWebSignature2020SignerVerifier.CLASS_NAME, "unsignedProof.verificationMethod", unsignedProof.verificationMethod);
293
293
  const unsecuredDocumentClone = core.ObjectHelper.clone(unsecuredDocument);
294
294
  const proofOptionsClone = core.ObjectHelper.clone(unsignedProof);
295
295
  unsecuredDocumentClone["@context"] = dataJsonLd.JsonLdProcessor.combineContexts(unsecuredDocumentClone["@context"], DidContexts.ContextSecurityJws2020);
@@ -403,8 +403,8 @@ class MultikeyHelper {
403
403
  }
404
404
  secretKeyRaw = core.Converter.base58ToBytes(multikey.secretKeyMultibase.slice(1));
405
405
  if (secretKeyRaw[0] !== 0x80 || secretKeyRaw[1] !== 0x26) {
406
- throw new core.GeneralError(MultikeyHelper.CLASS_NAME, "publicKeyMultibaseMissingHeader", {
407
- publicKeyMultibase: multikey.publicKeyMultibase
406
+ throw new core.GeneralError(MultikeyHelper.CLASS_NAME, "secretKeyMultibaseMissingHeader", {
407
+ secretKeyMultibase: multikey.secretKeyMultibase
408
408
  });
409
409
  }
410
410
  }
@@ -432,7 +432,7 @@ class ProofHelper {
432
432
  * @throws GeneralError if the proof type is not supported.
433
433
  */
434
434
  static createSignerVerifier(proofType) {
435
- core.Guards.arrayOneOf(this.CLASS_NAME, "proofType", proofType, Object.values(ProofTypes));
435
+ core.Guards.arrayOneOf(ProofHelper.CLASS_NAME, "proofType", proofType, Object.values(ProofTypes));
436
436
  let signerVerifier;
437
437
  if (proofType === ProofTypes.DataIntegrityProof) {
438
438
  signerVerifier = new DataIntegrityProofSignerVerifier();
@@ -454,10 +454,10 @@ class ProofHelper {
454
454
  * @returns The created proof.
455
455
  */
456
456
  static async createProof(proofType, unsecuredDocument, unsignedProof, signKey) {
457
- core.Guards.arrayOneOf(this.CLASS_NAME, "proofType", proofType, Object.values(ProofTypes));
458
- core.Guards.object(this.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
459
- core.Guards.object(this.CLASS_NAME, "unsignedProof", unsignedProof);
460
- core.Guards.object(this.CLASS_NAME, "signKey", signKey);
457
+ core.Guards.arrayOneOf(ProofHelper.CLASS_NAME, "proofType", proofType, Object.values(ProofTypes));
458
+ core.Guards.object(ProofHelper.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
459
+ core.Guards.object(ProofHelper.CLASS_NAME, "unsignedProof", unsignedProof);
460
+ core.Guards.object(ProofHelper.CLASS_NAME, "signKey", signKey);
461
461
  return ProofHelper.createSignerVerifier(proofType).createProof(unsecuredDocument, unsignedProof, signKey);
462
462
  }
463
463
  /**
@@ -468,10 +468,10 @@ class ProofHelper {
468
468
  * @returns True if the credential was verified.
469
469
  */
470
470
  static async verifyProof(securedDocument, signedProof, verifyKey) {
471
- core.Guards.object(this.CLASS_NAME, "securedDocument", securedDocument);
472
- core.Guards.object(this.CLASS_NAME, "signedProof", signedProof);
473
- core.Guards.stringValue(this.CLASS_NAME, "signedProof.type", signedProof.type);
474
- core.Guards.object(this.CLASS_NAME, "verifyKey", verifyKey);
471
+ core.Guards.object(ProofHelper.CLASS_NAME, "securedDocument", securedDocument);
472
+ core.Guards.object(ProofHelper.CLASS_NAME, "signedProof", signedProof);
473
+ core.Guards.stringValue(ProofHelper.CLASS_NAME, "signedProof.type", signedProof.type);
474
+ core.Guards.object(ProofHelper.CLASS_NAME, "verifyKey", verifyKey);
475
475
  const signerVerifier = ProofHelper.createSignerVerifier(signedProof.type);
476
476
  return signerVerifier.verifyProof(securedDocument, signedProof, verifyKey);
477
477
  }
@@ -154,7 +154,7 @@ class DataIntegrityProofSignerVerifier {
154
154
  /**
155
155
  * Runtime name for the class.
156
156
  */
157
- CLASS_NAME = "DataIntegrityProofSignerVerifier";
157
+ static CLASS_NAME = "DataIntegrityProofSignerVerifier";
158
158
  /**
159
159
  * Create a proof for the given data.
160
160
  * @param unsecuredDocument The data to create the proof for.
@@ -163,12 +163,12 @@ class DataIntegrityProofSignerVerifier {
163
163
  * @returns The created proof.
164
164
  */
165
165
  async createProof(unsecuredDocument, unsignedProof, signKey) {
166
- Guards.object(this.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
167
- Guards.object(this.CLASS_NAME, "unsignedProof", unsignedProof);
168
- Guards.object(this.CLASS_NAME, "signKey", signKey);
166
+ Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
167
+ Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "unsignedProof", unsignedProof);
168
+ Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "signKey", signKey);
169
169
  const rawKeys = await Jwk.toRaw(signKey);
170
170
  if (!Is.uint8Array(rawKeys.privateKey)) {
171
- throw new GeneralError(this.CLASS_NAME, "missingPrivateKey");
171
+ throw new GeneralError(DataIntegrityProofSignerVerifier.CLASS_NAME, "missingPrivateKey");
172
172
  }
173
173
  const unsecuredDocumentClone = ObjectHelper.clone(unsecuredDocument);
174
174
  const signedProof = ObjectHelper.clone(unsignedProof);
@@ -187,13 +187,13 @@ class DataIntegrityProofSignerVerifier {
187
187
  * @returns True if the credential was verified.
188
188
  */
189
189
  async verifyProof(securedDocument, signedProof, verifyKey) {
190
- Guards.object(this.CLASS_NAME, "securedDocument", securedDocument);
191
- Guards.object(this.CLASS_NAME, "signedProof", signedProof);
192
- Guards.stringValue(this.CLASS_NAME, "signedProof.proofValue", signedProof.proofValue);
193
- Guards.object(this.CLASS_NAME, "verifyKey", verifyKey);
190
+ Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "securedDocument", securedDocument);
191
+ Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "signedProof", signedProof);
192
+ Guards.stringValue(DataIntegrityProofSignerVerifier.CLASS_NAME, "signedProof.proofValue", signedProof.proofValue);
193
+ Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "verifyKey", verifyKey);
194
194
  const rawKeys = await Jwk.toRaw(verifyKey);
195
195
  if (!Is.uint8Array(rawKeys.publicKey)) {
196
- throw new GeneralError(this.CLASS_NAME, "missingPublicKey");
196
+ throw new GeneralError(DataIntegrityProofSignerVerifier.CLASS_NAME, "missingPublicKey");
197
197
  }
198
198
  const combinedHash = await this.createHash(securedDocument, signedProof);
199
199
  return Ed25519.verify(rawKeys.publicKey, combinedHash, Converter.base58ToBytes(signedProof.proofValue.slice(1)));
@@ -205,16 +205,16 @@ class DataIntegrityProofSignerVerifier {
205
205
  * @returns The created hash.
206
206
  */
207
207
  async createHash(unsecuredDocument, unsignedProof) {
208
- Guards.object(this.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
209
- Guards.object(this.CLASS_NAME, "unsignedProof", unsignedProof);
210
- Guards.stringValue(this.CLASS_NAME, "unsignedProof.cryptosuite", unsignedProof.cryptosuite);
211
- Guards.stringValue(this.CLASS_NAME, "unsignedProof.verificationMethod", unsignedProof.verificationMethod);
208
+ Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
209
+ Guards.object(DataIntegrityProofSignerVerifier.CLASS_NAME, "unsignedProof", unsignedProof);
210
+ Guards.stringValue(DataIntegrityProofSignerVerifier.CLASS_NAME, "unsignedProof.cryptosuite", unsignedProof.cryptosuite);
211
+ Guards.stringValue(DataIntegrityProofSignerVerifier.CLASS_NAME, "unsignedProof.verificationMethod", unsignedProof.verificationMethod);
212
212
  const unsecuredDocumentClone = ObjectHelper.clone(unsecuredDocument);
213
213
  const proofOptionsClone = ObjectHelper.clone(unsignedProof);
214
214
  delete unsecuredDocumentClone.proof;
215
215
  delete proofOptionsClone.proofValue;
216
216
  if (proofOptionsClone.cryptosuite !== DidCryptoSuites.EdDSAJcs2022) {
217
- throw new GeneralError(this.CLASS_NAME, "cryptosuiteNotSupported", {
217
+ throw new GeneralError(DataIntegrityProofSignerVerifier.CLASS_NAME, "cryptosuiteNotSupported", {
218
218
  cryptoSuite: proofOptionsClone.cryptosuite
219
219
  });
220
220
  }
@@ -237,7 +237,7 @@ class JsonWebSignature2020SignerVerifier {
237
237
  /**
238
238
  * Runtime name for the class.
239
239
  */
240
- CLASS_NAME = "JsonWebSignature2020SignerVerifier";
240
+ static CLASS_NAME = "JsonWebSignature2020SignerVerifier";
241
241
  /**
242
242
  * Create a proof for the given data.
243
243
  * @param unsecuredDocument The data to create the proof for.
@@ -246,9 +246,9 @@ class JsonWebSignature2020SignerVerifier {
246
246
  * @returns The created proof.
247
247
  */
248
248
  async createProof(unsecuredDocument, unsignedProof, signKey) {
249
- Guards.object(this.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
250
- Guards.object(this.CLASS_NAME, "unsignedProof", unsignedProof);
251
- Guards.object(this.CLASS_NAME, "signKey", signKey);
249
+ Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
250
+ Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "unsignedProof", unsignedProof);
251
+ Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "signKey", signKey);
252
252
  const unsecuredDocumentClone = ObjectHelper.clone(unsecuredDocument);
253
253
  unsecuredDocumentClone["@context"] = JsonLdProcessor.combineContexts(unsecuredDocumentClone["@context"], DidContexts.ContextSecurityJws2020);
254
254
  const hash = await this.createHash(unsecuredDocument, unsignedProof);
@@ -267,12 +267,12 @@ class JsonWebSignature2020SignerVerifier {
267
267
  * @returns True if the credential was verified.
268
268
  */
269
269
  async verifyProof(securedDocument, signedProof, verifyKey) {
270
- Guards.object(this.CLASS_NAME, "securedDocument", securedDocument);
271
- Guards.object(this.CLASS_NAME, "signedProof", signedProof);
272
- Guards.object(this.CLASS_NAME, "verifyKey", verifyKey);
270
+ Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "securedDocument", securedDocument);
271
+ Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "signedProof", signedProof);
272
+ Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "verifyKey", verifyKey);
273
273
  const jws = signedProof.jws;
274
274
  if (!Is.stringValue(jws)) {
275
- throw new GeneralError(this.CLASS_NAME, "jwsMissing");
275
+ throw new GeneralError(JsonWebSignature2020SignerVerifier.CLASS_NAME, "missingJws");
276
276
  }
277
277
  const hash = await this.createHash(securedDocument, signedProof);
278
278
  const cryptoKey = await Jwk.toCryptoKey(verifyKey);
@@ -285,9 +285,9 @@ class JsonWebSignature2020SignerVerifier {
285
285
  * @returns The created hash.
286
286
  */
287
287
  async createHash(unsecuredDocument, unsignedProof) {
288
- Guards.object(this.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
289
- Guards.object(this.CLASS_NAME, "unsignedProof", unsignedProof);
290
- Guards.stringValue(this.CLASS_NAME, "unsignedProof.verificationMethod", unsignedProof.verificationMethod);
288
+ Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
289
+ Guards.object(JsonWebSignature2020SignerVerifier.CLASS_NAME, "unsignedProof", unsignedProof);
290
+ Guards.stringValue(JsonWebSignature2020SignerVerifier.CLASS_NAME, "unsignedProof.verificationMethod", unsignedProof.verificationMethod);
291
291
  const unsecuredDocumentClone = ObjectHelper.clone(unsecuredDocument);
292
292
  const proofOptionsClone = ObjectHelper.clone(unsignedProof);
293
293
  unsecuredDocumentClone["@context"] = JsonLdProcessor.combineContexts(unsecuredDocumentClone["@context"], DidContexts.ContextSecurityJws2020);
@@ -401,8 +401,8 @@ class MultikeyHelper {
401
401
  }
402
402
  secretKeyRaw = Converter.base58ToBytes(multikey.secretKeyMultibase.slice(1));
403
403
  if (secretKeyRaw[0] !== 0x80 || secretKeyRaw[1] !== 0x26) {
404
- throw new GeneralError(MultikeyHelper.CLASS_NAME, "publicKeyMultibaseMissingHeader", {
405
- publicKeyMultibase: multikey.publicKeyMultibase
404
+ throw new GeneralError(MultikeyHelper.CLASS_NAME, "secretKeyMultibaseMissingHeader", {
405
+ secretKeyMultibase: multikey.secretKeyMultibase
406
406
  });
407
407
  }
408
408
  }
@@ -430,7 +430,7 @@ class ProofHelper {
430
430
  * @throws GeneralError if the proof type is not supported.
431
431
  */
432
432
  static createSignerVerifier(proofType) {
433
- Guards.arrayOneOf(this.CLASS_NAME, "proofType", proofType, Object.values(ProofTypes));
433
+ Guards.arrayOneOf(ProofHelper.CLASS_NAME, "proofType", proofType, Object.values(ProofTypes));
434
434
  let signerVerifier;
435
435
  if (proofType === ProofTypes.DataIntegrityProof) {
436
436
  signerVerifier = new DataIntegrityProofSignerVerifier();
@@ -452,10 +452,10 @@ class ProofHelper {
452
452
  * @returns The created proof.
453
453
  */
454
454
  static async createProof(proofType, unsecuredDocument, unsignedProof, signKey) {
455
- Guards.arrayOneOf(this.CLASS_NAME, "proofType", proofType, Object.values(ProofTypes));
456
- Guards.object(this.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
457
- Guards.object(this.CLASS_NAME, "unsignedProof", unsignedProof);
458
- Guards.object(this.CLASS_NAME, "signKey", signKey);
455
+ Guards.arrayOneOf(ProofHelper.CLASS_NAME, "proofType", proofType, Object.values(ProofTypes));
456
+ Guards.object(ProofHelper.CLASS_NAME, "unsecuredDocument", unsecuredDocument);
457
+ Guards.object(ProofHelper.CLASS_NAME, "unsignedProof", unsignedProof);
458
+ Guards.object(ProofHelper.CLASS_NAME, "signKey", signKey);
459
459
  return ProofHelper.createSignerVerifier(proofType).createProof(unsecuredDocument, unsignedProof, signKey);
460
460
  }
461
461
  /**
@@ -466,10 +466,10 @@ class ProofHelper {
466
466
  * @returns True if the credential was verified.
467
467
  */
468
468
  static async verifyProof(securedDocument, signedProof, verifyKey) {
469
- Guards.object(this.CLASS_NAME, "securedDocument", securedDocument);
470
- Guards.object(this.CLASS_NAME, "signedProof", signedProof);
471
- Guards.stringValue(this.CLASS_NAME, "signedProof.type", signedProof.type);
472
- Guards.object(this.CLASS_NAME, "verifyKey", verifyKey);
469
+ Guards.object(ProofHelper.CLASS_NAME, "securedDocument", securedDocument);
470
+ Guards.object(ProofHelper.CLASS_NAME, "signedProof", signedProof);
471
+ Guards.stringValue(ProofHelper.CLASS_NAME, "signedProof.type", signedProof.type);
472
+ Guards.object(ProofHelper.CLASS_NAME, "verifyKey", verifyKey);
473
473
  const signerVerifier = ProofHelper.createSignerVerifier(signedProof.type);
474
474
  return signerVerifier.verifyProof(securedDocument, signedProof, verifyKey);
475
475
  }
@@ -11,7 +11,7 @@ export declare class DataIntegrityProofSignerVerifier implements IProofSignerVer
11
11
  /**
12
12
  * Runtime name for the class.
13
13
  */
14
- readonly CLASS_NAME: string;
14
+ static readonly CLASS_NAME: string;
15
15
  /**
16
16
  * Create a proof for the given data.
17
17
  * @param unsecuredDocument The data to create the proof for.
@@ -9,7 +9,7 @@ export declare class JsonWebSignature2020SignerVerifier implements IProofSignerV
9
9
  /**
10
10
  * Runtime name for the class.
11
11
  */
12
- readonly CLASS_NAME: string;
12
+ static readonly CLASS_NAME: string;
13
13
  /**
14
14
  * Create a proof for the given data.
15
15
  * @param unsecuredDocument The data to create the proof for.
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @twin.org/standards-w3c-did - Changelog
2
2
 
3
+ ## [0.0.2-next.16](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.2-next.15...standards-w3c-did-v0.0.2-next.16) (2025-10-09)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **standards-w3c-did:** Synchronize repo versions
9
+
10
+ ## [0.0.2-next.15](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.2-next.14...standards-w3c-did-v0.0.2-next.15) (2025-10-09)
11
+
12
+
13
+ ### Features
14
+
15
+ * add validate-locales ([838389c](https://github.com/twinfoundation/standards/commit/838389c1daf62ed42397d5758d267c3d1a37fa4d))
16
+
3
17
  ## [0.0.2-next.14](https://github.com/twinfoundation/standards/compare/standards-w3c-did-v0.0.2-next.13...standards-w3c-did-v0.0.2-next.14) (2025-10-02)
4
18
 
5
19
 
@@ -21,7 +21,7 @@ https://www.w3.org/TR/vc-di-eddsa/#eddsa-jcs-2022
21
21
 
22
22
  ### CLASS\_NAME
23
23
 
24
- > `readonly` **CLASS\_NAME**: `string`
24
+ > `readonly` `static` **CLASS\_NAME**: `string`
25
25
 
26
26
  Runtime name for the class.
27
27
 
@@ -20,7 +20,7 @@ Helper methods for creating and verifying proofs.
20
20
 
21
21
  ### CLASS\_NAME
22
22
 
23
- > `readonly` **CLASS\_NAME**: `string`
23
+ > `readonly` `static` **CLASS\_NAME**: `string`
24
24
 
25
25
  Runtime name for the class.
26
26
 
package/locales/en.json CHANGED
@@ -1,19 +1,15 @@
1
1
  {
2
2
  "error": {
3
3
  "proofHelper": {
4
- "unsupportedProofType": "Proof type \"{proofType}\" not supported.",
5
- "proofMissing": "Proof is missing."
4
+ "unsupportedProofType": "Proof type \"{proofType}\" not supported."
6
5
  },
7
6
  "jsonWebSignature2020SignerVerifier": {
8
- "missingPrivateKey": "Private key is missing.",
9
- "missingPublicKey": "Public key is missing.",
10
- "missingProofValue": "Proof value is missing."
7
+ "missingJws": "JWS is missing from proof."
11
8
  },
12
9
  "dataIntegrityProofSignerVerifier": {
13
- "cryptosuiteNotSupported": "Cryptosuite \"{cryptosuite}\" is not supported.",
10
+ "cryptosuiteNotSupported": "Cryptosuite \"{cryptoSuite}\" is not supported.",
14
11
  "missingPrivateKey": "Private key is missing.",
15
- "missingPublicKey": "Public key is missing.",
16
- "missingProofValue": "Proof value is missing."
12
+ "missingPublicKey": "Public key is missing."
17
13
  },
18
14
  "multikeyHelper": {
19
15
  "invalidPublicKeyMultibase": "Public key multibase \"{publicKeyMultibase}\" is invalid.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/standards-w3c-did",
3
- "version": "0.0.2-next.14",
3
+ "version": "0.0.2-next.16",
4
4
  "description": "Models which define the structure of W3C DID Standard",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,5 +47,9 @@
47
47
  "standards",
48
48
  "schema",
49
49
  "specification"
50
- ]
50
+ ],
51
+ "bugs": {
52
+ "url": "git+https://github.com/twinfoundation/standards/issues"
53
+ },
54
+ "homepage": "https://twindev.org"
51
55
  }