Skip to content

Commit

Permalink
Merge pull request #446 from docknetwork/revert-445-fix/revert-anoncr…
Browse files Browse the repository at this point in the history
…eds-upgrade

Revert "Revert anoncreds upgrade"
  • Loading branch information
cykoder authored Aug 23, 2024
2 parents 56c1453 + e0946a2 commit 5cc1ef2
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@docknetwork/sdk",
"version": "9.2.1",
"version": "9.3.0",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -104,7 +104,7 @@
},
"dependencies": {
"@digitalcredentials/vc-status-list": "^8.0.0",
"@docknetwork/crypto-wasm-ts": "0.63.0",
"@docknetwork/crypto-wasm-ts": "0.66.0",
"@docknetwork/node-types": "^0.17.0",
"@juanelas/base64": "^1.0.5",
"@polkadot/api": "10.12.4",
Expand Down
8 changes: 7 additions & 1 deletion src/utils/vc/crypto/common/DockCryptoSignature.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,12 @@ export default withExtendedStaticProperties(
[serializedCredential, credSchema] = await this.constructor.convertCredentialToSerializedForSigning(options);
}

const useConstantTimeEncoder = semver.gte(credSchema.version, '0.5.0');
// Encode messages, retrieve names/values array
const nameValues = credSchema.encoder.encodeMessageObject(
const nameValues = useConstantTimeEncoder ? credSchema.encoder.encodeMessageObjectConstantTime(
serializedCredential,
false,
) : credSchema.encoder.encodeMessageObject(
serializedCredential,
false,
);
Expand Down Expand Up @@ -444,6 +448,8 @@ export default withExtendedStaticProperties(
},
false,
{ version: '0.0.1' },
undefined,
false,
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/anoncreds/demo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ for (const {
// different way.
encoded.push(Accumulator.encodeBytesAsAccumulatorMember(attrs[i]));
} else {
encoded.push(Signature.encodeMessageForSigning(attrs[i]));
encoded.push(Signature.encodeMessageForSigningConstantTime(attrs[i]));
}
}
return encoded;
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/anoncreds/r1cs-circom.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ for (const {
await initializeWasm();

// Setup encoder
const defaultEncoder = (v) => Signature.encodeMessageForSigning(
const defaultEncoder = (v) => Signature.encodeMessageForSigningConstantTime(
Uint8Array.from(Buffer.from(v.toString(), 'utf-8')),
);
encoder = new Encoder(undefined, defaultEncoder);
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/anoncreds/saver-and-bound-check.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ for (const {
} else if (i === boundedAttrIdx) {
encoded.push(Signature.encodePositiveNumberForSigning(attrs[i]));
} else {
encoded.push(Signature.encodeMessageForSigning(attrs[i]));
encoded.push(Signature.encodeMessageForSigningConstantTime(attrs[i]));
}
}
return encoded;
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2878,15 +2878,15 @@
fix-esm "^1.0.1"
jsonld digitalcredentials/jsonld.js#v10.x

"@docknetwork/crypto-wasm-ts@0.63.0":
version "0.63.0"
resolved "https://registry.yarnpkg.com/@docknetwork/crypto-wasm-ts/-/crypto-wasm-ts-0.63.0.tgz#f1ab39693b63e70d682d362e9eacd85842ae56e0"
integrity sha512-KryDPIf6suwi5NS1iqA76vpuLmZv4PLV1Dt7I6Z4YS3rDKK43m7j8mox6lhQgkVL7QZdJ1DdZGxcPLekXZYQ1w==
"@docknetwork/crypto-wasm-ts@0.66.0":
version "0.66.0"
resolved "https://registry.yarnpkg.com/@docknetwork/crypto-wasm-ts/-/crypto-wasm-ts-0.66.0.tgz#c579c3f0ace11659c365addb5f2a6b46d89fc09c"
integrity sha512-wjnln7wOpX+RW/lSoy3SOr2NeMfsxfuN6y/8z9YDWIegpggn8eAJ3TWqsT5vShEAx4BloxSVjom7u6MUDAMQ1w==
dependencies:
"@types/flat" "^5.0.2"
"@types/lodash" "^4.14.195"
bs58 "5.0.0"
crypto-wasm-new "npm:@docknetwork/crypto-wasm@0.30.0"
crypto-wasm-new "npm:@docknetwork/crypto-wasm@0.32.0"
flat "^5.0.2"
json-pointer "^0.6.2"
json-stringify-deterministic "^1.0.11"
Expand Down Expand Up @@ -6747,10 +6747,10 @@ crypto-ld@^6.0.0:
resolved "https://registry.yarnpkg.com/crypto-ld/-/crypto-ld-6.0.0.tgz#cf8dcf566cb3020bdb27f0279e6cc9b46d031cd7"
integrity sha512-XWL1LslqggNoaCI/m3I7HcvaSt9b2tYzdrXO+jHLUj9G1BvRfvV7ZTFDVY5nifYuIGAPdAGu7unPxLRustw3VA==

"crypto-wasm-new@npm:@docknetwork/crypto-wasm@0.30.0":
version "0.30.0"
resolved "https://registry.yarnpkg.com/@docknetwork/crypto-wasm/-/crypto-wasm-0.30.0.tgz#d54a56989cf98847e6e4ebe8119b6eb6012d8da4"
integrity sha512-xwDtakDBaiOf0Cm6H74JsJ2I610rc+d9tSrgjuACE7QBpmkTug6QX4Q4OzxXA12wp86K5QqRMHoCzc6geS1Z0g==
"crypto-wasm-new@npm:@docknetwork/crypto-wasm@0.32.0":
version "0.32.0"
resolved "https://registry.yarnpkg.com/@docknetwork/crypto-wasm/-/crypto-wasm-0.32.0.tgz#636c67447179b59dbd82d46c93f3921186387dc6"
integrity sha512-Xdppk2zted+7GmeSgVYz5mTML5NHOSKlZLwYbbpekHaX32NJ5VjnJ12frilXyEGaPDgW0sdX9rxWU2hUBz27JA==
dependencies:
buffer "^6.0.3"

Expand Down

0 comments on commit 5cc1ef2

Please sign in to comment.