mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-04-03 17:21:11 +00:00
14 lines
287 B
JavaScript
14 lines
287 B
JavaScript
|
'use strict'
|
||
|
|
||
|
const rsa = require('./keys/rsa')
|
||
|
|
||
|
function randomBytes (number) {
|
||
|
if (!number || typeof number !== 'number') {
|
||
|
throw new Error('first argument must be a Number bigger than 0')
|
||
|
}
|
||
|
|
||
|
return rsa.getRandomValues(new Uint8Array(number))
|
||
|
}
|
||
|
|
||
|
module.exports = randomBytes
|