lib/validator.js
function(token, address, cb){
      waterlock.Jwt.findOne({token: token}, function(err, j){
        if(err){
          return cb(err);
        }
        
        if(!j){
          waterlock.logger.debug('access token not found');
          return cb('Token not found');
        }

        if(j.revoked){
          waterlock.logger.debug('access token rejected, reason: REVOKED');
          return cb('This token has been revoked');
        }

        var use = {jsonWebToken: j.id, remoteAddress: address.ip};
        waterlock.Use.create(use).exec(function(){});

        cb(null);
      });
    }
function(token, address, cb){
      waterlock.Jwt.findOne({token: token}, function(err, j){
        if(err){
          return cb(err);
        }
        
        if(!j){
          waterlock.logger.debug('access token not found');
          return cb('Token not found');
        }

        if(j.revoked){
          waterlock.logger.debug('access token rejected, reason: REVOKED');
          return cb('This token has been revoked');
        }

        var use = {jsonWebToken: j.id, remoteAddress: address.ip};
        waterlock.Use.create(use).exec(function(){});

        cb(null);
      });
    }
function ( token , address , cb ) { waterlock . Jwt . findOne ( { token : token } , function ( err , j ) { if ( err ) { return cb ( err ) ; } if ( ! j ) { waterlock . logger . debug ( 'access token not found' ) ; return cb ( 'Token not found' ) ; } if ( j . revoked ) { waterlock . logger . debug ( 'access token rejected, reason: REVOKED' ) ; return cb ( 'This token has been revoked' ) ; } var use = { jsonWebToken : j . id , remoteAddress : address . ip } ; waterlock . Use . create ( use ) . exec ( function ( ) { } ) ; cb ( null ) ; } ) ; }
Finds the DAO instance of the give token and tracks the usage

@param  {String}   token   the raw token
@param  {Object}   address the transport address
@param  {Function} cb      Callback to be invoked when an error has
occured or the token was tracked successfully
Finds the DAO instance of the give token and tracks the usage