js-scrypt
js-scrypt copied to clipboard
Is there a way of making scrypt_module_factory synchronous?
It would be very useful to make scrypt_module_factory
(and thus all the code you need to call scrypt
) synchronous - is there a way of doing this?
There is, but I'm extremely hesitant to introduce it. Previously, the library was synchronous in this way, but emscripten's compilation model changed unexpectedly: with the introduction of the static memory initializer file, use of an asynchronous factory became mandatory. I've since backed off from using the static initializer file, so synchronous setup is once again a possibility, but this could change with future changes to emscripten. Since asynchronous is the more general of the two, I think I'll stick with that.
Would it work for you to do something like
var scrypt = null;
scrypt_module_factory(function (s) { scrypt = s; });
...
?
(Of course, there are complications around waiting for the scrypt
variable to become non-null, etc. etc.)