[Pkg-javascript-commits] [node-keygrip] 64/68: debug decrypt errors

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Fri Jun 27 22:13:29 UTC 2014


This is an automated email from the git hooks/post-receive script.

andrewrk-guest pushed a commit to branch master
in repository node-keygrip.

commit 8e67095f524c7211c9a159c107e48797066342f0
Author: Jonathan Ong <jonathanrichardong at gmail.com>
Date:   Wed Jun 18 19:43:54 2014 -0700

    debug decrypt errors
---
 index.js     | 6 +++---
 package.json | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/index.js b/index.js
index a90b0d6..e122d8d 100644
--- a/index.js
+++ b/index.js
@@ -1,6 +1,7 @@
 
 var crypto = require("crypto")
 var constantTimeCompare = require('scmp')
+var debug = require('debug')('keygrip')
 
 module.exports = Keygrip
 
@@ -60,7 +61,6 @@ Keygrip.prototype.encrypt = function Keygrip$_encrypt(data, iv, key) {
     ? crypto.createCipheriv(this.cipher, key, iv)
     : crypto.createCipher(this.cipher, key)
   return Buffer.concat([cipher.update(data), cipher.final()])
-  return cipher.final()
 }
 
 // decrypt a single message
@@ -83,8 +83,8 @@ Keygrip.prototype.decrypt = function Keygrip$__decrypt(data, iv, key) {
       : crypto.createDecipher(this.cipher, key)
     return Buffer.concat([cipher.update(data), cipher.final()])
   } catch (err) {
-    if (/bad decrypt/.test(err.message)) return false
-    throw err
+    debug(err.stack)
+    return false
   }
 }
 
diff --git a/package.json b/package.json
index 90c5870..fddd369 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,7 @@
   },
   "repository": "expressjs/keygrip",
   "dependencies": {
+    "debug": "*",
     "scmp": "0.0.3"
   },
   "devDependencies": {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-keygrip.git



More information about the Pkg-javascript-commits mailing list