keyengine

standalone easy-to-plug license issuer

Purchase a license

« To main page

Usage

Command line

gen

This command runs command line license generator, you may use it as follows:

keyengine gen -prod=PRODID -type=personal -name="Johnny Walker" [-start=2019-01-01] [-dur=1y]

info

This command shows info about a license:

keyengine info -file=license.lic

keyengine info -lic=eyJs...9fQ==

daemon

This command runs the built-in HTTP server, you may use it as follows:

keyengine daemon

HTTP API

keyengine has a built-in HTTP server and it is ready to be run as a linux service. The HTTP service processes 2 queries:

API v1

1. POST query to /v1/issue/

The issue query is usually called from a successful payment page. Querying it you should specify licensing product info and, optionally, payer info (for informational purposes). Unlike (API v0)[#older-api-v0] you can pass license requests for several licenses at a time.

Headers
Content-type: application/json
Authorization: Secret <secret>

where <secret> is secret token from keyengine.json,

Payload
[
    {
		"articles":[{"name":"XXX1", "payload":{"k1":"v1", "k2":"v2"}},{"name":"XXX2", "payload":"v10"}],
		"licensedto":"Jim Beam",
		"lictype":"personal",
		"test": false,
		"productName":"Xtra xtreme xter v1 and v2",
		"licduration":"1y2m3d",
		"name":"John Doe",
		"addrLine1":"123 Test St",
		"city":"Columbus",
		"state":"OH",
		"zipCode":"43123",
		"country":"USA",
		"email":"example@example.com",
		"phoneNumber":"5555555555"
	},
    {
		"articles":[{"name":"YYY1"}],
		"licensedto":"Johnny Walker",
		"lictype":"personal"
    }
]
Variables encoded into license

articles [mandatory]

licensedto [mandatory] personal or company name the product is licensed to

lictype [mandatory] license type: personal, enterprise, or whatever you want, any text string.

licduration license duration including years, months, and/or days, like: 1m15d, or 1y6m; empty means infinite license

test true/false, for test purposes: 1) test flag is stored to DB, 2) productId written to license is actually productId-test, just to avoid redundant checks

Variables only stored to DB

productName product name, informational field

name payer’s name, informational field

addrLine1 payer’s address, informational field

city payer’s city, informational field

state payer’s state, informational field

zipCode payer’s zip code, informational field

country payer’s country, informational field

email payer’s email, informational field

phoneNumber payer’s phone number, informational field

Reply
{
  "ok":true,
  "licenses":[
    {
      "token":"f7e32707-8fe9-11ea-b33a-f430b9a6e499",
      "hash":"9d8fe1a9fce360928d2fb1cae48b5446772cc74f",
      "productid":"XXX1,XXX2",
      "productname":"Xtra xtreme xter v1 and v2",
      "licensedto":"Jim Beam",
      "lictype":"personal",
      "license":"eyJs..fX0="
    },
    {
      "token":"f7e32707-8fe9-11ea-b33a-f430b9a6e499",
      "hash":"6772cc74f9d8fe1a9fce360928d2fb1cae48b544",
      "productid":"YYY1",
      "productname":"",
      "licensedto":"Johnny Walker",
      "lictype":"personal",
      "license":"eyJs..fX0="
    }
  ]
}

token a license record token (should be used in license query to retrieve license). It has the same value for all licenses in the request

hash a license record hash (should be used in license query to retrieve license)

productid comma-separated article name list

productname product name field from request

licensedto licensed to field from request

lictype a license type field from request

license a license itself

2. GET query to /v1/get/

get query is used to retrieve a previously generated license (for example, you may send a link in email to a user). It has 2 versions as follows:

Reply

Reply of this query is the same as for the previous query.

Older API v0

1. POST query to /upload/

The upload query is usually called from a successful payment page. Querying it you should specify licensing product info and, optionally, payer info (for informational purposes).

Headers
Content-type: application/x-www-form-urlencoded
Authorization: Secret <secret>

where <secret> is secret value from keyengine.json,

Variables encoded into license

productId [mandatory] product id the license is generated for, used to be checked in licensed stuff to check if the license permits using a particular program

licensedto [mandatory] personal or company name the product is licensed to

lictype [mandatory] license type: personal, enterprise, or whatever you want, any text string

licduration license duration including years, months, and/or days, like: 1m15d, or 1y6m; empty means infinite license

test true/false, for test purposes: 1) test flag is stored to DB, 2) productId written to license is actually productId-test, just to avoid redundant checks

Variables only stored to DB

productName product name, informational field

name payer’s name, informational field

addrLine1 payer’s address, informational field

city payer’s city, informational field

state payer’s state, informational field

zipCode payer’s zip code, informational field

country payer’s country, informational field

email payer’s email, informational field

phoneNumber payer’s phone number, informational field

Reply
{
  "ok":true,
  "token":"bc7f80c1-46b5-11e9-a11c-f430b9a6e499",
  "hash":"a7873a910691c2594117998bdad3a9cf",
  "license":"eyJs...9fQ=="
}

token a license record token (should be used in license query to retrieve license)

hash a license record hash (should be used in license query to retrieve license)

license a license itself

2. GET query to /license/

license query is used to retrieve a previously generated license (for example, you may send a link in email to a user). It is built by template as follows: http://<license.server>/license/hash-token. For hash == a7873a910691c2594117998bdad3a9cf and token == bc7f80c1-46b5-11e9-a11c-f430b9a6e499 from the previous query example it should be http://<license.server>/license/a7873a910691c2594117998bdad3a9cf-bc7f80c1-46b5-11e9-a11c-f430b9a6e499.

Reply

Reply of this query is the same as for the previous query.

« To main page