Permalink
Browse files

Don't use uuid, just use crypto

  • Loading branch information...
1 parent 18c9291 commit 8f0f794690ecb5019f568ca90d6d1d5a824d282d @isaacs isaacs committed Aug 19, 2012
Showing with 2 additions and 9 deletions.
  1. +2 −8 lib/adduser.js
  2. +0 −1 package.json
View
@@ -1,18 +1,12 @@
-
module.exports = adduser
-var uuid = require("node-uuid")
- , crypto
-
-try {
-} catch (ex) {}
+var crypto = require('crypto')
function sha (s) {
return crypto.createHash("sha1").update(s).digest("hex")
}
function adduser (username, password, email, cb) {
- if (!crypto) crypto = require("crypto")
password = ("" + (password || "")).trim()
if (!password) return cb(new Error("No password supplied."))
@@ -27,7 +21,7 @@ function adduser (username, password, email, cb) {
"Sorry, ':' chars are not allowed in passwords.\n"+
"See <https://issues.apache.org/jira/browse/COUCHDB-969> for why."))
- var salt = uuid()
+ var salt = crypto.randomBytes(30).toString('hex')
, userobj =
{ name : username
, salt : salt
View
@@ -11,7 +11,6 @@
"test": "tap test/*.js"
},
"dependencies": {
- "node-uuid": "~1.3.3",
"request": "~2.9.202",
"graceful-fs": "~1.1.8",
"semver": "~1.0.14",

0 comments on commit 8f0f794

Please sign in to comment.