Sha256: 985692d83e2dceff83f3a7e584fa6e188ac47bcd0556d4509d0ed63b76d6e3f2

Contents?: true

Size: 1012 Bytes

Versions: 10

Compression:

Stored size: 1012 Bytes

Contents

try {
    this['Module'] = Module;
    Module.test;
} catch(e) {
    this['Module'] = Module = {};
}
Module['preRun'] = Module['preRun'] || [];
Module['preRun'].push(function(){
    var randombyte = null;    
    try {
        function randombyte_standard() {
            var buf = new Int8Array(1);            
            window.crypto.getRandomValues(buf);
            return buf[0];
        }
        randombyte_standard();
        randombyte = randombyte_standard;
    } catch (e) {
        try {
            var crypto = require('crypto');
            function randombyte_node() {
                return crypto.randomBytes(1)[0];
            }
            randombyte_node();
            randombyte = randombyte_node;
        } catch(e) { }
    }
    FS.init();
    var devFolder = FS.findObject('/dev') ||
        Module['FS_createFolder']('/', 'dev', true, true);    
    Module['FS_createDevice'](devFolder, 'random', randombyte);
    Module['FS_createDevice'](devFolder, 'urandom', randombyte);    
});

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rbnacl-libsodium-1.0.1 vendor/libsodium/test/default/pre.js
rbnacl-libsodium-1.0.0 vendor/libsodium/test/default/pre.js
rbnacl-libsodium-0.7.0 vendor/libsodium/test/default/pre.js
rbnacl-libsodium-0.6.1 vendor/libsodium/test/default/pre.js
rbnacl-libsodium-0.6.0 vendor/libsodium/test/default/pre.js
rbnacl-libsodium-0.5.0.1 vendor/libsodium/test/default/pre.js
rbnacl-libsodium-0.5.0.1.pre vendor/libsodium/test/default/pre.js
rbnacl-libsodium-0.5.0 vendor/libsodium/test/default/pre.js
rbnacl-libsodium-0.4.5 vendor/libsodium/test/default/pre.js
rbnacl-libsodium-0.4.5a vendor/libsodium/test/default/pre.js