Essentially, it installs the latest version (0.22.0) from NPM, and tries to generate a random number, in a number of ways, but things do not work as described in the documentation. The docs could be more clear about the requirements, and the status of getRandomValues
there is no random.getValues function I can discover
random.seed seems to exist but has no documentation of the argument requirements (type, length, etc.)
getRandomValues seems to exist, but is undocumented, and does not respect skipSystemRNGWarning
(See comments below.)
Hope this helps.
const asmCrypto = require('asmcrypto.js');
function trycatch(cb) {
try { return cb() } catch (e) { console.error("failed: " + e.message) };
}
const array = new Uint32Array(10);
trycatch(() => asmCrypto.random.getValues(array)); // getValues is not a function
trycatch(() => asmCrypto.getRandomValues(array)); // No strong PRNG available
asmCrypto.random.skipSystemRNGWarning = true;
trycatch(() => asmCrypto.getRandomValues(array)); // No strong PRNG available
asmCrypto.random.allowWeak = true;
trycatch(() => asmCrypto.getRandomValues(array)); // Succeeds, but still prints the warning
I'm using the library from node v8.11.0 / npm v5.8.0 on Ubuntu Linux 16.04.
I have a test case here: https://github.com/wu-lee/asmcrypto-test
Essentially, it installs the latest version (0.22.0) from NPM, and tries to generate a random number, in a number of ways, but things do not work as described in the documentation. The docs could be more clear about the requirements, and the status of
getRandomValues
random.getValues
function I can discoverrandom.seed
seems to exist but has no documentation of the argument requirements (type, length, etc.)getRandomValues
seems to exist, but is undocumented, and does not respectskipSystemRNGWarning
(See comments below.)
Hope this helps.