entronad / crypto-es

A cryptography algorithms library
Other
275 stars 31 forks source link

Wrong typing expected in the hasher for PBKDF2 #14

Closed 188599 closed 1 year ago

188599 commented 3 years ago

Typescript complains, but it works:

CryptoES.PBKDF2(..., { hasher: CryptoES.algo.SHA1 });

Typescript accepts this but it doesn't work:

CryptoES.PBKDF2(..., { hasher: new CryptoES.algo.SHA1() });

I'm guessing the type expected for hasher should be something like this:

new (...args: any) => CryptoES.lib.Hasher;
wbovela commented 3 years ago

Experiencing the same issue.

In CryptoJS the type for the hasher is simply "any", as is the type of "CryptoJS.algo.SHA512".

If I cast the Crypto.algo.SHA512 to < any > things work.

entronad commented 1 year ago

The type issues are fixed in v2.0.0