import type { EntitlementKeyData, ProductEntitlement } from './types'; /** * Brings the human-readable text of a key to the form the key protects. * * Only the whitespace, its escaped forms, and the Unicode composition are * ignored. A mail client that rewraps the text (also between two CJK * characters or inside a word) or collapses a blank line, a `.env` file that * saves a line break as `\n`, or a system that stores "u" + U+0308 instead of * U+00FC leaves the key valid. A changed, added, or removed letter, digit, or * symbol does not. * Exported for the test key builder; the library calls `extractEntitlementKeyData`. * * @param {string} prose The text in front of the machine-readable block. * @returns {string} */ export declare function canonicalizeProse(prose: string): string; /** * Computes the checksum that closes the block. It must match the canonical * reader in every key format, so Handsontable 18.1 keeps reading newer keys. * Exported for the test key builder. * * @param {string} encodedPayload The encoded payload. * @returns {string} */ export declare function computePayloadChecksum(encodedPayload: string): string; /** * Computes the value a current key stores for its text. Exported for the test * key builder. * * @param {string} canonicalProse The text, already passed through `canonicalizeProse`. * @returns {string} */ export declare function computeProseDigest(canonicalProse: string): string; /** * Adds an own, ordinary property. * * Both the product names and the field names of a product entry come from * JSON, so "__proto__" is a name an attacker can put in a key. A plain * assignment would go through the `Object.prototype` setter: the value would * vanish from `Object.keys` while still resolving through the chain. Exported * because every payload-keyed write in this module must use it - `grants.ts` * re-keys the same product names. * * @param {object} target The object to add the property to. * @param {string} key The property name. * @param {*} value The property value. * @returns {void} */ export declare function defineOwn(target: object, key: string, value: unknown): void; /** * Extracts the machine-readable data from an entitlement license key. * * The key is verified first, so the returned data is guaranteed to belong to * an intact key. A malformed or tampered key reads as `null` - reporting an * invalid key is the caller's job, not this function's. * * A current key protects its text as well: edited or removed text (the bare * `[...]` block), or anything but whitespace after the block, reads as `null`. * A key in the earlier format reads the way Handsontable 18.1 reads it. The * verification rules are those of the canonical reader in the private * `license-key` repository. * * The caller passes the whole key. The text is never parsed, and its * whitespace and Unicode composition are ignored, so rewrapped or re-pasted * text still validates. Whitespace inside the block is ignored too, so a * block wrapped by a mail client still validates. * * Unknown products, capability tokens and flags are all tolerated, so nothing * about reading a key depends on the commercial vocabulary. * * The result is frozen. Copy an array before sorting or changing it. * * @param {string} licenseKey The license key to extract the data from. * @returns {EntitlementKeyData|null} */ export declare function extractEntitlementKeyData(licenseKey: string): EntitlementKeyData | null; /** * Returns the entitlement of one product, but only when it is present as an own * property. Used by the lifecycle and grants layers to read one product without * trusting the prototype chain. * * @param {EntitlementKeyData} keyData The verified key data. * @param {string} productName The product to read. * @returns {ProductEntitlement|null} */ export declare function getProductEntitlement(keyData: EntitlementKeyData, productName: string): ProductEntitlement | null;