@katlux/toolkit 0.1.1-alpha.138 → 0.1.1-alpha.139
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/dist/module.json +1 -1
- package/dist/runtime/components/KAccordion/KAccordion.global.d.vue.ts +1 -1
- package/dist/runtime/components/KAccordion/KAccordion.global.vue.d.ts +1 -1
- package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +6 -6
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +6 -6
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +3 -3
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +3 -3
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +3 -3
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +11 -0
- package/dist/runtime/components/KGantt/KGantt.global.vue +3 -0
- package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +11 -0
- package/dist/runtime/components/KGantt/KGantt.logic.d.ts +7 -1
- package/dist/runtime/components/KGantt/KGantt.logic.js +26 -7
- package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KGantt/KGantt.d.vue.ts +11 -0
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue +52 -12
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +11 -0
- package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue +2 -0
- package/dist/skills/KATLUX_INDEX.md +1 -0
- package/dist/skills/katlux-config/SKILL.md +7 -7
- package/dist/skills/katlux-presets/SKILL.md +2 -0
- package/dist/skills/katlux-presets/creating-a-preset.md +269 -0
- package/dist/skills/katlux-providers/SKILL.md +1 -1
- package/dist/skills/katlux-providers/providers/encryption.md +43 -6
- package/package.json +2 -2
|
@@ -25,6 +25,7 @@ type __VLS_Props = {
|
|
|
25
25
|
headerSlots?: any;
|
|
26
26
|
endingPoint?: Date | string | number;
|
|
27
27
|
mode?: 'date' | 'numeric';
|
|
28
|
+
inclusiveEndDate?: boolean;
|
|
28
29
|
virtualScroll?: boolean;
|
|
29
30
|
itemHeight?: number;
|
|
30
31
|
viewportHeight?: number;
|
|
@@ -50,6 +51,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
50
51
|
sourceRow: any;
|
|
51
52
|
targetRow?: any;
|
|
52
53
|
}) => any;
|
|
54
|
+
"task-change": (payload: {
|
|
55
|
+
task: IGanttTask;
|
|
56
|
+
sourceRow: any;
|
|
57
|
+
targetRow?: any;
|
|
58
|
+
}) => any;
|
|
53
59
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
54
60
|
"onUpdate:selectedRows"?: ((value: any[]) => any) | undefined;
|
|
55
61
|
"onUpdate:selectAll"?: ((value: boolean) => any) | undefined;
|
|
@@ -68,6 +74,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
68
74
|
sourceRow: any;
|
|
69
75
|
targetRow?: any;
|
|
70
76
|
}) => any) | undefined;
|
|
77
|
+
"onTask-change"?: ((payload: {
|
|
78
|
+
task: IGanttTask;
|
|
79
|
+
sourceRow: any;
|
|
80
|
+
targetRow?: any;
|
|
81
|
+
}) => any) | undefined;
|
|
71
82
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
72
83
|
declare const _default: typeof __VLS_export;
|
|
73
84
|
export default _default;
|
|
@@ -95,6 +95,7 @@ const props = defineProps<{
|
|
|
95
95
|
|
|
96
96
|
endingPoint?: Date | string | number
|
|
97
97
|
mode?: 'date' | 'numeric'
|
|
98
|
+
inclusiveEndDate?: boolean
|
|
98
99
|
|
|
99
100
|
virtualScroll?: boolean
|
|
100
101
|
itemHeight?: number
|
|
@@ -107,6 +108,7 @@ const props = defineProps<{
|
|
|
107
108
|
|
|
108
109
|
const emit = defineEmits<{
|
|
109
110
|
(e: 'update:task', payload: { task: IGanttTask; sourceRow: any; targetRow?: any }): void
|
|
111
|
+
(e: 'task-change', payload: { task: IGanttTask; sourceRow: any; targetRow?: any }): void
|
|
110
112
|
(e: 'update:selectedRows', value: any[]): void
|
|
111
113
|
(e: 'update:selectAll', value: boolean): void
|
|
112
114
|
(e: 'task-click', payload: { task: IGanttTask; row: any }): void
|
|
@@ -124,6 +126,7 @@ interface ActiveDrag {
|
|
|
124
126
|
currentHoverRow: any
|
|
125
127
|
mode: 'move' | 'resize-left' | 'resize-right'
|
|
126
128
|
startX: number
|
|
129
|
+
startY: number
|
|
127
130
|
wrapperWidth: number
|
|
128
131
|
originalStartMs: number
|
|
129
132
|
originalEndMs: number
|
|
@@ -202,6 +205,22 @@ const onTaskClick = (payload: { task: IGanttTask; row: any }) => {
|
|
|
202
205
|
emit('task-click', payload)
|
|
203
206
|
}
|
|
204
207
|
|
|
208
|
+
function formatTaskDate(originalValue: any, ms: number, mode?: 'date' | 'numeric') {
|
|
209
|
+
if (mode === 'numeric' || typeof originalValue === 'number') return ms
|
|
210
|
+
if (originalValue instanceof Date) return new Date(ms)
|
|
211
|
+
if (typeof originalValue === 'string') {
|
|
212
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(originalValue)) {
|
|
213
|
+
const d = new Date(ms)
|
|
214
|
+
const year = d.getFullYear()
|
|
215
|
+
const month = String(d.getMonth() + 1).padStart(2, '0')
|
|
216
|
+
const day = String(d.getDate()).padStart(2, '0')
|
|
217
|
+
return `${year}-${month}-${day}`
|
|
218
|
+
}
|
|
219
|
+
return new Date(ms).toISOString()
|
|
220
|
+
}
|
|
221
|
+
return ms
|
|
222
|
+
}
|
|
223
|
+
|
|
205
224
|
const onTaskDragStart = (
|
|
206
225
|
{ event, task, rowId, mode, wrapperEl }: { event: MouseEvent; task: IGanttTask; rowId: any; mode: string; wrapperEl: HTMLElement | null },
|
|
207
226
|
row: any
|
|
@@ -226,6 +245,7 @@ const onTaskDragStart = (
|
|
|
226
245
|
currentHoverRow: row,
|
|
227
246
|
mode: mode as ActiveDrag['mode'],
|
|
228
247
|
startX: event.clientX,
|
|
248
|
+
startY: event.clientY,
|
|
229
249
|
wrapperWidth,
|
|
230
250
|
originalStartMs,
|
|
231
251
|
originalEndMs,
|
|
@@ -250,7 +270,8 @@ const onMouseMove = (e: MouseEvent) => {
|
|
|
250
270
|
|
|
251
271
|
const state = activeDragState.value
|
|
252
272
|
const deltaX = e.clientX - state.startX
|
|
253
|
-
|
|
273
|
+
const deltaY = e.clientY - state.startY
|
|
274
|
+
if (Math.abs(deltaX) > 4 || Math.abs(deltaY) > 4) {
|
|
254
275
|
wasDragging = true
|
|
255
276
|
}
|
|
256
277
|
const msPerPx = (props.globalDateRange.end - props.globalDateRange.start) / state.wrapperWidth
|
|
@@ -280,12 +301,6 @@ const onMouseUp = () => {
|
|
|
280
301
|
window.removeEventListener('mousemove', onMouseMove)
|
|
281
302
|
window.removeEventListener('mouseup', onMouseUp)
|
|
282
303
|
|
|
283
|
-
if (wasDragging) {
|
|
284
|
-
setTimeout(() => {
|
|
285
|
-
wasDragging = false
|
|
286
|
-
}, 150)
|
|
287
|
-
}
|
|
288
|
-
|
|
289
304
|
if (!activeDragState.value) { return }
|
|
290
305
|
|
|
291
306
|
const state = activeDragState.value
|
|
@@ -299,6 +314,22 @@ const onMouseUp = () => {
|
|
|
299
314
|
state.currentEndMs !== state.originalEndMs ||
|
|
300
315
|
(state.currentHoverRow && state.currentHoverRow !== state.sourceRow)
|
|
301
316
|
|
|
317
|
+
if (hasMoved || wasDragging) {
|
|
318
|
+
wasDragging = true
|
|
319
|
+
// Intercept and prevent the browser's subsequent click event in the capture phase
|
|
320
|
+
const captureClick = (e: MouseEvent) => {
|
|
321
|
+
e.stopPropagation()
|
|
322
|
+
e.stopImmediatePropagation()
|
|
323
|
+
e.preventDefault()
|
|
324
|
+
window.removeEventListener('click', captureClick, true)
|
|
325
|
+
}
|
|
326
|
+
window.addEventListener('click', captureClick, true)
|
|
327
|
+
setTimeout(() => {
|
|
328
|
+
window.removeEventListener('click', captureClick, true)
|
|
329
|
+
wasDragging = false
|
|
330
|
+
}, 100)
|
|
331
|
+
}
|
|
332
|
+
|
|
302
333
|
if (!hasMoved) {
|
|
303
334
|
activeDragState.value = null
|
|
304
335
|
return
|
|
@@ -306,8 +337,8 @@ const onMouseUp = () => {
|
|
|
306
337
|
|
|
307
338
|
const updatedTask = {
|
|
308
339
|
...state.task,
|
|
309
|
-
[startField]: state.currentStartMs,
|
|
310
|
-
[endField]: state.currentEndMs
|
|
340
|
+
[startField]: formatTaskDate(state.task[startField], state.currentStartMs, props.mode),
|
|
341
|
+
[endField]: formatTaskDate(state.task[endField], state.currentEndMs, props.mode)
|
|
311
342
|
}
|
|
312
343
|
|
|
313
344
|
let targetRow = state.sourceRow
|
|
@@ -347,18 +378,27 @@ const onMouseUp = () => {
|
|
|
347
378
|
? props.getTasksForRow(targetRow)
|
|
348
379
|
: (targetRow?.[tasksField] || [])
|
|
349
380
|
|
|
350
|
-
const overlapping = isTaskOverlapping(
|
|
381
|
+
const overlapping = isTaskOverlapping(
|
|
382
|
+
updatedTask,
|
|
383
|
+
targetTasks,
|
|
384
|
+
startField,
|
|
385
|
+
endField,
|
|
386
|
+
props.inclusiveEndDate ?? (props.mode === 'date')
|
|
387
|
+
)
|
|
351
388
|
|
|
352
389
|
if (overlapping) {
|
|
353
390
|
activeDragState.value = null
|
|
354
391
|
return
|
|
355
392
|
}
|
|
356
393
|
|
|
357
|
-
|
|
394
|
+
const emitPayload = {
|
|
358
395
|
task: updatedTask,
|
|
359
396
|
sourceRow: state.sourceRow,
|
|
360
397
|
targetRow: targetRow !== state.sourceRow ? targetRow : undefined
|
|
361
|
-
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
emit('update:task', emitPayload)
|
|
401
|
+
emit('task-change', emitPayload)
|
|
362
402
|
|
|
363
403
|
activeDragState.value = null
|
|
364
404
|
}
|
|
@@ -25,6 +25,7 @@ type __VLS_Props = {
|
|
|
25
25
|
headerSlots?: any;
|
|
26
26
|
endingPoint?: Date | string | number;
|
|
27
27
|
mode?: 'date' | 'numeric';
|
|
28
|
+
inclusiveEndDate?: boolean;
|
|
28
29
|
virtualScroll?: boolean;
|
|
29
30
|
itemHeight?: number;
|
|
30
31
|
viewportHeight?: number;
|
|
@@ -50,6 +51,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
50
51
|
sourceRow: any;
|
|
51
52
|
targetRow?: any;
|
|
52
53
|
}) => any;
|
|
54
|
+
"task-change": (payload: {
|
|
55
|
+
task: IGanttTask;
|
|
56
|
+
sourceRow: any;
|
|
57
|
+
targetRow?: any;
|
|
58
|
+
}) => any;
|
|
53
59
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
54
60
|
"onUpdate:selectedRows"?: ((value: any[]) => any) | undefined;
|
|
55
61
|
"onUpdate:selectAll"?: ((value: boolean) => any) | undefined;
|
|
@@ -68,6 +74,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
68
74
|
sourceRow: any;
|
|
69
75
|
targetRow?: any;
|
|
70
76
|
}) => any) | undefined;
|
|
77
|
+
"onTask-change"?: ((payload: {
|
|
78
|
+
task: IGanttTask;
|
|
79
|
+
sourceRow: any;
|
|
80
|
+
targetRow?: any;
|
|
81
|
+
}) => any) | undefined;
|
|
71
82
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
72
83
|
declare const _default: typeof __VLS_export;
|
|
73
84
|
export default _default;
|
|
@@ -25,11 +25,13 @@
|
|
|
25
25
|
.gantt-resize-handle.left(
|
|
26
26
|
v-if="editable"
|
|
27
27
|
@mousedown.left.stop="$emit('task-dragstart', { event: $event, task, rowId: row?.id, mode: 'resize-left', wrapperEl: wrapperRef })"
|
|
28
|
+
@click.stop
|
|
28
29
|
)
|
|
29
30
|
span.gantt-title {{ task[titleField] || '' }}
|
|
30
31
|
.gantt-resize-handle.right(
|
|
31
32
|
v-if="editable"
|
|
32
33
|
@mousedown.left.stop="$emit('task-dragstart', { event: $event, task, rowId: row?.id, mode: 'resize-right', wrapperEl: wrapperRef })"
|
|
34
|
+
@click.stop
|
|
33
35
|
)
|
|
34
36
|
</template>
|
|
35
37
|
|
|
@@ -14,6 +14,7 @@ When the **Katlux MCP Server** (`katlux` / `@katlux/mcp`) is configured in your
|
|
|
14
14
|
| `katlux_lookup_prop` | Ultra-compact atomic lookup for a single prop, event, or slot on a component (e.g. `component: 'KDatatable', prop: 'selectAllScope'`) | **~40 tokens** (ideal for micro-edits & single property checks) |
|
|
15
15
|
| `katlux_list_components` | Discover components filtered by category (`form`, `data`, `layout`, `navigation`, `feedback`, `charts`, `ecommerce`) or search query | ~150 tokens vs reading entire docs |
|
|
16
16
|
| `katlux_get_provider` | Data provider architecture, constructor options, caching, encryption, and recipes for `ADataProvider`, `CFlatClientDataProvider`, `CAPIFlatServerDataProvider` | ~400 tokens vs 15k in `katlux-providers` |
|
|
17
|
+
| `katlux_get_encryption` | Cryptographic architectures, cipher provider APIs, E2EE recipes, field-level encryption, tenant key wrapping, blind search indexing, and security instructions | ~200-500 tokens vs 14k in encryption spec |
|
|
17
18
|
| `katlux_list_icons` | Fuzzy search available SVG icons for `KIcon` and `icon` props | ~100 tokens vs guessing icon names |
|
|
18
19
|
| `katlux_get_tokens` | CSS design tokens by category (`color`, `surface`, `border`, `typography`, `button`, `input`, `table`, `other`) | ~300 tokens vs 6k in `katlux-tokens` |
|
|
19
20
|
| `katlux_scaffold` | Boilerplate code generator for common patterns (`datatable-page`, `form-with-validation`, `tree-explorer`, `chart-dashboard`) | Clean boilerplate with zero prompt bloat |
|
|
@@ -104,13 +104,13 @@ export default defineAppConfig({
|
|
|
104
104
|
|
|
105
105
|
| Package Name | Current Version | Description | Installation Command |
|
|
106
106
|
| --- | --- | --- | --- |
|
|
107
|
-
| `@katlux/toolkit` | `0.1.1-alpha.
|
|
108
|
-
| `@katlux/providers` | `0.1.1-alpha.
|
|
109
|
-
| `@katlux/preset-modern` | `0.1.1-alpha.
|
|
110
|
-
| `@katlux/preset-dark` | `0.1.1-alpha.
|
|
111
|
-
| `@katlux/block-charts` | `0.1.1-alpha.
|
|
112
|
-
| `@katlux/block-ecommerce` | `0.1.1-alpha.
|
|
113
|
-
| `@katlux/mcp` | `0.1.0-alpha.
|
|
107
|
+
| `@katlux/toolkit` | `0.1.1-alpha.138` | Core Nuxt module, UI toolkit, presets, and components | `npm install @katlux/toolkit@alpha` |
|
|
108
|
+
| `@katlux/providers` | `0.1.1-alpha.126` | Core data providers, client caching, and state structures | `npm install @katlux/providers@alpha` |
|
|
109
|
+
| `@katlux/preset-modern` | `0.1.1-alpha.113` | Modern design preset and styling variables | `npm install @katlux/preset-modern@alpha` |
|
|
110
|
+
| `@katlux/preset-dark` | `0.1.1-alpha.44` | Sleek Dark Mode design preset | `npm install @katlux/preset-dark@alpha` |
|
|
111
|
+
| `@katlux/block-charts` | `0.1.1-alpha.113` | Pre-built charting block components | `npm install @katlux/block-charts@alpha` |
|
|
112
|
+
| `@katlux/block-ecommerce` | `0.1.1-alpha.113` | Pre-built eCommerce block components | `npm install @katlux/block-ecommerce@alpha` |
|
|
113
|
+
| `@katlux/mcp` | `0.1.0-alpha.18` | Model Context Protocol server for AI assistant integration | `npm install @katlux/mcp@alpha` |
|
|
114
114
|
|
|
115
115
|
> [!NOTE]
|
|
116
116
|
> Katlux packages are currently published under the `@alpha` tag on NPM. Always append `@alpha` or the specific version tag when adding dependencies.
|
|
@@ -7,6 +7,8 @@ description: Complete reference for the Katlux preset and theming system. Covers
|
|
|
7
7
|
|
|
8
8
|
Katlux uses a unified **preset** system to allow full visual customization without forking components. Each component has a `*.global.vue` wrapper that delegates rendering to a preset-specific implementation via `usePresetComponent()`.
|
|
9
9
|
|
|
10
|
+
- [Step-by-step: Creating a Preset from Scratch](creating-a-preset.md)
|
|
11
|
+
|
|
10
12
|
## Unified Preset Architecture
|
|
11
13
|
|
|
12
14
|
> [!IMPORTANT]
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
# Creating a Custom Katlux Preset from Scratch
|
|
2
|
+
|
|
3
|
+
This guide details how to create and maintain a custom preset in a Katlux project from scratch, covering both **project-level presets** (in a Nuxt application) and **reusable standalone npm preset packages**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Overview of Katlux Presets
|
|
8
|
+
|
|
9
|
+
Katlux presets are designed around a **zero-copy, cascading fallback** architecture:
|
|
10
|
+
- **Token-Only by default**: Over 90% of theming is handled purely through CSS custom properties without modifying component templates.
|
|
11
|
+
- **Selective Component Overrides**: You only create component templates (`.vue` files) for the specific components you want to restructure or customize beyond CSS.
|
|
12
|
+
- **Automatic Fallback Cascade**: Any token or component not defined in your preset automatically cascades back to the base preset (e.g. `modern`) or the built-in `default` preset.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 2. Quick Scaffolding
|
|
17
|
+
|
|
18
|
+
### Option A: Using the CLI
|
|
19
|
+
Run the `create-preset` command from the root of your project:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Based on 'modern' preset
|
|
23
|
+
npx @katlux/toolkit create-preset my-brand --base=modern
|
|
24
|
+
|
|
25
|
+
# Or without a base (falls back directly to 'default')
|
|
26
|
+
npx @katlux/toolkit create-preset my-brand
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Option B: Using the MCP Tool
|
|
30
|
+
If you have Katlux MCP installed:
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"name": "my-brand",
|
|
34
|
+
"base": "modern"
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
Tool: `katlux_create_preset`
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 3. Directory Structure
|
|
42
|
+
|
|
43
|
+
A project preset lives in the `presets/` folder at your project root:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
presets/
|
|
47
|
+
└── my-brand/
|
|
48
|
+
├── assets/
|
|
49
|
+
│ └── css-variables.scss # Design tokens scoped to the preset
|
|
50
|
+
└── components/ # Optional component template overrides
|
|
51
|
+
├── KButton/
|
|
52
|
+
│ └── KButton.vue
|
|
53
|
+
└── KLayout/
|
|
54
|
+
└── KLayout.vue
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
> [!NOTE]
|
|
58
|
+
> `@katlux/toolkit` **automatically discovers and injects** stylesheets found in `presets/<preset-name>/assets/css-variables.scss` (or `.css`). No manual import in `nuxt.config.ts` is required.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 4. Step 1: Defining Design Tokens (`css-variables.scss`)
|
|
63
|
+
|
|
64
|
+
All CSS custom properties must be scoped to the preset's attribute selector: `[data-preset~="<preset-name>"]`.
|
|
65
|
+
|
|
66
|
+
```scss
|
|
67
|
+
/* presets/my-brand/assets/css-variables.scss */
|
|
68
|
+
|
|
69
|
+
[data-preset~="my-brand"] {
|
|
70
|
+
/* 1. Brand Colors */
|
|
71
|
+
--primary-50: #eef2ff;
|
|
72
|
+
--primary-500: #6366f1;
|
|
73
|
+
--primary-600: #4f46e5;
|
|
74
|
+
--primary-700: #4338ca;
|
|
75
|
+
|
|
76
|
+
/* 2. Surfaces & Backgrounds */
|
|
77
|
+
--bg-primary: #ffffff;
|
|
78
|
+
--bg-secondary: #f8fafc;
|
|
79
|
+
--border-color: #e2e8f0;
|
|
80
|
+
|
|
81
|
+
/* 3. Typography & Spacing */
|
|
82
|
+
--font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
83
|
+
--border-radius-sm: 6px;
|
|
84
|
+
--border-radius-md: 10px;
|
|
85
|
+
--border-radius-lg: 16px;
|
|
86
|
+
|
|
87
|
+
/* 4. Component-Specific Tokens */
|
|
88
|
+
--button-padding: 0.625rem 1.25rem;
|
|
89
|
+
--button-radius: var(--border-radius-md);
|
|
90
|
+
--button-bg-primary: var(--primary-500);
|
|
91
|
+
--button-color-primary: #ffffff;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
> [!TIP]
|
|
96
|
+
> Always use `[data-preset~="my-brand"]` (space-separated attribute selector) to support preset stacks like `activePreset: ['my-brand', 'dark']`. Avoid using `!important`.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 5. Step 2: Overriding Component Templates (Optional)
|
|
101
|
+
|
|
102
|
+
You only need to add components if you want to alter the DOM structure, replace internal sub-elements, or customize behavior beyond CSS variables.
|
|
103
|
+
|
|
104
|
+
### Folder and Naming Conventions
|
|
105
|
+
- Component overrides are **case-sensitive**.
|
|
106
|
+
- The path must follow: `presets/<preset-name>/components/<ComponentName>/<ComponentName>.vue`.
|
|
107
|
+
- Example: `presets/my-brand/components/KButton/KButton.vue`.
|
|
108
|
+
|
|
109
|
+
### Writing a Component Template
|
|
110
|
+
Use the component's logic props and standard slots.
|
|
111
|
+
|
|
112
|
+
```vue
|
|
113
|
+
<!-- presets/my-brand/components/KButton/KButton.vue -->
|
|
114
|
+
<template lang="pug">
|
|
115
|
+
button.KButton.my-brand(
|
|
116
|
+
:type="type"
|
|
117
|
+
:class="[buttonClasses, customClasses]"
|
|
118
|
+
:disabled="disabled || loading"
|
|
119
|
+
@click="handleClick"
|
|
120
|
+
)
|
|
121
|
+
span.k-spinner(v-if="loading")
|
|
122
|
+
slot(name="prefix")
|
|
123
|
+
slot
|
|
124
|
+
slot(name="suffix")
|
|
125
|
+
</template>
|
|
126
|
+
|
|
127
|
+
<script lang="ts" setup>
|
|
128
|
+
interface ButtonProps {
|
|
129
|
+
type?: 'button' | 'submit' | 'reset'
|
|
130
|
+
buttonClasses?: any
|
|
131
|
+
disabled?: boolean
|
|
132
|
+
loading?: boolean
|
|
133
|
+
customClasses?: string
|
|
134
|
+
handleClick?: (e: MouseEvent) => void
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
withDefaults(defineProps<ButtonProps>(), {
|
|
138
|
+
type: 'button',
|
|
139
|
+
disabled: false,
|
|
140
|
+
loading: false
|
|
141
|
+
})
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<style lang="scss" scoped>
|
|
145
|
+
.KButton.my-brand {
|
|
146
|
+
display: inline-flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
justify-content: center;
|
|
149
|
+
gap: var(--gap-sm, 0.5rem);
|
|
150
|
+
padding: var(--button-padding);
|
|
151
|
+
border-radius: var(--button-radius);
|
|
152
|
+
font-family: var(--font-family-base);
|
|
153
|
+
transition: all 0.2s ease-in-out;
|
|
154
|
+
|
|
155
|
+
&:hover:not(:disabled) {
|
|
156
|
+
transform: translateY(-1px);
|
|
157
|
+
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
</style>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## 6. Step 3: Registering & Activating the Preset (`app.config.ts`)
|
|
166
|
+
|
|
167
|
+
Enable your preset in your project's `app.config.ts`:
|
|
168
|
+
|
|
169
|
+
### A. When Based on Another Preset (e.g. `modern`)
|
|
170
|
+
```typescript
|
|
171
|
+
// app.config.ts
|
|
172
|
+
export default defineAppConfig({
|
|
173
|
+
katluxToolkit: {
|
|
174
|
+
presetList: [
|
|
175
|
+
{ name: 'Default', value: 'default' },
|
|
176
|
+
{ name: 'Modern', value: 'modern' },
|
|
177
|
+
{ name: 'My Brand', value: ['my-brand', 'modern'] }
|
|
178
|
+
],
|
|
179
|
+
// Priority: my-brand -> modern -> default
|
|
180
|
+
activePreset: ['my-brand', 'modern']
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### B. When Standalone (Direct Fallback to `default`)
|
|
186
|
+
```typescript
|
|
187
|
+
// app.config.ts
|
|
188
|
+
export default defineAppConfig({
|
|
189
|
+
katluxToolkit: {
|
|
190
|
+
presetList: [
|
|
191
|
+
{ name: 'Default', value: 'default' },
|
|
192
|
+
{ name: 'My Brand', value: 'my-brand' }
|
|
193
|
+
],
|
|
194
|
+
activePreset: 'my-brand'
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## 7. Creating an Installable NPM Preset Package
|
|
202
|
+
|
|
203
|
+
If you are developing a standalone preset package (e.g. `@my-org/katlux-preset-corp`):
|
|
204
|
+
|
|
205
|
+
### 1. Package Directory Structure
|
|
206
|
+
```text
|
|
207
|
+
katlux-preset-corp/
|
|
208
|
+
├── package.json
|
|
209
|
+
├── src/
|
|
210
|
+
│ ├── module.ts # Nuxt module definition
|
|
211
|
+
│ └── runtime/
|
|
212
|
+
│ ├── assets/
|
|
213
|
+
│ │ └── css-variables.scss
|
|
214
|
+
│ ├── components/
|
|
215
|
+
│ │ └── KButton/KButton.vue
|
|
216
|
+
│ └── plugin.ts # Runtime component registration
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### 2. Runtime Plugin (`src/runtime/plugin.ts`)
|
|
220
|
+
Register component loaders using `registerPresetComponents`:
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
import { defineNuxtPlugin } from '#app'
|
|
224
|
+
// @ts-ignore
|
|
225
|
+
import { registerPresetComponents } from '#imports'
|
|
226
|
+
|
|
227
|
+
export default defineNuxtPlugin(() => {
|
|
228
|
+
const loaders = {
|
|
229
|
+
'./components/KButton/KButton.vue': () => import('./components/KButton/KButton.vue')
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (typeof registerPresetComponents === 'function') {
|
|
233
|
+
registerPresetComponents('corp', loaders)
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### 3. Nuxt Module (`src/module.ts`)
|
|
239
|
+
Inject the stylesheet and register the runtime plugin:
|
|
240
|
+
|
|
241
|
+
```typescript
|
|
242
|
+
import { defineNuxtModule, createResolver, addPlugin } from '@nuxt/kit'
|
|
243
|
+
|
|
244
|
+
export default defineNuxtModule({
|
|
245
|
+
meta: {
|
|
246
|
+
name: '@my-org/katlux-preset-corp',
|
|
247
|
+
configKey: 'katluxPresetCorp'
|
|
248
|
+
},
|
|
249
|
+
setup(options, nuxt) {
|
|
250
|
+
const resolver = createResolver(import.meta.url)
|
|
251
|
+
|
|
252
|
+
// Automatically inject CSS variables
|
|
253
|
+
nuxt.options.css = nuxt.options.css || []
|
|
254
|
+
nuxt.options.css.push(resolver.resolve('./runtime/assets/css-variables.scss'))
|
|
255
|
+
|
|
256
|
+
// Register runtime plugin
|
|
257
|
+
addPlugin(resolver.resolve('./runtime/plugin'))
|
|
258
|
+
}
|
|
259
|
+
})
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## 8. Best Practices Checklist
|
|
265
|
+
|
|
266
|
+
- [ ] **Do not copy entire base presets**: Only write tokens you intend to customize. Let uncustomized tokens fall back.
|
|
267
|
+
- [ ] **Scope to `[data-preset~="name"]`**: Avoid unscoped root styles or `!important`.
|
|
268
|
+
- [ ] **Preserve logic and props**: When overriding a component template, maintain the props and slot signatures exposed by the component logic layer.
|
|
269
|
+
- [ ] **Persist dynamic UI state externally**: Switching presets with structural component overrides causes container unmounting; keep transient state (active tabs, table selections) in Pinia or URL query params.
|
|
@@ -50,7 +50,7 @@ description: Complete reference and atomic index for Katlux data management arch
|
|
|
50
50
|
| `RequestQueue` | Offline PWA operation queue | Queues mutations offline in IndexedDB, auto-flushes on reconnect | [RequestQueue.md](providers/RequestQueue.md) |
|
|
51
51
|
| `KatluxIndexedDB` | High-performance IndexedDB wrapper | Client-side persistent storage for offline data and large cache entries | [KatluxIndexedDB.md](providers/KatluxIndexedDB.md) |
|
|
52
52
|
| `CacheProvider` | Tiered multi-layer caching engine | Memory, BrowserSession, LocalStorage, IndexedDB, Cookie tiers | [caching.md](providers/caching.md) |
|
|
53
|
-
| `EncryptionProvider` | WebCrypto & NodeCrypto
|
|
53
|
+
| `EncryptionProvider` & `CKeyManager` | WebCrypto & NodeCrypto cryptographic suite | AES-GCM 256-bit field/payload encryption, built-in keyring rotation, strict decryption, dynamic AAD, zero-leak ADEK re-wrapping, RFC 8785 JCS access grants, domain-separated derivation | [encryption.md](providers/encryption.md) |
|
|
54
54
|
|
|
55
55
|
---
|
|
56
56
|
|
|
@@ -19,20 +19,40 @@ Zero-dependency, native cryptographic toolkit for end-to-end client-side, in-fli
|
|
|
19
19
|
- `CWebCryptoEncryptionProvider`: AES-GCM-256 with optional PBKDF2/HKDF key derivation. Built-in AEAD, 100% backward-compatible.
|
|
20
20
|
- `CWebCryptoAESCBCProvider`: Authenticated AES-CBC-256 + HMAC-SHA-256 (Encrypt-then-MAC) for legacy system compatibility.
|
|
21
21
|
- `CRSAEncryptionProvider`: Asymmetric RSA-OAEP-4096 + AES-GCM-256 hybrid cipher for arbitrary-sized single-recipient payloads.
|
|
22
|
-
- `CECDHEncryptionProvider`: Forward-secure Elliptic Curve Diffie-Hellman (P-256/384/521) + HKDF + AES-GCM. Ephemeral key per encryption. Ideal for multi-user role sharing (e.g.
|
|
22
|
+
- `CECDHEncryptionProvider`: Forward-secure Elliptic Curve Diffie-Hellman (P-256/384/521) + HKDF + AES-GCM. Ephemeral key per encryption. Ideal for multi-user role sharing (e.g. Account Symmetric Key wrapping).
|
|
23
23
|
- `CNodeCryptoEncryptionProvider`: Server-side synchronous AES-GCM via `node:crypto` (`encryptSync`/`decryptSync`). 100% binary-interoperable with `CWebCryptoEncryptionProvider`.
|
|
24
24
|
- **Provider Methods (`IEncryptionProvider` / `AEncryptionProvider`)**:
|
|
25
|
-
- `encrypt(data: any, options?: IEncryptionContext): Promise<IEncryptedPayload | any>`: Encrypts data into an envelope or field-encrypted record (strictly idempotent; already-encrypted fields/envelopes are never double-encrypted). Attaches `kid` when specified
|
|
26
|
-
- `decrypt(payload: any, options?: IEncryptionContext): Promise<any>`: Decrypts envelope back into original data, immediately zeroing plaintext byte buffers in memory. Automatically leverages record-level DEK caching across multi-field records for up to 90% latency reduction.
|
|
27
|
-
- `warmupKey(options?: IEncryptionContext): Promise<void>`: Pre-derives and caches CryptoKey / Buffer in memory. Supported on `CWebCrypto`, `CWebCryptoAESCBC`, and `CNodeCrypto
|
|
25
|
+
- `encrypt(data: any, options?: IEncryptionContext): Promise<IEncryptedPayload | any>`: Encrypts data into an envelope or field-encrypted record (strictly idempotent; already-encrypted fields/envelopes are never double-encrypted). Attaches `kid` when specified or uses `activeKid`.
|
|
26
|
+
- `decrypt(payload: any, options?: IEncryptionContext): Promise<any>`: Decrypts envelope back into original data, immediately zeroing plaintext byte buffers in memory. Dynamically routes decryption through `keys[envelope.kid]` or fallback keys, validating against `allowedKids`. Automatically leverages record-level DEK caching across multi-field records for up to 90% latency reduction.
|
|
27
|
+
- `warmupKey(options?: IEncryptionContext): Promise<void>`: Pre-derives and caches CryptoKey / Buffer in memory. When a keyring (`keys`) is configured, resolves and warms up all keys concurrently via `Promise.all`. Supported on `CWebCrypto`, `CWebCryptoAESCBC`, and `CNodeCrypto` (`warmupKeySync` also available on Node).
|
|
28
|
+
- `setKeyring(keys: Record<string, TKeyProvider | IKeyPair>, activeKid?: string): void`: Replaces or updates the active keyring dictionary and optionally sets the active outbound key identifier.
|
|
29
|
+
- `getKeyring(): Record<string, TKeyProvider | IKeyPair>`: Returns the currently configured keyring dictionary.
|
|
30
|
+
- `setActiveKid(kid: string): void`: Sets the active key identifier used for all outbound encryption.
|
|
31
|
+
- `getActiveKid(): string | undefined`: Returns the currently active outbound key identifier.
|
|
28
32
|
- `isEncrypted(payload: any): boolean`: Polymorphic check if given object is an encrypted envelope. Also available as static `AEncryptionProvider.isEncrypted(payload)`.
|
|
29
|
-
- `clearKeys() / dispose()`: Wipes in-memory key caches, zeroes mutable Buffer bytes, and clears sensitive asymmetric keys upon logout/session end.
|
|
33
|
+
- `clearKeys() / dispose()`: Wipes in-memory key caches, zeroes mutable Buffer bytes and keyring caches, and clears sensitive asymmetric keys upon logout/session end.
|
|
30
34
|
- `resolveRawKey(keyProvider?: TKeyProvider)`: (Protected on `AEncryptionProvider`) Resolves key or async keyProvider callback. Supports `string`, `Uint8Array`, `ArrayBuffer`, and `CryptoKey` without byte corruption.
|
|
31
35
|
- **PEM Import/Export (`CKeyManager` / `CRSA` / `CECDH`)**:
|
|
32
36
|
- `importPublicKeyFromPEM(pem, ...)`: Imports SPKI PEM string to `CryptoKey`.
|
|
33
37
|
- `importPrivateKeyFromPEM(pem, ...)`: Imports PKCS#8 PEM string to `CryptoKey`.
|
|
34
38
|
- `exportPublicKeyToPEM(key)`: Exports `CryptoKey` to standard SPKI PEM string.
|
|
35
39
|
- `exportPrivateKeyToPEM(key)`: Exports `CryptoKey` to standard PKCS#8 PEM string.
|
|
40
|
+
- **Account Key Wrapping & Re-Wrapping (`CKeyManager`)**:
|
|
41
|
+
- `wrapAccountKeyForUser(adek, userPublicKey): Promise<string>`: Wraps an ADEK for a user using RSA-OAEP.
|
|
42
|
+
- `unwrapAccountKeyForUser(wrappedKeyBase64, userPrivateKey, unwrappedKeyAlgorithm?, extractable?): Promise<CryptoKey>`: Restores an unextractable AES-GCM ADEK from envelope using RSA-OAEP.
|
|
43
|
+
- `rewrapAccountKeyForUser(wrappedKeyBase64, myPrivateKey, recipientPublicKey): Promise<string>`: Atomically re-wraps an ADEK envelope for a new recipient without exposing raw extractable keys to application memory, guaranteeing memory zeroization via `finally`.
|
|
44
|
+
- **Digital Signatures & Access Grants (`CKeyManager` / `canonicalizeJson`)**:
|
|
45
|
+
- `canonicalizeJson(value): string`: Serializes a JavaScript value to a deterministic, canonical JSON string conforming to RFC 8785 (JCS).
|
|
46
|
+
- `generateSigningKeyPair(curve?, extractable?): Promise<IKeyPair>`: Generates an ECDSA P-256 signing key pair.
|
|
47
|
+
- `getKeyFingerprint(publicKey): Promise<string>`: Generates a deterministic SHA-256 fingerprint for a public key formatted as `SHA256:<base64url>`.
|
|
48
|
+
- `sign(data, privateKey): Promise<string>`: Signs arbitrary data or JSON objects using an ECDSA P-256 private key (objects automatically canonicalized via RFC 8785).
|
|
49
|
+
- `verify(data, signature, publicKey): Promise<boolean>`: Verifies an ECDSA P-256 signature against original data or JSON object.
|
|
50
|
+
- `signGrant(grant: IAccessGrant, granterPrivateKey, granterPublicKey?): Promise<ISignedGrant>`: Signs a structured access grant, embedding signature and granter key fingerprint.
|
|
51
|
+
- `verifyGrant(signedGrant: ISignedGrant, granterPublicKey, options?): Promise<boolean>`: Verifies authenticity, integrity, and granter key fingerprint of an access grant, defeating key-substitution attacks.
|
|
52
|
+
- **Domain-Separated Key Derivation (`CKeyManager.deriveAuthAndEncryptionKeys`)**:
|
|
53
|
+
- `deriveAuthAndEncryptionKeys(password, salt?, options?): Promise<IDomainDerivedKeys>`: Hardened two-stage derivation pipeline. PBKDF2 stretches low-entropy user password and salt, then HKDF-Expand produces two cryptographically isolated keys (`authKey` for authentication challenges and `encryptionKey` for AES-GCM data encryption) using domain-separated context tags (`katlux-auth-key-v1` and `katlux-encryption-key-v1`). Full compromise of `authKey` reveals zero mathematical information about `encryptionKey`. Intermediate master secret buffers are immediately zeroized in memory.
|
|
54
|
+
|
|
55
|
+
|
|
36
56
|
|
|
37
57
|
- **Envelope Contract (`IEncryptedPayload`)**:
|
|
38
58
|
```ts
|
|
@@ -56,10 +76,19 @@ interface IEncryptedPayload {
|
|
|
56
76
|
```ts
|
|
57
77
|
interface IProviderEncryptionOptions {
|
|
58
78
|
enabled?: boolean // Master toggle (default: false)
|
|
59
|
-
key?: TKeyProvider //
|
|
79
|
+
key?: TKeyProvider // Single key or key provider (legacy/simple mode)
|
|
80
|
+
keys?: Record<string, TKeyProvider | IKeyPair> // Built-in Keyring dictionary mapping kid to keys
|
|
81
|
+
activeKid?: string // Active key identifier from keys to use for outbound encryption
|
|
60
82
|
kid?: string // Key identifier / version (e.g. 'v1', 'tenant-a-key-2026')
|
|
83
|
+
aad?: string | Uint8Array | ArrayBuffer | ((record: any, field: string) => string | Uint8Array | ArrayBuffer) // AEAD Additional Data or dynamic callback
|
|
84
|
+
aadFields?: string[] // Sibling record fields to deterministically bind into AAD (e.g. ['contact_id', 'version'])
|
|
85
|
+
baseAad?: string // Optional base prefix for AAD context binding
|
|
61
86
|
decryptOnSSR?: boolean // default: false. Prevents SSR decryption unless explicitly enabled with server secrets
|
|
62
87
|
fields?: string[] // Field-level encryption: only encrypt listed fields
|
|
88
|
+
strict?: boolean // Enforces strict decryption: unencrypted plaintext in `fields` triggers injection violation; defaults allowedAlgorithms to ['AES-GCM']
|
|
89
|
+
allowedAlgorithms?: string[] // Whitelist of permitted cipher algorithms (e.g. ['AES-GCM'])
|
|
90
|
+
allowedKids?: string[] // Whitelist of permitted Key Identifiers (kid); defaults to Object.keys(keys)
|
|
91
|
+
onDecryptError?: ((info: IDecryptErrorInfo) => any) | boolean | string // Per-field error hook, safe fallback marker, or true for '[⚠ Decryption Error]'
|
|
63
92
|
searchIndex?: boolean // Enables HMAC-SHA256 blind index and trigram search index on encrypted fields
|
|
64
93
|
hmacKey?: TKeyProvider // Optional dedicated HMAC key for search indexing (defaults to encryption key)
|
|
65
94
|
algorithm?: 'AES-GCM' | string // default: 'AES-GCM'
|
|
@@ -148,4 +177,12 @@ In multi-tenant, field-encrypted, and SSR scenarios, Katlux cryptographic provid
|
|
|
148
177
|
- **Nonce Misuse Resistance**: Initialization Vectors (IVs) are freshly generated via cryptographically secure RNG per operation (12 bytes for GCM, 16 bytes for CBC) with proven uniqueness across sibling fields, batch arrays, and concurrent executions.
|
|
149
178
|
- **Deterministic Search Token Segregation**: `CSearchIndex` HMAC-SHA256 blind index tokens are deterministic for search matching and strictly segregated from non-deterministic ciphertext IVs.
|
|
150
179
|
- **Non-Extractable Tenant Keys**: `CKeyManager.generateAccountDataKey()` and `CKeyManager.unwrapAccountKeyForUser()` produce `CryptoKey` instances with `extractable: false` by default, safeguarding unwrapped symmetric tenant keys against exfiltration via developer tools or malicious extensions.
|
|
180
|
+
- **Atomic Key Re-Wrapping (`CKeyManager.rewrapAccountKeyForUser`)**: When sharing an Account Data Encryption Key (ADEK) between users, `CKeyManager.rewrapAccountKeyForUser(wrappedKey, myPrivateKey, recipientPublicKey)` atomically decrypts the raw key material and re-encrypts it with the recipient's RSA-OAEP public key without ever exposing the raw extractable symmetric key to caller application memory or leaving extractable CryptoKeys in memory. Immediate memory zeroization (`fill(0)`) is guaranteed across all paths.
|
|
151
181
|
- **SSR Confidentiality & Cache Auth Guard**: With `decryptOnSSR: false` (the secure zero-trust default), plaintext is never exposed in server memory or serialized HTML hydration payloads. Requests with `cookie` or `Authorization` headers automatically bypass shared server caches (`CApplicationCache`), preventing cross-user session cache poisoning.
|
|
182
|
+
|
|
183
|
+
#### Built-in Keyring & Multi-Key Rotation Architecture
|
|
184
|
+
- **Zero-Downtime Key Rotation**: Configuring `keys: { 'k2025': key1, 'k2026': key2 }` alongside `activeKid: 'k2026'` ensures all outbound writes are automatically tagged with `kid: 'k2026'` and encrypted with `key2`, while legacy records tagged with `k2025` decrypt seamlessly under `key1`.
|
|
185
|
+
- **Automatic Whitelisting & Untrusted `kid` Protection**: `allowedKids` automatically defaults to `Object.keys(keys)` when `keys` is provided. Incoming envelopes carrying an unknown or unregistered `kid` are immediately rejected with an unauthorized key security error (`Unauthorized key: kid '${payload.kid}' is not in allowedKids.`).
|
|
186
|
+
- **Concurrent Multi-Key Warmup**: Calling `warmupKey()` (or `warmupKeySync()` on Node) resolves and primes all cryptographic keys across the entire keyring concurrently using `Promise.all`, preventing runtime latency spikes or race conditions during rotation periods.
|
|
187
|
+
- **Dynamic Runtime Keyring Management**: Keyrings can be rotated dynamically at runtime using `provider.setKeyring(newKeys, newActiveKid)` or `provider.setActiveKid(newKid)` without recreating provider instances or dropping existing session caches.
|
|
188
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@katlux/toolkit",
|
|
3
|
-
"version": "0.1.1-alpha.
|
|
3
|
+
"version": "0.1.1-alpha.139",
|
|
4
4
|
"description": "Core UI toolkit and utilities for the Katlux ecosystem",
|
|
5
5
|
"author": "Katlux",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"**/*.sass"
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@katlux/providers": "^0.1.1-alpha.
|
|
57
|
+
"@katlux/providers": "^0.1.1-alpha.127",
|
|
58
58
|
"@nuxt/kit": "^3.12.0",
|
|
59
59
|
"@nuxtjs/i18n": "^10.4.0",
|
|
60
60
|
"pug": "^3.0.0",
|