diff --git a/idgen/random.js b/idgen/random.js index 5a30c2e..e47b869 100644 --- a/idgen/random.js +++ b/idgen/random.js @@ -1,2 +1,2 @@ -//const { cryptoRandomString } = require('crypto-random-string'); -//module.exports = (length) => cryptoRandomString({ length, type: 'alphanumeric' }); +const cryptoRandomString = require('crypto-random-string'); +module.exports = (length) => cryptoRandomString({ length, type: 'alphanumeric' }); diff --git a/utils.js b/utils.js index 4fe2a3b..182038d 100755 --- a/utils.js +++ b/utils.js @@ -1,7 +1,7 @@ const fs = require('fs-extra'); const Path = require('path'); const zwsGen = require('./idgen/zws'); -//const randomGen = require('./idgen/random'); +const randomGen = require('./idgen/random'); const idModes = { zws: 'zws', // Zero-width spaces (see: https://zws.im/) @@ -16,6 +16,6 @@ module.exports = { verify: (req, tokens) => req.headers.authorization && tokens.includes(req.headers.authorization), generateId: (mode, lenth, originalName) => (mode == idModes.zws) ? zwsGen(lenth) - : (mode == idModes.r) ? zwsGen(lenth)//randomGen(lenth) + : (mode == idModes.r) ? randomGen(lenth) : originalName } \ No newline at end of file