The Libmon Library (currently only for node.js packages) handles library validation and usage limits.
Unfortunately, the library does not work without make a call to the internet.
Set-Up
The Libmon package exposes a few methods to set usage limits and generate artificial crashes.
npm install libmon --save
Libmon methods will only work if a user’s token is invalid to meet demo methods.
Usage
Setup counters and artificially disable programs if a token is not valid. If a token is valid, Libmon methods will not crash a program.
const { Libmon } = require("libmon")
class MyCalculatorLibrary(){
constructor(){
Libmon.intialize("my-calculator-package")
// check if the token is valid. Makes internet call
Libmon.validate("TOKEN HERE");
// create counter with a max of 10 calls
Libmon.setupCounter("number-of-prime-calls", 10)
}
function myPaidMethod() {
// artificially crash the program if token is invalid
Libmon.disableFunction();
return "hello world"
}
function getPrimeNumber() {
// increment the counter
// throw an error if called > 10 times
Libmon.increment("number-of-prime-calls")
return 3
}
}
Tolerance
Our intention is to make programs a little more inconvenient without a valid token rather than create strict payment models.
The consumer of a library and purchaser of a token always has benefit of the doubt.
- If there is no internet, validation will always pass.
- If the libmon server is down, validation will always pass