mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-09 07:21:21 +00:00
19 lines
276 B
JavaScript
19 lines
276 B
JavaScript
'use strict'
|
|
|
|
const crypto = require('libp2p-crypto')
|
|
const constants = require('./constants')
|
|
|
|
/**
|
|
* @param {number} length
|
|
*/
|
|
function rnd (length) {
|
|
if (!length) {
|
|
length = constants.PING_LENGTH
|
|
}
|
|
return crypto.randomBytes(length)
|
|
}
|
|
|
|
module.exports = {
|
|
rnd
|
|
}
|