Skip to content

raikasdev/rlicense

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NPM
NPM
NPM

rLicense

Easy to use licensing system with encryption to keep your data secret

Using built-in Rest API (Express)

var rLicense = require("rlicense");

var system = rLicense("SecretTokenHere");
system.listen(process.env.PORT)

Requests:

To create a license, send a POST request to url/api/new/
Body Example: {"product":"example"}
Response Example: {"token":"token","product":"product"}
Required Bearer Token. The token is the "SecretTokenHere"\

To revoke a license, send a POST request to url/api/revoke
Body Example: {"token":"token"}
Response Example: {"success":true}
Required Bearer Token. The token is the "SecretTokenHere"\

To verify a license, send a POST request to url/api/validate
Body Example: {"token":"token","product":"product"}
Response Example: {"valid":true}\

To create new api license, send a POST request to url/api/new/SecretTokenHere/ProductNameHere To revoke a license, send a POST request to url/api/revoke/SecretTokenHere/TokenHere To verify send a GET request to url/validate/ProductNameHere/TokenHere

Using the Node API

var rLicense = require("rlicense");
var system = rLicense("SecretTokenHere");

// Validate token by product (If "product" is not provided, it will be using "default" product)
var token = "tokenHere"
console.log("Is token valid: " + system.validate(token, product));

// Create a new token for product (If "product" is not provided, it will be using "default" product)
var tokenData = system.createToken("productName");
var newToken = tokenData.token;
console.log("Data: " + tokenData)
console.log("Token: " + newToken);

// To revoke tokens
var successRevoke = sytem.revoke(newToken);
console.log("Tried revoking token \""+newToken+"\", success: " + successRevoke)

Simple as that, you got a system running.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages