{"size": 586, "ext": "js", "max_stars_repo_path": "index.js", "max_stars_repo_name": "xelita/node-jwt", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "index.js", "max_issues_repo_name": "xelita/node-jwt", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "index.js", "max_forks_repo_name": "xelita/node-jwt", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.2068965517, "max_line_length": 61, "alphanum_fraction": 0.662116041}
var uuid = require('node-uuid');
var nJwt = require('njwt');

// Signing key
var signingKey = uuid.v4();
console.log('signingKey: ' + signingKey);

// Claims
var claims = {
  sub: '123456789',
  iss: 'JWTGEN',
  permissions: 'lrm-access'
}

// Token generation
var token = nJwt.create(claims, signingKey);
token.setExpiration(new Date().getTime() + (60 * 60 * 1000));
token = token.compact()
console.log('JWT: ' + token)

// Token verification
nJwt.verify(token, signingKey, function(err, verifiedJwt) {
  if(err){
    console.error(err);
  }else{
    console.log(verifiedJwt);
  }
});
