package
Synchronous randombytes function that works in node, the browser & react-native!
npm install @consento/sync-randombytesGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 5 packages.
890.2 kB
Includes dependencies.
sync-randombytes is a polyfill for crypto.randomBytes that works in node, browsers, react-native
(with support for versions < 0.60) and expo.
npm i sync-randombytes --save
You can use it like an other randomBytes function by calling:
const randomBytes = require('sync-randombytes')
const randomUint8Array = randomBytes(new Uint8Array(16))react-native-randombytes as it's dependencies try to require('crypto') - which is not available in react-native.window.crypto.getRandomBytes if available.crypo.randomFill - or a polyfill that implements it using crypto.randomBytes for node < 6.13seedrandom
with some source code adopted from react-native-randombytes
dkastl
daniel@georepublic.de