@primeui/license-manager 1.0.0-rc.1 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -162
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,163 +1 @@
|
|
|
1
1
|
# @primeui/license-manager
|
|
2
|
-
|
|
3
|
-
Offline license verifier for PrimeUI and PrimeUI PRO. Framework-agnostic — no Vue / React / Angular / Lit peer dependencies.
|
|
4
|
-
|
|
5
|
-
License keys are configured **once** at app bootstrap into a process-global registry. Every PrimeUI library and PrimeUI PRO component then reads from the same registry — no `licenseKey` prop on individual components, no second installer to wrap.
|
|
6
|
-
|
|
7
|
-
## App authors
|
|
8
|
-
|
|
9
|
-
If you use a Prime UI library (PrimeVue, PrimeReact, PrimeNG, PrimeFaces), pass your PrimeUI license token through that library's existing installer as a single string — it forwards it into this registry for you. You don't import this package directly in that case.
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
// PrimeVue
|
|
13
|
-
app.use(PrimeVue, { theme: { ... }, license: 'PrimeUI-Commercial-key...' });
|
|
14
|
-
|
|
15
|
-
// PrimeReact
|
|
16
|
-
<PrimeReactProvider value={{ theme: { ... }, license: 'PrimeUI-Commercial-key...' }}>
|
|
17
|
-
|
|
18
|
-
// PrimeNG
|
|
19
|
-
providePrimeNG({ theme: { ... }, license: 'PrimeUI-Commercial-key...' });
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
A Commercial or OEM PrimeUI license covers every PRO component via the bundle rule, so this single string is enough for most apps.
|
|
23
|
-
|
|
24
|
-
If you're mixing standalone PRO buys, or using PRO components without a host Prime library, register the keys yourself before any licensed component mounts:
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
import { registerLicense } from '@primeui/license-manager';
|
|
28
|
-
|
|
29
|
-
registerLicense({
|
|
30
|
-
primeui: 'PrimeUI-Commercial-key...',
|
|
31
|
-
texteditor: 'PrimeUI-PRO-TextEditor-key...',
|
|
32
|
-
scheduler: 'PrimeUI-PRO-Scheduler-key...'
|
|
33
|
-
});
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Standalone PRO buyers configure the specific PRO key without a `primeui` key:
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
registerLicense({ texteditor: 'PrimeUI-PRO-TextEditor-key...' });
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## PrimeUI PRO component authors
|
|
43
|
-
|
|
44
|
-
Inside your component, call `verifyLicense()` at mount time and surface a watermark when invalid.
|
|
45
|
-
|
|
46
|
-
```ts
|
|
47
|
-
import { verifyLicense } from '@primeui/license-manager';
|
|
48
|
-
import { RELEASE_DATE } from './release-date';
|
|
49
|
-
|
|
50
|
-
onMounted(async () => {
|
|
51
|
-
const result = await verifyLicense('texteditor', { releaseDate: RELEASE_DATE });
|
|
52
|
-
if (!result.valid) console.warn(`[PrimeUI TextEditor] ${result.message}`);
|
|
53
|
-
licenseResult.value = result;
|
|
54
|
-
});
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Verification is async (Ed25519 via WebCrypto). Do it on client mount, not during SSR render — license status is a UI concern, not a server-render concern, and threading async work into SSR is fragile.
|
|
58
|
-
|
|
59
|
-
## Prime library authors (PrimeVue / PrimeReact / PrimeNG integration)
|
|
60
|
-
|
|
61
|
-
Add `license?: string` to your installer's config and forward it to `registerLicense({ primeui: ... })` from the install hook. The user passes one token; you wire it into the registry.
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
// Sketch — inside PrimeVue's install hook
|
|
65
|
-
import { registerLicense } from '@primeui/license-manager';
|
|
66
|
-
|
|
67
|
-
export const PrimeVue = {
|
|
68
|
-
install(app, options) {
|
|
69
|
-
if (options?.license) registerLicense({ primeui: options.license });
|
|
70
|
-
// ... rest of PrimeVue setup
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
For a host-scoped service (rather than the global registry), use `createLicenseService` directly:
|
|
76
|
-
|
|
77
|
-
```ts
|
|
78
|
-
import { createLicenseService } from '@primeui/license-manager';
|
|
79
|
-
|
|
80
|
-
const service = createLicenseService({ primeui: options.license });
|
|
81
|
-
// stash in PrimeVue's own provide/inject so consumers can read it via usePrimeVue().license
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## Short names → product identifiers
|
|
85
|
-
|
|
86
|
-
The `keys` object accepts these short names:
|
|
87
|
-
|
|
88
|
-
| Short name | Product identifier | Covers |
|
|
89
|
-
| ------------- | -------------------------- | -------------------------------------------- |
|
|
90
|
-
| `primeui` | `primeui` | PrimeNG / PrimeVue / PrimeReact / PrimeFaces |
|
|
91
|
-
| `texteditor` | `primeui-pro:text-editor` | PRO Text Editor |
|
|
92
|
-
| `scheduler` | `primeui-pro:scheduler` | PRO Scheduler |
|
|
93
|
-
| `charts` | `primeui-pro:charts` | PRO Charts |
|
|
94
|
-
| `diagram` | `primeui-pro:diagram` | PRO Diagram |
|
|
95
|
-
| `pdfviewer` | `primeui-pro:pdf-viewer` | PRO PDF Viewer |
|
|
96
|
-
| `taskboard` | `primeui-pro:task-board` | PRO Task Board |
|
|
97
|
-
| `datagrid` | `primeui-pro:datagrid` | PRO DataGrid |
|
|
98
|
-
| `ganttchart` | `primeui-pro:gantt-chart` | PRO Gantt |
|
|
99
|
-
| `filemanager` | `primeui-pro:file-manager` | PRO File Manager |
|
|
100
|
-
|
|
101
|
-
The registry first looks up the specific short name. If that key is missing (or returns `wrong-product`), it falls back to `keys.primeui` for any PRO component request. The verifier then accepts that token if its `tier` is `'commercial'`. Community PrimeUI tokens never validate PRO requests.
|
|
102
|
-
|
|
103
|
-
## License Tier + Type
|
|
104
|
-
|
|
105
|
-
Each signed `primeui` token carries two claims:
|
|
106
|
-
|
|
107
|
-
- `tier` — the SKU: `community` (free) or `commercial` (paid).
|
|
108
|
-
- `type` — the usage model: `dev` (standard) or `oem` (redistribution).
|
|
109
|
-
|
|
110
|
-
PRO tokens omit `tier` and carry `type: 'dev'` or `type: 'oem'`.
|
|
111
|
-
|
|
112
|
-
| Tier | Type | Behavior |
|
|
113
|
-
| ------------ | ----- | ------------------------------------------------------------------------------------------ |
|
|
114
|
-
| `community` | `dev` | Free, eligibility-gated. Annual re-confirmation. Time-bound (wall-clock grace). |
|
|
115
|
-
| `commercial` | `dev` | Paid perpetual. Library keeps working forever; only versions released after `exp` blocked. |
|
|
116
|
-
| `commercial` | `oem` | Paid annual redistribution license. Time-bound (wall-clock grace). |
|
|
117
|
-
|
|
118
|
-
Any token with `tier === 'commercial'` unlocks the PRO bundle rule. Community does not.
|
|
119
|
-
|
|
120
|
-
## Result
|
|
121
|
-
|
|
122
|
-
```ts
|
|
123
|
-
interface VerifyResult {
|
|
124
|
-
valid: boolean; // true when status is 'active' or 'grace'
|
|
125
|
-
status: 'active' | 'grace' | 'expired' | 'invalid' | 'wrong-product' | 'tampered' | 'unconfigured' | 'missing';
|
|
126
|
-
daysUntilExpiry?: number;
|
|
127
|
-
payload?: LicensePayload;
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
| status | meaning |
|
|
132
|
-
| --------------- | -------------------------------------------------------------------- |
|
|
133
|
-
| `active` | Verified, not yet expired |
|
|
134
|
-
| `grace` | Expired but within the 30-day grace period — library still works |
|
|
135
|
-
| `expired` | Past the grace period (or version released after `exp`) — red banner |
|
|
136
|
-
| `wrong-product` | Signed token doesn't cover the requested product |
|
|
137
|
-
| `tampered` | Signature check failed |
|
|
138
|
-
| `invalid` | Malformed token |
|
|
139
|
-
| `missing` | No key configured for this product (and no `primeui` fallback) |
|
|
140
|
-
| `unconfigured` | `registerLicense` was never called |
|
|
141
|
-
|
|
142
|
-
`grace` is a 30-day window after expiry — library remains functional, caller should surface a warning.
|
|
143
|
-
|
|
144
|
-
## SSR
|
|
145
|
-
|
|
146
|
-
Module-scoped state is the correct primitive for license keys (build-time config, not request-time). Under SSR:
|
|
147
|
-
|
|
148
|
-
- The host's installer re-runs per request and calls `registerLicense` again — idempotent with the same keys.
|
|
149
|
-
- PRO components defer the `verifyLicense` call to client-side mount (`onMounted` / `useEffect` / `ngOnInit`), not the SSR render pass. No watermark is rendered server-side; it appears after hydration if invalid.
|
|
150
|
-
|
|
151
|
-
## Low-level `verify()`
|
|
152
|
-
|
|
153
|
-
If you're verifying a single token without the registry:
|
|
154
|
-
|
|
155
|
-
```ts
|
|
156
|
-
import { verify } from '@primeui/license-manager';
|
|
157
|
-
|
|
158
|
-
const result = await verify(token, { product: 'primeui-pro:scheduler', releaseDate: '2026-04-23' });
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
## License
|
|
162
|
-
|
|
163
|
-
Licensed under the [PrimeUI License](https://primeui.dev/licenses) - Copyright (c) [PrimeTek Informatics](https://www.primetek.com.tr)
|