Skip to content

Commit

Permalink
Generated distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
iherman committed Jun 24, 2024
1 parent 7ab78a8 commit 4614c3a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async function embedProofGraph(dataset, keyData, anchor) {
// Adding the chain statements, if required
if (isKeyChain) {
for (let i = 1; i < chain.length; i++) {
const q = quad(chain[i].proofId, (0, proof_utils_1.sec_prefix)("previousProof"), chain[i - 1].proofId, chain[i].graph);
const q = quad(chain[i].proofId, proof_utils_1.sec_previousProof, chain[i - 1].proofId, chain[i].graph);
retval.add(q);
}
}
Expand Down Expand Up @@ -182,6 +182,11 @@ async function verifyEmbeddedProofGraph(dataset, anchor) {
// neither it is part of any proof graphs
continue;
}
else if (q.predicate.equals(proof_utils_1.sec_previousProof)) {
// Per the cryptosuite specifications, the "previous proof" statement is not part of the "proof options", ie,
// should not be used for the generation of the final proof. It was not used to generate the proof graph when signing.
continue;
}
else if (q.graph.termType === "DefaultGraph") {
dataStore.add(q);
}
Expand Down
1 change: 1 addition & 0 deletions dist/lib/proof_utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export declare const sec_expires: rdf.NamedNode;
export declare const sec_revoked: rdf.NamedNode;
export declare const sec_created: rdf.NamedNode;
export declare const xsd_datetime: rdf.NamedNode;
export declare const sec_previousProof: rdf.NamedNode;
/**
* Generate a (separate) proof graph, per the DI spec. The signature is stored in
* [multibase format](https://www.w3.org/TR/vc-data-integrity/#multibase-0), using base64url encoding.
Expand Down
3 changes: 2 additions & 1 deletion dist/lib/proof_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @packageDocumentation
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.verifyProofGraphs = exports.generateAProofGraph = exports.xsd_datetime = exports.sec_created = exports.sec_revoked = exports.sec_expires = exports.sec_verificationMethod = exports.sec_assertionMethod = exports.sec_authenticationMethod = exports.sec_proofPurpose = exports.sec_publicKeyMultibase = exports.sec_publicKeyJwk = exports.sec_proofValue = exports.sec_di_proof = exports.sec_proof = exports.rdf_json = exports.rdf_type = exports.xsd_prefix = exports.rdf_prefix = exports.sec_prefix = void 0;
exports.verifyProofGraphs = exports.generateAProofGraph = exports.sec_previousProof = exports.xsd_datetime = exports.sec_created = exports.sec_revoked = exports.sec_expires = exports.sec_verificationMethod = exports.sec_assertionMethod = exports.sec_authenticationMethod = exports.sec_proofPurpose = exports.sec_publicKeyMultibase = exports.sec_publicKeyJwk = exports.sec_proofValue = exports.sec_di_proof = exports.sec_proof = exports.rdf_json = exports.rdf_type = exports.xsd_prefix = exports.rdf_prefix = exports.sec_prefix = void 0;
const n3 = require("n3");
const uuid_1 = require("uuid");
const canonify_1 = require("@truestamp/canonify");
Expand Down Expand Up @@ -42,6 +42,7 @@ exports.sec_expires = (0, exports.sec_prefix)('expires');
exports.sec_revoked = (0, exports.sec_prefix)('revoked');
exports.sec_created = (0, exports.sec_prefix)('created');
exports.xsd_datetime = (0, exports.xsd_prefix)('dateTime');
exports.sec_previousProof = (0, exports.sec_prefix)("previousProof");
/**
* The proof option graph is the collection of all quads in a proof graph, except the proof
* value. The hash of this graph is combined with the hash of the original data.
Expand Down

0 comments on commit 4614c3a

Please sign in to comment.