Skip to content

claydotio/clay-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

clay-encryption

JWT(JSON Web Token) encode and decode module for node.js.

Piggybacks off of the jwt-simple

Install

$ npm install clay-encryption

Usage

var Clay = require('clay-encryption');

// Your clay.io secret key
var secretKey = 'SECRET_KEY';

// The player's unique identifier (received from client js - Clay.player.identifier)
var userIdentifier = 'SOME_ID';

// Create object and store user identifier/secret key
var clay = new Clay( userIdentifier, secretKey );

// Example options for an achievment
var options = { id: 3 };

// encode
var token = clay.encode( options );

// Send token as part of options, so client-side: 
// achievement = new Clay.achievement( { jwt: tokenFromServer } );
// achievement.award();

About

Backend encryption for the clay.io API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published