var
  q = require('q'),
  crypto = require('crypto');

module.exports = function PassportManager () {

  this.secret = 'jbsB8r69PFP39KdLtjVr25Z22';
  this.algo = 'sha1';
  this.digest = 'hex';

  this.encryptPassword = function(password) {
    var hashedPassword = crypto.createHmac(this.algo, this.secret).update(password).digest(this.digest);
    return q(hashedPassword);
  };

  this.checkPassword = function(password, hash) {
    return this.encryptPassword(password)
    .then(function(value) {
      return q(hash === value);
    });
  };

};
/****
First really simple version of Password Manager
@TODO :
- make secret, algo, digest variables configurable
- improve globally the manager to enable more features
*****/

var
  q = require('q'),
  crypto = require('crypto');

module.exports = function PassportManager () {

  this.secret = 'jbsB8r69PFP39KdLtjVr25Z22';
  this.algo = 'sha1';
  this.digest = 'hex';

  this.encryptPassword = function(password) {
    var hashedPassword = crypto.createHmac(this.algo, this.secret).update(password).digest(this.digest);
    return q(hashedPassword);
  };

  this.checkPassword = function(password, hash) {
    return this.encryptPassword(password)
    .then(function(value) {
      return q(hash === value);
    });
  };

};
add a TODO comment notice on PasswordManager (class to be improved)