Skip to content

Commit

Permalink
Fix encoding
Browse files Browse the repository at this point in the history
Signed-off-by: lovesh <lovesh.bond@gmail.com>
  • Loading branch information
lovesh committed Jul 17, 2024
1 parent 5078ab0 commit 89ad48b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 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/crypto-wasm-ts",
"version": "0.65.0",
"version": "0.66.0",
"description": "Typescript abstractions over Dock's Rust crypto library's WASM wrapper",
"homepage": "https://github.com/docknetwork/crypto-wasm-ts",
"main": "lib/index.js",
Expand Down
13 changes: 7 additions & 6 deletions src/anonymous-credentials/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,13 @@ export class CredentialSchema extends Versioned {
) as ISchema;
CredentialSchema.validate(schema);

let ct = useConstantTimeEncoder;
if (overrides !== undefined && overrides.version !== undefined) {
// Revisit: if overrides.version is older, should useConstantTimeEncoder be set to false. This would be overriding
// the caller's intent but looks correct.
super(overrides.version);
// For older version, a variable time message encoder was mistakenly used.
// This is overriding the caller's intent
ct = semver.gte(overrides.version, '0.5.0');

} else {
super(CredentialSchema.VERSION);
}
Expand All @@ -556,7 +559,7 @@ export class CredentialSchema extends Versioned {
this.jsonSchema = jsonSchema;
this.parsingOptions = pOpts;
this.fullJsonSchema = fullJsonSchema;
this.initEncoder(useConstantTimeEncoder);
this.initEncoder(ct);
}

/**
Expand Down Expand Up @@ -919,9 +922,7 @@ export class CredentialSchema extends Versioned {
}
}
}
// For older version, a variable time message encoder was mistakenly used
const useConstantTimeEncoder = semver.gte(version, '0.5.0');
return new CredentialSchema(jsonSchema, parsingOptions, false, { version: version }, fullJsonSchema, useConstantTimeEncoder);
return new CredentialSchema(jsonSchema, parsingOptions, false, { version: version }, fullJsonSchema);
}

/**
Expand Down

0 comments on commit 89ad48b

Please sign in to comment.