You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.
I'm trying to use asmCrypto in Typescript. I need to use the low-level Hash and HMAC functions (reset, process, finish, result). Existing asmcrypto.js.d.ts does not cover these functions.
I tried to write some typings, but 1) I'm not an expert on that and most importantly, 2) the code structure is really convoluted.
I suggest NOT using classes in Javascript. Also you should use inheritance to implement common behavior, instead of augmenting an existing object with independent functions (hash_reset etc.). Further, there seems to be quite a bit of confusion where HASH_SIZE and BLOCK_SIZE belong (hmac object itself, or its prototype).
It's pretty much impossible to describe the current codebase with *.d.ts files, exactly because Typescript was designed to prevent some techniques used in asmCrypto.
Last note, I noticed that the option heapSize is not passed from sha256_constructor (and others) to _heap_init.
If anyone finds themselves in the same situation, I've attached some simple typings I made. They show errors in Intellisense and some elements are "any" instead of typed objects but at least it compiles without warnings or errors.
Just released the new, TS based AsmCrypto 2.0. Hope that you find the new types more usable. I know there is a lot of room for improvement, any suggestion is welcomed.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm trying to use asmCrypto in Typescript. I need to use the low-level Hash and HMAC functions (reset, process, finish, result). Existing asmcrypto.js.d.ts does not cover these functions.
I tried to write some typings, but 1) I'm not an expert on that and most importantly, 2) the code structure is really convoluted.
I suggest NOT using classes in Javascript. Also you should use inheritance to implement common behavior, instead of augmenting an existing object with independent functions (hash_reset etc.). Further, there seems to be quite a bit of confusion where HASH_SIZE and BLOCK_SIZE belong (hmac object itself, or its prototype).
It's pretty much impossible to describe the current codebase with *.d.ts files, exactly because Typescript was designed to prevent some techniques used in asmCrypto.
Last note, I noticed that the option heapSize is not passed from sha256_constructor (and others) to _heap_init.
If anyone finds themselves in the same situation, I've attached some simple typings I made. They show errors in Intellisense and some elements are "any" instead of typed objects but at least it compiles without warnings or errors.
simple_asmcrypto_types.zip
The text was updated successfully, but these errors were encountered: