I try to generate an RSA key and since this takes some time I want to use multithread.js for the key generation.
My code:
<script src="../js/multithread.js"></script>
<script src="../js/crypto/cryptico.js"></script>
<script>
var keyPair;
var MT = new Multithread(2);
MT.process(
function () {
var bits = 4096;
return cryptico.generateRSAKey("passphrase", bits);
}, function (key) {
keyPair = key;
publicKey = cryptico.publicKeyString(keyPair);
}
)();
</script>
I get a
ReferenceError: cryptico is not defined
error.
I know that multithread.js doesn't have the same scope as the application. So how can I access the cryptico library or pass the scope to multithread.js?