Skip to content

Commit

Permalink
Merge branch 'remove-previous-references-from-proof'
Browse files Browse the repository at this point in the history
  • Loading branch information
iherman committed Jun 24, 2024
2 parents a79978b + 8761e3f commit 7ab78a8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
15 changes: 13 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ import * as types from './lib/types';

import { Errors, KeyData, VerificationResult, Cryptosuites } from './lib/types';
import { isKeyData, isDatasetCore, convertToStore, DatasetMap, GraphWithID, calculateDatasetHash } from './lib/utils';
import { generateAProofGraph, verifyProofGraphs, rdf_type, sec_di_proof, sec_proof, sec_prefix } from './lib/proof_utils';
import {
generateAProofGraph, verifyProofGraphs,
rdf_type,
sec_di_proof,
sec_proof,
sec_prefix,
sec_previousProof
} from './lib/proof_utils';

/* This file is also the "top level", so a number of exports are put here to be more friendly to users */
export type { KeyData, VerificationResult, KeyMetadata } from './lib/types';
Expand Down Expand Up @@ -144,7 +151,7 @@ export async function embedProofGraph(dataset: rdf.DatasetCore, keyData: KeyData
// Adding the chain statements, if required
if (isKeyChain) {
for (let i = 1; i < chain.length; i++) {
const q = quad(chain[i].proofId, sec_prefix("previousProof"), chain[i - 1].proofId, chain[i].graph);
const q = quad(chain[i].proofId, sec_previousProof, chain[i - 1].proofId, chain[i].graph);
retval.add(q);
}
}
Expand Down Expand Up @@ -206,6 +213,10 @@ export async function verifyEmbeddedProofGraph(dataset: rdf.DatasetCore, anchor?
// this is an extra entry, not part of the triples that were signed
// neither it is part of any proof graphs
continue;
} else if(q.predicate.equals(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)
} else if(proofGraphs.has(q.graph)) {
Expand Down
1 change: 1 addition & 0 deletions lib/proof_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const sec_expires: rdf.NamedNode = sec_prefix('expires');
export const sec_revoked: rdf.NamedNode = sec_prefix('revoked');
export const sec_created: rdf.NamedNode = sec_prefix('created');
export const xsd_datetime: rdf.NamedNode = xsd_prefix('dateTime');
export const sec_previousProof: rdf.NamedNode = sec_prefix("previousProof");


/**
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rdfjs-di",
"version": "0.0.9",
"date": "2024-06-12",
"version": "0.0.95",
"date": "2024-06-25",
"description": "Secure an RDF Dataset through VC's Data Integrity",
"main": "dist/index.js",
"scripts": {
Expand Down

0 comments on commit 7ab78a8

Please sign in to comment.