@twin.org/standards-w3c-did 0.0.1-next.26 → 0.0.1-next.27
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/cjs/index.cjs
CHANGED
|
@@ -467,22 +467,10 @@ class ProofHelper {
|
|
|
467
467
|
static async verifyProof(securedDocument, signedProof, verifyKey) {
|
|
468
468
|
core.Guards.object(this.CLASS_NAME, "securedDocument", securedDocument);
|
|
469
469
|
core.Guards.object(this.CLASS_NAME, "signedProof", signedProof);
|
|
470
|
+
core.Guards.stringValue(this.CLASS_NAME, "signedProof.type", signedProof.type);
|
|
470
471
|
core.Guards.object(this.CLASS_NAME, "verifyKey", verifyKey);
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
const proofs = core.Is.array(securedDocument.proof)
|
|
475
|
-
? securedDocument.proof
|
|
476
|
-
: [securedDocument.proof];
|
|
477
|
-
let verified = false;
|
|
478
|
-
for (const proof of proofs) {
|
|
479
|
-
const signerVerifier = ProofHelper.createSignerVerifier(proof.type);
|
|
480
|
-
verified = await signerVerifier.verifyProof(securedDocument, proof, verifyKey);
|
|
481
|
-
if (!verified) {
|
|
482
|
-
return false;
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
return verified;
|
|
472
|
+
const signerVerifier = ProofHelper.createSignerVerifier(signedProof.type);
|
|
473
|
+
return signerVerifier.verifyProof(securedDocument, signedProof, verifyKey);
|
|
486
474
|
}
|
|
487
475
|
}
|
|
488
476
|
|
package/dist/esm/index.mjs
CHANGED
|
@@ -465,22 +465,10 @@ class ProofHelper {
|
|
|
465
465
|
static async verifyProof(securedDocument, signedProof, verifyKey) {
|
|
466
466
|
Guards.object(this.CLASS_NAME, "securedDocument", securedDocument);
|
|
467
467
|
Guards.object(this.CLASS_NAME, "signedProof", signedProof);
|
|
468
|
+
Guards.stringValue(this.CLASS_NAME, "signedProof.type", signedProof.type);
|
|
468
469
|
Guards.object(this.CLASS_NAME, "verifyKey", verifyKey);
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
const proofs = Is.array(securedDocument.proof)
|
|
473
|
-
? securedDocument.proof
|
|
474
|
-
: [securedDocument.proof];
|
|
475
|
-
let verified = false;
|
|
476
|
-
for (const proof of proofs) {
|
|
477
|
-
const signerVerifier = ProofHelper.createSignerVerifier(proof.type);
|
|
478
|
-
verified = await signerVerifier.verifyProof(securedDocument, proof, verifyKey);
|
|
479
|
-
if (!verified) {
|
|
480
|
-
return false;
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
return verified;
|
|
470
|
+
const signerVerifier = ProofHelper.createSignerVerifier(signedProof.type);
|
|
471
|
+
return signerVerifier.verifyProof(securedDocument, signedProof, verifyKey);
|
|
484
472
|
}
|
|
485
473
|
}
|
|
486
474
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { IJsonLdNodeObject } from "@twin.org/data-json-ld";
|
|
2
2
|
import type { IJwk } from "@twin.org/web";
|
|
3
|
-
import type { IDataIntegrityProof } from "../models/IDataIntegrityProof";
|
|
4
|
-
import type { IJsonWebSignature2020Proof } from "../models/IJsonWebSignature2020Proof";
|
|
5
3
|
import type { IProofSignerVerifier } from "../models/IProofSignerVerifier";
|
|
6
4
|
import { ProofTypes } from "../models/proofTypes";
|
|
7
5
|
/**
|
|
@@ -35,7 +33,5 @@ export declare class ProofHelper {
|
|
|
35
33
|
* @param verifyKey The public key to verify the proof with.
|
|
36
34
|
* @returns True if the credential was verified.
|
|
37
35
|
*/
|
|
38
|
-
static verifyProof(securedDocument: IJsonLdNodeObject
|
|
39
|
-
proof: IDataIntegrityProof | IJsonWebSignature2020Proof | (IDataIntegrityProof | IJsonWebSignature2020Proof)[];
|
|
40
|
-
}, signedProof: IJsonLdNodeObject, verifyKey: IJwk): Promise<boolean>;
|
|
36
|
+
static verifyProof(securedDocument: IJsonLdNodeObject, signedProof: IJsonLdNodeObject, verifyKey: IJwk): Promise<boolean>;
|
|
41
37
|
}
|
package/docs/changelog.md
CHANGED