@richhtmleditor/enterprise 1.1.0 → 1.1.1
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 +134 -134
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,134 +1,134 @@
|
|
|
1
|
-
# @richhtmleditor/enterprise
|
|
2
|
-
|
|
3
|
-
Licence verification and feature gating for self-hosted Rich HTML Editor deployments. Resolves signed `DE1.*` tokens and predefined demo keys into [`@richhtmleditor/core`](https://www.npmjs.com/package/@richhtmleditor/core) `EditorFeatureFlags` for AI, comments, workflows, and the full toolbar preset.
|
|
4
|
-
|
|
5
|
-
**Current release: 1.
|
|
6
|
-
|
|
7
|
-
**Repository:** [github.com/rajkishorsahu89/richhtmleditor](https://github.com/rajkishorsahu89/richhtmleditor)
|
|
8
|
-
|
|
9
|
-
**Demo:** [richhtmleditor.vercel.app](https://richhtmleditor.vercel.app/) — [demo](https://richhtmleditor.vercel.app/demo) · [guide](https://richhtmleditor.vercel.app/guide) · [API](https://richhtmleditor.vercel.app/api). Doc Preview joint demo: [doc-preview-app.vercel.app/demo/enterprise](https://doc-preview-app.vercel.app/demo/enterprise)
|
|
10
|
-
|
|
11
|
-
### What's in 1.
|
|
12
|
-
|
|
13
|
-
- **`resolveEnterpriseFeatures`** — verify signed tokens or predefined demo keys; returns `EditorFeatureFlags`
|
|
14
|
-
- **Predefined demo keys** — `RHE-ENT-DEMO-2026-FULL`, `RHE-ENT-DEMO-2026-COMMENTS` (see `predefined-licenses.json`)
|
|
15
|
-
- **Signed tokens** — `DE1.<base64url(payload)>.<hmac-sha256>` minted with `createEnterpriseLicenceToken`
|
|
16
|
-
- **`@richhtmleditor/enterprise/browser`** — browser-safe entry (predefined keys only, no `process.env`)
|
|
17
|
-
- **Online verification** — `resolveEnterpriseFeaturesOnline` for remote licence checks
|
|
18
|
-
|
|
19
|
-
> Use the main export on your server (Node) with `DE_LICENCE_SECRET`. Use `/browser` in client bundles for demo keys only.
|
|
20
|
-
|
|
21
|
-
**Keywords:** `richhtmleditor` `enterprise` `licence` `feature-flags` `licensing`
|
|
22
|
-
|
|
23
|
-
## Install
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
npm install @richhtmleditor/enterprise
|
|
27
|
-
# Requires @richhtmleditor/core (pulled in by framework wrappers).
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Usage — server-side verification
|
|
31
|
-
|
|
32
|
-
```ts
|
|
33
|
-
import { createEditor } from "@richhtmleditor/core";
|
|
34
|
-
import { resolveEnterpriseFeatures } from "@richhtmleditor/enterprise";
|
|
35
|
-
|
|
36
|
-
const gate = resolveEnterpriseFeatures(
|
|
37
|
-
{ token: process.env.DE_LICENCE! },
|
|
38
|
-
{ secret: process.env.DE_LICENCE_SECRET! }
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const editor = createEditor({
|
|
42
|
-
element: host,
|
|
43
|
-
features: gate.features,
|
|
44
|
-
toolbar: gate.features.toolbarFull ? { preset: "full" } : { preset: "standard" }
|
|
45
|
-
});
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## Usage — browser (demo keys)
|
|
49
|
-
|
|
50
|
-
```ts
|
|
51
|
-
import { resolveEnterpriseFeatures } from "@richhtmleditor/enterprise/browser";
|
|
52
|
-
|
|
53
|
-
const gate = resolveEnterpriseFeatures({ token: "RHE-ENT-DEMO-2026-FULL" });
|
|
54
|
-
// gate.valid === true
|
|
55
|
-
// gate.features — { ai: true, comments: true, workflows: true, toolbarFull: true, … }
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Usage — mint signed tokens
|
|
59
|
-
|
|
60
|
-
```ts
|
|
61
|
-
import { createEnterpriseLicenceToken } from "@richhtmleditor/enterprise";
|
|
62
|
-
|
|
63
|
-
const token = createEnterpriseLicenceToken(
|
|
64
|
-
{
|
|
65
|
-
sub: "acme-corp",
|
|
66
|
-
exp: Math.floor(Date.now() / 1000) + 86400,
|
|
67
|
-
features: { ai: true, comments: true, workflows: true, toolbarFull: true }
|
|
68
|
-
},
|
|
69
|
-
process.env.DE_LICENCE_SECRET!
|
|
70
|
-
);
|
|
71
|
-
// Returns "DE1.<payload>.<signature>"
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Set `DE_LICENCE_SECRET` in your deployment environment. Payload `exp` is a Unix timestamp (seconds).
|
|
75
|
-
|
|
76
|
-
## Token formats
|
|
77
|
-
|
|
78
|
-
| Format | Example | Where verified |
|
|
79
|
-
| --- | --- | --- |
|
|
80
|
-
| Predefined demo key | `RHE-ENT-DEMO-2026-FULL` | Server or `/browser` |
|
|
81
|
-
| Signed token | `DE1.eyJ…}.a1b2c3…` | Server with `DE_LICENCE_SECRET` |
|
|
82
|
-
|
|
83
|
-
### Demo keys (documentation only)
|
|
84
|
-
|
|
85
|
-
| Key | Features |
|
|
86
|
-
| --- | --- |
|
|
87
|
-
| `RHE-ENT-DEMO-2026-FULL` | AI, comments, workflows, `toolbarFull` |
|
|
88
|
-
| `RHE-ENT-DEMO-2026-COMMENTS` | Comments only |
|
|
89
|
-
|
|
90
|
-
## API
|
|
91
|
-
|
|
92
|
-
| Export | Description |
|
|
93
|
-
| --- | --- |
|
|
94
|
-
| `resolveEnterpriseFeatures(licence?, options?)` | Verify token; merge into `EditorFeatureFlags`. |
|
|
95
|
-
| `createEnterpriseLicenceToken(payload, secret)` | Mint a signed `DE1.*` token (server-side). |
|
|
96
|
-
| `verifySignedLicenceToken(token, secret, now?)` | Low-level token verification. |
|
|
97
|
-
| `DEFAULT_ENTERPRISE_FEATURES` | Base flags when no licence is valid. |
|
|
98
|
-
| `PREDEFINED_ENTERPRISE_LICENSES` | Built-in demo key catalogue. |
|
|
99
|
-
| `mergeEnterpriseFeatures(base, overrides?)` | Merge partial feature overrides. |
|
|
100
|
-
| `resolveEnterpriseFeaturesOnline(options)` | Remote licence verification. |
|
|
101
|
-
|
|
102
|
-
### `EnterpriseGateResult`
|
|
103
|
-
|
|
104
|
-
| Field | Type | Description |
|
|
105
|
-
| --- | --- | --- |
|
|
106
|
-
| `valid` | `boolean` | Whether the licence was accepted. |
|
|
107
|
-
| `features` | `EditorFeatureFlags` | Resolved feature flags for `createEditor`. |
|
|
108
|
-
| `message` | `string?` | Human-readable status. |
|
|
109
|
-
| `subject` | `string?` | Licence subject / owner. |
|
|
110
|
-
|
|
111
|
-
### Default feature flags
|
|
112
|
-
|
|
113
|
-
| Flag | Default (no licence) |
|
|
114
|
-
| --- | --- |
|
|
115
|
-
| `tables` | `true` |
|
|
116
|
-
| `media` | `true` |
|
|
117
|
-
| `collapsible` | `true` |
|
|
118
|
-
| `comments` | `false` |
|
|
119
|
-
| `ai` | `false` |
|
|
120
|
-
| `workflows` | `false` |
|
|
121
|
-
| `toolbarFull` | `false` |
|
|
122
|
-
|
|
123
|
-
## Related packages
|
|
124
|
-
|
|
125
|
-
- [`@richhtmleditor/core`](https://www.npmjs.com/package/@richhtmleditor/core) — consumes `EditorFeatureFlags`.
|
|
126
|
-
- [`@richhtmleditor/ai`](https://www.npmjs.com/package/@richhtmleditor/ai) — requires `features.ai`.
|
|
127
|
-
- [`@richhtmleditor/comments`](https://www.npmjs.com/package/@richhtmleditor/comments) — requires `features.comments`.
|
|
128
|
-
- [`@richhtmleditor/workflows`](https://www.npmjs.com/package/@richhtmleditor/workflows) — requires `features.workflows`.
|
|
129
|
-
- [`@richhtmleditor/angular`](https://www.npmjs.com/package/@richhtmleditor/angular) — Angular wrapper.
|
|
130
|
-
- [`@richhtmleditor/react`](https://www.npmjs.com/package/@richhtmleditor/react) — React wrapper.
|
|
131
|
-
|
|
132
|
-
## License
|
|
133
|
-
|
|
134
|
-
[MIT](./LICENSE)
|
|
1
|
+
# @richhtmleditor/enterprise
|
|
2
|
+
|
|
3
|
+
Licence verification and feature gating for self-hosted Rich HTML Editor deployments. Resolves signed `DE1.*` tokens and predefined demo keys into [`@richhtmleditor/core`](https://www.npmjs.com/package/@richhtmleditor/core) `EditorFeatureFlags` for AI, comments, workflows, and the full toolbar preset.
|
|
4
|
+
|
|
5
|
+
**Current release: 1.1.1** — Depends on `@richhtmleditor/core` **^1.1.1**.
|
|
6
|
+
|
|
7
|
+
**Repository:** [github.com/rajkishorsahu89/richhtmleditor](https://github.com/rajkishorsahu89/richhtmleditor)
|
|
8
|
+
|
|
9
|
+
**Demo:** [richhtmleditor.vercel.app](https://richhtmleditor.vercel.app/) — [demo](https://richhtmleditor.vercel.app/demo) · [guide](https://richhtmleditor.vercel.app/guide) · [API](https://richhtmleditor.vercel.app/api). Doc Preview joint demo: [doc-preview-app.vercel.app/demo/enterprise](https://doc-preview-app.vercel.app/demo/enterprise)
|
|
10
|
+
|
|
11
|
+
### What's in 1.1.1
|
|
12
|
+
|
|
13
|
+
- **`resolveEnterpriseFeatures`** — verify signed tokens or predefined demo keys; returns `EditorFeatureFlags`
|
|
14
|
+
- **Predefined demo keys** — `RHE-ENT-DEMO-2026-FULL`, `RHE-ENT-DEMO-2026-COMMENTS` (see `predefined-licenses.json`)
|
|
15
|
+
- **Signed tokens** — `DE1.<base64url(payload)>.<hmac-sha256>` minted with `createEnterpriseLicenceToken`
|
|
16
|
+
- **`@richhtmleditor/enterprise/browser`** — browser-safe entry (predefined keys only, no `process.env`)
|
|
17
|
+
- **Online verification** — `resolveEnterpriseFeaturesOnline` for remote licence checks
|
|
18
|
+
|
|
19
|
+
> Use the main export on your server (Node) with `DE_LICENCE_SECRET`. Use `/browser` in client bundles for demo keys only.
|
|
20
|
+
|
|
21
|
+
**Keywords:** `richhtmleditor` `enterprise` `licence` `feature-flags` `licensing`
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install @richhtmleditor/enterprise
|
|
27
|
+
# Requires @richhtmleditor/core (pulled in by framework wrappers).
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage — server-side verification
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { createEditor } from "@richhtmleditor/core";
|
|
34
|
+
import { resolveEnterpriseFeatures } from "@richhtmleditor/enterprise";
|
|
35
|
+
|
|
36
|
+
const gate = resolveEnterpriseFeatures(
|
|
37
|
+
{ token: process.env.DE_LICENCE! },
|
|
38
|
+
{ secret: process.env.DE_LICENCE_SECRET! }
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const editor = createEditor({
|
|
42
|
+
element: host,
|
|
43
|
+
features: gate.features,
|
|
44
|
+
toolbar: gate.features.toolbarFull ? { preset: "full" } : { preset: "standard" }
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage — browser (demo keys)
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { resolveEnterpriseFeatures } from "@richhtmleditor/enterprise/browser";
|
|
52
|
+
|
|
53
|
+
const gate = resolveEnterpriseFeatures({ token: "RHE-ENT-DEMO-2026-FULL" });
|
|
54
|
+
// gate.valid === true
|
|
55
|
+
// gate.features — { ai: true, comments: true, workflows: true, toolbarFull: true, … }
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage — mint signed tokens
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { createEnterpriseLicenceToken } from "@richhtmleditor/enterprise";
|
|
62
|
+
|
|
63
|
+
const token = createEnterpriseLicenceToken(
|
|
64
|
+
{
|
|
65
|
+
sub: "acme-corp",
|
|
66
|
+
exp: Math.floor(Date.now() / 1000) + 86400,
|
|
67
|
+
features: { ai: true, comments: true, workflows: true, toolbarFull: true }
|
|
68
|
+
},
|
|
69
|
+
process.env.DE_LICENCE_SECRET!
|
|
70
|
+
);
|
|
71
|
+
// Returns "DE1.<payload>.<signature>"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Set `DE_LICENCE_SECRET` in your deployment environment. Payload `exp` is a Unix timestamp (seconds).
|
|
75
|
+
|
|
76
|
+
## Token formats
|
|
77
|
+
|
|
78
|
+
| Format | Example | Where verified |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
| Predefined demo key | `RHE-ENT-DEMO-2026-FULL` | Server or `/browser` |
|
|
81
|
+
| Signed token | `DE1.eyJ…}.a1b2c3…` | Server with `DE_LICENCE_SECRET` |
|
|
82
|
+
|
|
83
|
+
### Demo keys (documentation only)
|
|
84
|
+
|
|
85
|
+
| Key | Features |
|
|
86
|
+
| --- | --- |
|
|
87
|
+
| `RHE-ENT-DEMO-2026-FULL` | AI, comments, workflows, `toolbarFull` |
|
|
88
|
+
| `RHE-ENT-DEMO-2026-COMMENTS` | Comments only |
|
|
89
|
+
|
|
90
|
+
## API
|
|
91
|
+
|
|
92
|
+
| Export | Description |
|
|
93
|
+
| --- | --- |
|
|
94
|
+
| `resolveEnterpriseFeatures(licence?, options?)` | Verify token; merge into `EditorFeatureFlags`. |
|
|
95
|
+
| `createEnterpriseLicenceToken(payload, secret)` | Mint a signed `DE1.*` token (server-side). |
|
|
96
|
+
| `verifySignedLicenceToken(token, secret, now?)` | Low-level token verification. |
|
|
97
|
+
| `DEFAULT_ENTERPRISE_FEATURES` | Base flags when no licence is valid. |
|
|
98
|
+
| `PREDEFINED_ENTERPRISE_LICENSES` | Built-in demo key catalogue. |
|
|
99
|
+
| `mergeEnterpriseFeatures(base, overrides?)` | Merge partial feature overrides. |
|
|
100
|
+
| `resolveEnterpriseFeaturesOnline(options)` | Remote licence verification. |
|
|
101
|
+
|
|
102
|
+
### `EnterpriseGateResult`
|
|
103
|
+
|
|
104
|
+
| Field | Type | Description |
|
|
105
|
+
| --- | --- | --- |
|
|
106
|
+
| `valid` | `boolean` | Whether the licence was accepted. |
|
|
107
|
+
| `features` | `EditorFeatureFlags` | Resolved feature flags for `createEditor`. |
|
|
108
|
+
| `message` | `string?` | Human-readable status. |
|
|
109
|
+
| `subject` | `string?` | Licence subject / owner. |
|
|
110
|
+
|
|
111
|
+
### Default feature flags
|
|
112
|
+
|
|
113
|
+
| Flag | Default (no licence) |
|
|
114
|
+
| --- | --- |
|
|
115
|
+
| `tables` | `true` |
|
|
116
|
+
| `media` | `true` |
|
|
117
|
+
| `collapsible` | `true` |
|
|
118
|
+
| `comments` | `false` |
|
|
119
|
+
| `ai` | `false` |
|
|
120
|
+
| `workflows` | `false` |
|
|
121
|
+
| `toolbarFull` | `false` |
|
|
122
|
+
|
|
123
|
+
## Related packages
|
|
124
|
+
|
|
125
|
+
- [`@richhtmleditor/core`](https://www.npmjs.com/package/@richhtmleditor/core) — consumes `EditorFeatureFlags`.
|
|
126
|
+
- [`@richhtmleditor/ai`](https://www.npmjs.com/package/@richhtmleditor/ai) — requires `features.ai`.
|
|
127
|
+
- [`@richhtmleditor/comments`](https://www.npmjs.com/package/@richhtmleditor/comments) — requires `features.comments`.
|
|
128
|
+
- [`@richhtmleditor/workflows`](https://www.npmjs.com/package/@richhtmleditor/workflows) — requires `features.workflows`.
|
|
129
|
+
- [`@richhtmleditor/angular`](https://www.npmjs.com/package/@richhtmleditor/angular) — Angular wrapper.
|
|
130
|
+
- [`@richhtmleditor/react`](https://www.npmjs.com/package/@richhtmleditor/react) — React wrapper.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
[MIT](./LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@richhtmleditor/enterprise",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Licence and feature-gate helpers for Rich HTML Editor enterprise deployments.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"prepack": "node ../../scripts/assert-pack-ready.mjs"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@richhtmleditor/core": "^1.1.
|
|
30
|
+
"@richhtmleditor/core": "^1.1.1"
|
|
31
31
|
},
|
|
32
32
|
"keywords": [
|
|
33
33
|
"richhtmleditor",
|