Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRITICAL: Fix safe mode bug #55

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"base64url-universal": "^2.0.0",
"chai": "^4.3.7",
"data-integrity-test-suite-assertion": "github:w3c-ccg/data-integrity-test-suite-assertion",
"jsonld-document-loader": "^2.0.0",
"jsonld": "^8.3.2",
"mocha": "^10.2.0",
"uuid": "^9.0.0",
"vc-test-suite-implementations": "github:w3c/vc-test-suite-implementations"
Expand Down
21 changes: 6 additions & 15 deletions tests/vc-generator/contexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
import {
contexts as credentialsContexts
contexts as credentialsContexts,
named as namedCredentialsContexts
} from '@digitalbazaar/credentials-context';
import dataIntegrityCtx from '@digitalbazaar/data-integrity-context';
import didCtx from '@digitalcredentials/did-context';
Expand All @@ -16,29 +17,19 @@ const setContexts = contexts => {
}
};

/*
const {context: vc2Context} = namedCredentialsContexts.get('v2');
const v2Ctx = vc2Context['@context'];
v2Ctx.UnknownProofType = structuredClone(v2Ctx.DataIntegrityProof);
const _dataIntegrityCtx = structuredClone(dataIntegrityCtx.CONTEXT);
const diCtx = _dataIntegrityCtx['@context'];
// add UnknownProofType to local context for test data
diCtx.UnknownProofType =
structuredClone(_dataIntegrityCtx['@context'].DataIntegrityProof);
// add invalidPurpose to context for test data
diCtx.DataIntegrityProof['@context'].proofPurpose['@context'].invalidPurpose = {
'@id': 'https://w3id.org/security#invalidPurpose',
'@type': '@id',
'@container': '@set'
};
diCtx.UnknownProofType = structuredClone(diCtx.DataIntegrityProof);
contextMap.set(
dataIntegrityCtx.constants.CONTEXT_URL,
_dataIntegrityCtx
);
*/

// add contexts for the documentLoader
contextMap.set(multikeyCtx.constants.CONTEXT_URL, multikeyCtx.CONTEXT);

// add the data integrity contexts
setContexts(dataIntegrityCtx.contexts);
// add the dids contexts
setContexts(didCtx.contexts);

Expand Down
2 changes: 2 additions & 0 deletions tests/vc-generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export async function verifyCredential({
}

export async function deriveCredentials({
documentLoader = defaultLoader,
keys,
vectors,
map = new Map(),
Expand All @@ -110,6 +111,7 @@ export async function deriveCredentials({
suite: getSuite({suite: suiteName, signer, mandatoryPointers}),
selectiveSuite: getSuite({suite: suiteName, signer, selectivePointers}),
credential: _credential,
loader: documentLoader,
// add the ability to overwrite the defaults
...initialParams
};
Expand Down