docs: function findByCredentials(username, password, cb) {
    crypto.encode(password, function(err, encoded) {
      if(err) { return cb(err); }
  
      db.getClient(function(err, client, done) {
        client.query(SELECT_CREDENTIALS, [username, encoded], function(err, r) {
          var result = r && r.rows[0];
          if(!err && !result) { err = new exceptions.AuthenticationFailed(); }
          if(err) {
            cb(err);
            done(err);
          } else {
            cb(null, result);
            done();
          }
        });
      });
    });
  }