0% found this document useful (0 votes)
475 views2 pages

License Manager Domain

This document defines functions for validating a license key for a software product. It registers a "LicenseManager" domain and "validate" command that takes a public key, name, product, and license key as parameters and returns an object with validation results. The init function registers the domain and command if not already registered.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
475 views2 pages

License Manager Domain

This document defines functions for validating a license key for a software product. It registers a "LicenseManager" domain and "validate" command that takes a public key, name, product, and license key as parameters and returns an object with validation results. The init function registers the domain and command if not already registered.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

/**

* File name: LicenseManagerDomain.js


* Mac OS: /Applications/StarUML.app/Contents/www/license/node/
* Linux: /opt/staruml/www/license/node/
*/

(function () {
"use strict";

var NodeRSA = require('node-rsa');

function validate(PK, name, product, licenseKey) {


return{
name: "Rizqi",
product: "StarUML",
licenseType: "vip",
quantity: "unlimited",
licenseKey: "12345678"
};
}

function init(domainManager) {
if (!domainManager.hasDomain("LicenseManager")) {
domainManager.registerDomain("LicenseManager", {major: 0, minor: 1});
}
domainManager.registerCommand(
"LicenseManager", // domain name
"validate", // command name
validate, // command handler function
false, // this command is synchronous in Node ("false" means
synchronous")
"Validate License",
[
{
name: "PK",
type: "string",
description: "PK"
},
{
name: "name",
type: "string",
description: "name of license owner"
},
{
name: "product",
type: "string",
description: "product name"
},
{
name: "licenseKey",
type: "string",
description: "license key"
}
],
[
{
name: "result", // return values
type: "object",
description: "result"
}
]
);
}

exports.init = init;

}());

You might also like