mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-03 17:34:00 +00:00
Use crypto module for token generation
This commit is contained in:
parent
22c5f41fb6
commit
6feedf5520
1 changed files with 3 additions and 3 deletions
|
@ -1,12 +1,12 @@
|
|||
crypto = require 'crypto'
|
||||
|
||||
module.exports = ProjectTokenGenerator =
|
||||
|
||||
readOnlyToken: () ->
|
||||
length = 12
|
||||
tokenAlpha = 'bcdfghjkmnpqrstvwxyz'
|
||||
result = ''
|
||||
for _n in [1..length]
|
||||
i = Math.floor(Math.floor(Math.random() * tokenAlpha.length))
|
||||
result += tokenAlpha[i]
|
||||
crypto.randomBytes(length).map( (a) -> result += tokenAlpha[a % tokenAlpha.length] )
|
||||
return result
|
||||
|
||||
readAndWriteToken: () ->
|
||||
|
|
Loading…
Reference in a new issue