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]
prod
a product id to generate license fortype
a license typename
a ‘licensed to’ namestart
start date in form ‘yyyy-mm-dd’, now if omitteddur
license duration including years, months, and/or days, like: ‘1m15d’, or ‘1y6m’; empty means infinite licenseThis command shows info about a license:
keyengine info -file=license.lic
keyengine info -lic=eyJs...9fQ==
file
a name of file containing license textlic
a license textThis command runs the built-in HTTP server, you may use it as follows:
keyengine daemon
keyengine has a built-in HTTP server and it is ready to be run as a linux service. The HTTP service processes 2 queries:
/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.
Content-type: application/json
Authorization: Secret <secret>
where <secret>
is secret
token from keyengine.json
,
[ { "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" } ]
articles
[mandatory]
name
is product id the license is generated for, used to be checked in licensed stuff to check if the license permits using a particular programpayload
any user data associated with the license. You may use it to create a kind of limited licenses or solicensedto
[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
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
{ "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
/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:
http://<license.server>/v1/get/token
For token == bc7f80c1-46b5-11e9-a11c-f430b9a6e499
it should be http://<license.server>/v1/get/bc7f80c1-46b5-11e9-a11c-f430b9a6e499
.
As token has the same value for all licenses in a single request, this way you retrieve all licenses for the request.
http://<license.server>/v1/get/hash:token
For hash == a7873a910691c2594117998bdad3a9cf
and token == bc7f80c1-46b5-11e9-a11c-f430b9a6e499
it should be http://<license.server>/v1/get/a7873a910691c2594117998bdad3a9cf:bc7f80c1-46b5-11e9-a11c-f430b9a6e499
.
It retrieves a single license (but the reply still returns a JSIN array).
Reply of this query is the same as for the previous query.
/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).
Content-type: application/x-www-form-urlencoded
Authorization: Secret <secret>
where <secret>
is secret
value from keyengine.json
,
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
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
{ "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
/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 of this query is the same as for the previous query.