Skip to content

Commit

Permalink
update NoirBignum dependency to native js implementation for browser …
Browse files Browse the repository at this point in the history
…compatibility
  • Loading branch information
jp4g committed Sep 21, 2024
1 parent 32ba7e6 commit 03572aa
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mach-34/zkemail-nr",
"version": "1.0.4",
"version": "1.0.5",
"main": "dist",
"types": "dist",
"license": "MIT",
Expand All @@ -11,10 +11,10 @@
"prepublishOnly": "yarn lint && yarn build"
},
"dependencies": {
"@mach-34/noir-bignum-paramgen": "^1.0.2",
"@noir-lang/backend_barretenberg": "=0.34.0",
"@noir-lang/noir_js": "=0.34.0",
"@zk-email/helpers": "=6.1.5",
"noir_bignum": "=0.1.0"
"@zk-email/helpers": "=6.1.5"
},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand Down
10 changes: 5 additions & 5 deletions js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
DKIMVerificationResult,
verifyDKIMSignature,
} from "@zk-email/helpers/dist/dkim";
import * as NoirBignum from "noir_bignum";
import * as NoirBignum from "@mach-34/noir-bignum-paramgen";

// This file is essentially https://github.com/zkemail/zk-email-verify/blob/main/packages/helpers/src/input-generators.ts
// with a few modifications for noir input generation
Expand Down Expand Up @@ -101,11 +101,11 @@ export function generateEmailVerifierInputsFromDKIMResult(
// modified from original: can use exact email header length
emailHeaderLength: headers.length.toString(),
// modified from original: use noir bignum to format
pubkey: NoirBignum.bn_limbs_from_string(publicKey.toString(16)),
// modified from original: use noir bignum to format
signature: NoirBignum.bn_limbs_from_string(signature.toString(16)),
pubkey: NoirBignum.bnToLimbStrArray(publicKey),
// not in original: add barrett reduction param for efficient rsa sig verification
redcParams: NoirBignum.redc_limbs_from_string(publicKey.toString(16)),
redcParams: NoirBignum.bnToRedcLimbStrArray(publicKey),
// modified from original: use noir bignum to format
signature: NoirBignum.bnToLimbStrArray(signature),
};

// removed: header mask
Expand Down
10 changes: 5 additions & 5 deletions js/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,11 @@
"@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14"

"@mach-34/noir-bignum-paramgen@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@mach-34/noir-bignum-paramgen/-/noir-bignum-paramgen-1.0.2.tgz#9928bd1bc97ed67df654eda836a04ee9640a4761"
integrity sha512-80+8KcYR4RNxgYGBaJkZlmSDLUJcj0QIpKWUCUrShjqIQh4LGKi/dgf6JdziEzDVxKr4AkmCkA7pdwLcsD5xag==

"@nodelib/fs.scandir@2.1.5":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
Expand Down Expand Up @@ -4287,11 +4292,6 @@ node-releases@^2.0.18:
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f"
integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==

noir_bignum@=0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/noir_bignum/-/noir_bignum-0.1.0.tgz#bd000e7271f8dbfe420fd013a649445c28fc05fe"
integrity sha512-seSCzzutMocD9JtjGC0bpyFUOqZcVZ0xeM/318vR9S3eb75tYGeJGtNgQuY1UDGlNvUMqEIKgcEYVBpZmFVm4A==

normalize-path@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
Expand Down

0 comments on commit 03572aa

Please sign in to comment.