Skip to content

Commit

Permalink
Remove unneccessary code
Browse files Browse the repository at this point in the history
Signed-off-by: lovesh <lovesh.bond@gmail.com>
  • Loading branch information
lovesh committed Mar 20, 2024
1 parent d5815c7 commit 3057ca0
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/anonymous-credentials/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1335,17 +1335,7 @@ export class CredentialSchema extends Versioned {
schemaProps[key]['items'] = schemaProps[key]['items'].slice(0, value.length);
}
} else if (schemaProps[key]['type'] === 'object' && typ === 'object') {
const schemaKeys = new Set([...Object.keys(schemaProps[key][SCHEMA_PROPS_STR])]);
const valKeys = new Set([...Object.keys(value)]);
for (const vk of valKeys) {
CredentialSchema.generateFromCredential(value, schemaProps[key][SCHEMA_PROPS_STR], schemaVersion);
}
// Delete extra keys not in cred
for (const sk of schemaKeys) {
if (value[sk] === undefined) {
delete schemaKeys[sk];
}
}
CredentialSchema.generateFromCredential(value, schemaProps[key][SCHEMA_PROPS_STR], schemaVersion);
} else {
throw new Error(
`Incompatible types in credential and schema for key ${key}: ${schemaProps[key]['type']} !== ${typ}`
Expand Down

0 comments on commit 3057ca0

Please sign in to comment.