Skip to content

Commit

Permalink
Merge pull request #350 from docknetwork/feat/verify-full-schema
Browse files Browse the repository at this point in the history
fix validateCredentialSchema when schema is full schema not just for subject
  • Loading branch information
cykoder authored Jun 13, 2023
2 parents 3a1590b + 45a8781 commit 6f7516e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@docknetwork/sdk",
"version": "5.0.1",
"version": "5.0.2",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
4 changes: 3 additions & 1 deletion src/utils/vc/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ export async function validateCredentialSchema(credential, schema, context, docu
throw new Error('Compacted subject is empty, likely invalid');
}

validate(compacted, schema.schema || schema, {
const schemaObj = schema.schema || schema;
const subjectSchema = (schemaObj.properties && schemaObj.properties.credentialSubject) || schemaObj;
validate(compacted, subjectSchema, {
throwError: true,
});
}
Expand Down

0 comments on commit 6f7516e

Please sign in to comment.