Web SDKv1.0.0

Kernstra.setLicense()

Replaces the license at runtime; resolves to the new license state. A setLicense is a load: the licensing API confirms the token's status, and a license that does not load (revoked, paused, expired, a copied token, a host it does not name, a malformed or forged key) shows the "license required" popup — signing out with '' stops nothing that is open. Presenting the same key again changes neither a pause nor a revocation.

A verdict that adds rights reaches open documents at once; a viewer whose document's rights grow rebuilds its toolbar. A verdict that takes rights away reaches only the next load: each document keeps the rights it was opened with until it is closed.

static methodLicensesince 1.0.0

Signature

static setLicense(token: string): Promise<LicenseState>

Parameters

ParameterTypeDescription
tokenstringThe new license token. '' signs out: it forgets the cached token, but not a stop — only a license that loads lifts a pause or a revocation.

Returns

Promise<LicenseState> Resolves to the new license state.

Example

TypeScript
const state = await Kernstra.setLicense(newToken);
if (state.valid && state.features.includes('export')) enableDownload();

More in Kernstra