Skip to content

Commit

Permalink
fix parsing options
Browse files Browse the repository at this point in the history
Signed-off-by: lovesh <[email protected]>
  • Loading branch information
lovesh committed Sep 26, 2023
1 parent 15e1087 commit bb79dc4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/modules/did/did.js
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,6 @@ class DIDModule {
}
if (this.api.query.offchainSignatures != null) {
const resp = await this.api.query.offchainSignatures.publicKeys.multi(queryKeys);

let currentIter = 0;
for (let r of resp) {
// The gaps in `keyId` might correspond to removed keys
Expand Down Expand Up @@ -885,7 +884,6 @@ class DIDModule {
}
} else {
const resp = await this.api.query.bbsPlus.bbsPlusKeys.multi(queryKeys);

let currentIter = 0;
for (const r of resp) {
// The gaps in `keyId` might correspond to removed keys
Expand Down
11 changes: 8 additions & 3 deletions src/utils/vc/crypto/common/DockCryptoSignature.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,15 @@ export default withExtendedStaticProperties(
let credSchema;
if (document.credentialSchema) {
credSchema = CredentialSchema.fromJSON({
parsingOptions: DEFAULT_PARSING_OPTS,
// Passing all the default parsing options. Ideally `document.credentialSchema` should contain these
parsingOptions: {
useDefaults: false,
defaultMinimumInteger: -((2 ** 32) - 1),
defaultMinimumDate: -((2 ** 44) - 1),
defaultDecimalPlaces: 0,
},
...document.credentialSchema,
});

// TODO: support documentloader for schemas here so we can use dock chain schemas
// requires that the presentation wrapper passes a documentloader to this method
// const loadedSchema = (await documentLoader(document.credentialSchema.id)).document;
Expand All @@ -136,7 +141,7 @@ export default withExtendedStaticProperties(
// Passing old parsing options and version
{
useDefaults: false,
defaultMinimumInteger: -(Math.pow(2, 32) - 1),
defaultMinimumInteger: -((2 ** 32) - 1),
defaultDecimalPlaces: 0,
},
false,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/anoncreds/issuing.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ for (const {
expect(resultWithSchema).toMatchObject(
expect.objectContaining(getProofMatcherDoc()),
);
}, 30000);
}, 30000);

test(`Can issue+verify a ${Name} credential with default schema`, async () => {
const issuerKey = getKeyDoc(did1, keypair, keypair.type, keypair.id);
Expand Down

0 comments on commit bb79dc4

Please sign in to comment.