PeculiarVentures / webcrypto-liner

webcrypto-liner is a polyfill that let's down-level User Agents (like IE/Edge) use libraries that depend on WebCrypto. (Keywords: Javascript, WebCrypto, Shim, Polyfill)
MIT License
148 stars 26 forks source link

Is there breaking changes from 1.0.2 to 1.1.2? #74

Open Jack-Works opened 4 years ago

Jack-Works commented 4 years ago

Our test failed when dependent bot try to auto upgrade dependency for us. Happy to see the info about what is changed from 1.0.2 to 1.1.2, thanks!

https://github.com/DimensionDev/Maskbook/pull/611

ReferenceError: regeneratorRuntime is not defined
    at SubtleCrypto$1.importKey (/home/circleci/repo/node_modules/webcrypto-liner/build/webcrypto-liner.shim.js:13953:48)
    at Object.import_ECDH_256k1_Key (/home/circleci/repo/src/utils/crypto.subtle.ts:790:24)
    at Object.<anonymous> (/home/circleci/repo/src/database/__tests__/types.ts:61:29)
    at Object.asyncJestTest (/home/circleci/repo/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:102:37)
    at /home/circleci/repo/node_modules/jest-jasmine2/build/queueRunner.js:43:12
    at new Promise (<anonymous>)
    at mapper (/home/circleci/repo/node_modules/jest-jasmine2/build/queueRunner.js:26:19)
    at /home/circleci/repo/node_modules/jest-jasmine2/build/queueRunner.js:73:41
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
TypeError: asmcrypto_js.Pbkdf2HmacSha256 is not a function
    at _callee71$ (/home/circleci/repo/node_modules/webcrypto-liner/build/webcrypto-liner.shim.js:11916:41)
    at tryCatch (/home/circleci/repo/node_modules/@holoflows/kit/node_modules/regenerator-runtime/runtime.js:45:40)
    at Generator.invoke [as _invoke] (/home/circleci/repo/node_modules/@holoflows/kit/node_modules/regenerator-runtime/runtime.js:271:22)
    at Generator.prototype.<computed> [as next] (/home/circleci/repo/node_modules/@holoflows/kit/node_modules/regenerator-runtime/runtime.js:97:21)
    at /home/circleci/repo/node_modules/webcrypto-liner/build/webcrypto-liner.shim.js:2334:69
    at new Promise (<anonymous>)
    at __awaiter (/home/circleci/repo/node_modules/webcrypto-liner/build/webcrypto-liner.shim.js:2311:12)
    at Pbkdf2Provider$1.onDeriveBits (/home/circleci/repo/node_modules/webcrypto-liner/build/webcrypto-liner.shim.js:11899:16)
    at Pbkdf2Provider$1.deriveBits$ (/home/circleci/repo/node_modules/webcrypto-liner/build/webcrypto-liner.shim.js:852:70)
    at tryCatch (/home/circleci/repo/node_modules/@holoflows/kit/node_modules/regenerator-runtime/runtime.js:45:40)
TypeError: asmcrypto_js.Sha256 is not a constructor
    at Function.getDigest (/home/circleci/repo/node_modules/webcrypto-liner/build/webcrypto-liner.shim.js:10488:20)
    at Function._callee35$ (/home/circleci/repo/node_modules/webcrypto-liner/build/webcrypto-liner.shim.js:10506:31)
    at tryCatch (/home/circleci/repo/node_modules/@holoflows/kit/node_modules/regenerator-runtime/runtime.js:45:40)
    at Generator.invoke [as _invoke] (/home/circleci/repo/node_modules/@holoflows/kit/node_modules/regenerator-runtime/runtime.js:271:22)
    at Generator.prototype.<computed> [as next] (/home/circleci/repo/node_modules/@holoflows/kit/node_modules/regenerator-runtime/runtime.js:97:21)
    at /home/circleci/repo/node_modules/webcrypto-liner/build/webcrypto-liner.shim.js:2334:69
    at new Promise (<anonymous>)
    at __awaiter (/home/circleci/repo/node_modules/webcrypto-liner/build/webcrypto-liner.shim.js:2311:12)
    at Function.digest (/home/circleci/repo/node_modules/webcrypto-liner/build/webcrypto-liner.shim.js:10500:16)
    at _callee69$ (/home/circleci/repo/node_modules/webcrypto-liner/build/webcrypto-liner.shim.js:11806:64)
mishraab07 commented 4 years ago

Is there any way to resolve this issue ? I am also getting the same when hosting fortify-web (tools) as a local server.

donskov commented 4 years ago

@mishraab07 Hi. Now, fortify-web (tools) works correctly. Please pull the latest changes from the master branch or use https://tools.fortifyapp.com/

mishraab07 commented 4 years ago

Hi @donskov thank you for your feedback, I see the below observations:

  1. When deploying master branch using a docker container, I am facing the below error:

image

  1. When deploying v1.0.21 tag using a docker container (same machine acting as a client and docker-host), everything works well (i.e. I can see all the certificates installed on my machine).

  2. When deploying v1.0.21 tag using a docker container (client machine is different than the docker-host but on same network), I am getting one of the error mentioned in the opened issue (WebcryptoSocket connected error: TypeError: asmcrypto_js.Sha256 is not a constructor):

image

Can you please tell, what is going wrong here (particularly in 3rd case). Thanks a lot in advance.

rmhrisk commented 4 years ago

Localhost (127.0.0.1) wot work cross machine. Unless your docker config has some component that routes between two containers on the same host and this supports localhost. Wouldn’t expect this to work.