Home
Wacom License Manager
This is a JWT (JSON Web Token) license validator based on WASM (WebAssembly) implementation.
The result of importing library is an async factory method which returns a LicenseManager module. The factory has one optional argument, settings. There are various settings related with the WASM module. Localisation of binary could be customized. Look for more details here: https://emscripten.org/docs/api\_reference/module.html#Module.locateFile
Usage
mjs env
import licenseManagerFactory from "@wacom/license-manager"let licenseManager = await licenseManagerFactory();await licenseManager.setLicense(jwtToken);
cjs env
const licenseManagerFactory = require("@wacom/license-manager");let licenseManager = await licenseManagerFactory();await licenseManager.setLicense(jwtToken);
classic js env
<script src="/node_modules/@wacom/license-manager/license-manager-min.js"></script>
let licenseManager = await licenseManagerFactory({ locateFile(path, scriptDirectory) { return `${scriptDirectory}${path}`; }});await licenseManager.setLicense(jwtToken);
LicenseManager module is a singleton, provides method setLicense and property version.
setLicense
could be called multiple times with different licenses.
Integration with webpack
webpack configuration should be updated. Note that some configurations targets webpac 4 only. Sample configuration targets config-overrides.js
const CopyPlugin = require("copy-webpack-plugin");module.exports = function override(config, env) { if (!config.eternals) { config.externals = []; } if (!config.plugins) { config.plugins = []; } config.externals = [...config.externals, "module", "crypto"]; // webpack 4.x (Copy wasm to project root, webpack 5.x can handle this by default) config.plugins.push( new CopyPlugin({ patterns: [ { from: "node_modules/@wacom/license-manager/*.wasm", to: "[name].[ext]" } ] }) );}