@birchui/license
Offline license key verification and activation.
Key exports: setLicenseKey, verifyLicenseKey, checkLicense, decodeLicenseKey, LicensePayload
Guides: Licensing and activation
@birchui/license#
checkLicensefunction#
function checkLicense(product: ProductId, options: { key?: string; host?: HTMLElement; publicKey?: Uint8Array } = {}): LicenseHandle| Parameter | Type | Description |
|---|---|---|
product | ProductId | — |
optionsoptional | { key?: string; host?: HTMLElement; publicKey?: Uint8Array } | — |
Defined in packages/license/src/check.ts:30
decodeLicenseKeyfunction#
function decodeLicenseKey(key: string): LicensePayload | null| Parameter | Type | Description |
|---|---|---|
key | string | — |
Defined in packages/license/src/payload.ts:89
getLicenseKeyfunction#
function getLicenseKey(): string | undefinedDefined in packages/license/src/key-store.ts:11
licenseCoversfunction#
function licenseCovers(payload: LicensePayload, product: ProductId): boolean| Parameter | Type | Description |
|---|---|---|
payload | LicensePayload | — |
product | ProductId | — |
Defined in packages/license/src/payload.ts:94
onLicenseKeyChangefunction#
function onLicenseKeyChange(listener: (key: string | undefined) => void): () => void| Parameter | Type | Description |
|---|---|---|
listener | (key: string | undefined) => void | — |
Defined in packages/license/src/key-store.ts:15
setLicenseKeyfunction#
function setLicenseKey(key: string | undefined): void| Parameter | Type | Description |
|---|---|---|
key | string | undefined | — |
Defined in packages/license/src/key-store.ts:4
verifyLicenseKeyfunction#
function verifyLicenseKey(key: string | undefined, product: ProductId, options: { publicKey?: Uint8Array; now?: Date } = {}): Promise<LicenseCheck>| Parameter | Type | Description |
|---|---|---|
key | string | undefined | — |
product | ProductId | — |
optionsoptional | { publicKey?: Uint8Array; now?: Date } | — |
Defined in packages/license/src/verify.ts:18
PRODUCT_NAMESconst#
const PRODUCT_NAMES: Record<ProductId, string>Defined in packages/license/src/types.ts:38
PURCHASE_URLconst#
const PURCHASE_URL: string = 'https://birchui.com/pricing'Defined in packages/license/src/types.ts:53
LicenseCheckinterface#
interface LicenseCheck| Property | Type | Description |
|---|---|---|
status | LicenseStatus | — |
product | ProductId | — |
licenseoptional | LicensePayload | — |
message | string | — |
Defined in packages/license/src/types.ts:31
LicenseHandleinterface#
interface LicenseHandle| Property | Type | Description |
|---|---|---|
readyreadonly | Promise<LicenseCheck> | — |
currentreadonly | LicenseCheck | undefined | — |
dispose() | () => void | — |
Defined in packages/license/src/check.ts:7
LicensePayloadinterface#
interface LicensePayload| Property | Type | Description |
|---|---|---|
v | 1 | — |
id | string | — |
to | string | — |
emailoptional | string | — |
products | (ProductId | '*')[] | — |
seats | number | — |
tier | LicenseTier | — |
iat | string | — |
expoptional | string | — |
Defined in packages/license/src/types.ts:17
LicenseStatustype#
type LicenseStatus = 'valid' | 'missing' | 'malformed' | 'bad-signature' | 'expired' | 'wrong-product';Defined in packages/license/src/types.ts:29
LicenseTiertype#
type LicenseTier = 'developer' | 'team' | 'company' | 'oem' | 'trial';Defined in packages/license/src/types.ts:15
ProductIdtype#
type ProductId =
| 'grid-pro'
| 'excel'
| 'scheduler'
| 'gantt'
| 'calendar'
| 'charts'
| 'pivot-studio'
| 'forms'
| 'diagram'
| 'spreadsheet'
| 'pdf'
| 'document';Defined in packages/license/src/types.ts:1
@birchui/license/sign#
generateSigningKeyPairfunction#
function generateSigningKeyPair(): { privateKeyPem: string; publicKeyRaw: Uint8Array }Defined in packages/license/src/sign.ts:32
newLicenseIdfunction#
function newLicenseId(): stringDefined in packages/license/src/sign.ts:40
signLicensefunction#
function signLicense(payload: Omit<LicensePayload, 'v'> & { v?: 1 }, privateKeyPem: string): string| Parameter | Type | Description |
|---|---|---|
payload | Omit<LicensePayload, 'v'> & { v?: 1 } | — |
privateKeyPem | string | — |
Defined in packages/license/src/sign.ts:16