npm.io
1.0.3 • Published yesterday

@qlibs/qsub

Licence
Version
1.0.3
Deps
0
Size
23 kB
Vulns
0
Weekly
0

sdk-node

Node/TypeScript SDK for subscription-service — import this into any Node or NestJS service that must stop working when its subscription lapses.

npm install @qlibs/qsub
@Module({
  imports: [LicenseModule.forRoot({ licenseKey, publicKeyBase64, cacheFilePath })],
  providers: [{ provide: APP_GUARD, useClass: LicenseGuard }],
})
export class AppModule {}

The verify URL (https://license.qode.biz.id/v1/verify) is hardcoded and not configurable via any option — a licensed application must not be able to redirect its own verification to a server it controls. (This repo's own demo-node still needs to point at a local backend/ during development — see ../demo-node/README.md for that procedure.)

cacheFilePath is optional — it defaults to ./qsub-license-cache.json (relative to the process's working directory). Pass an absolute path for anything beyond quick local testing.

LicenseClient and a plain Express-style .middleware()-less usage (call isActive() directly) also work for non-NestJS Node apps — see src/client.ts.

See ../demo-node for a runnable NestJS example and ../docs/api-contract.md for the wire format and decision rules this SDK implements (identically to ../sdk-go — see src/status.test.ts and ../docs/status-test-vectors.json).