@revealui/core 0.3.0 → 0.5.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/dist/client/admin/components/AdminDashboard.d.ts.map +1 -1
- package/dist/client/admin/components/AdminDashboard.js +20 -3
- package/dist/client/richtext/index.d.ts.map +1 -1
- package/dist/client/richtext/plugins/FloatingToolbarPlugin.js +1 -3
- package/dist/collections/operations/create.d.ts +2 -1
- package/dist/collections/operations/create.d.ts.map +1 -1
- package/dist/collections/operations/create.js +28 -1
- package/dist/database/type-adapter.d.ts.map +1 -1
- package/dist/features.d.ts +13 -3
- package/dist/features.d.ts.map +1 -1
- package/dist/features.js +17 -0
- package/dist/globals/GlobalOperations.d.ts.map +1 -1
- package/dist/globals/GlobalOperations.js +12 -2
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/license.d.ts +6 -0
- package/dist/license.d.ts.map +1 -1
- package/dist/license.js +14 -1
- package/dist/monitoring/alerts.d.ts +4 -4
- package/dist/monitoring/alerts.d.ts.map +1 -1
- package/dist/plugins/nested-docs.d.ts.map +1 -1
- package/dist/plugins/nested-docs.js +0 -1
- package/dist/queries/queryBuilder.d.ts.map +1 -1
- package/dist/queries/queryBuilder.js +4 -3
- package/dist/richtext/index.d.ts.map +1 -1
- package/dist/storage/vercel-blob.d.ts.map +1 -1
- package/dist/storage/vercel-blob.js +3 -0
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/core.d.ts +1 -1
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/extensions.d.ts.map +1 -1
- package/dist/types/frontend.d.ts.map +1 -1
- package/dist/types/legacy.d.ts.map +1 -1
- package/dist/types/query.d.ts.map +1 -1
- package/dist/types/runtime.d.ts +1 -0
- package/dist/types/runtime.d.ts.map +1 -1
- package/dist/utils/error-responses.d.ts.map +1 -1
- package/dist/utils/error-responses.js +2 -3
- package/package.json +24 -24
- package/dist/caching/app-cache.d.ts +0 -242
- package/dist/caching/app-cache.d.ts.map +0 -1
- package/dist/caching/app-cache.js +0 -438
- package/dist/caching/cdn-config.d.ts +0 -155
- package/dist/caching/cdn-config.d.ts.map +0 -1
- package/dist/caching/cdn-config.js +0 -415
- package/dist/caching/edge-cache.d.ts +0 -177
- package/dist/caching/edge-cache.d.ts.map +0 -1
- package/dist/caching/edge-cache.js +0 -414
- package/dist/caching/service-worker.d.ts +0 -157
- package/dist/caching/service-worker.d.ts.map +0 -1
- package/dist/caching/service-worker.js +0 -438
- package/dist/client/admin/utils/auth.d.ts +0 -23
- package/dist/client/admin/utils/auth.d.ts.map +0 -1
- package/dist/client/admin/utils/auth.js +0 -52
- package/dist/client/http/client.d.ts +0 -15
- package/dist/client/http/client.d.ts.map +0 -1
- package/dist/client/http/client.js +0 -49
- package/dist/client/http/fetchBanner.d.ts +0 -18
- package/dist/client/http/fetchBanner.d.ts.map +0 -1
- package/dist/client/http/fetchBanner.js +0 -44
- package/dist/client/http/fetchCard.d.ts +0 -18
- package/dist/client/http/fetchCard.d.ts.map +0 -1
- package/dist/client/http/fetchCard.js +0 -46
- package/dist/client/http/fetchEvents.d.ts +0 -18
- package/dist/client/http/fetchEvents.d.ts.map +0 -1
- package/dist/client/http/fetchEvents.js +0 -44
- package/dist/client/http/fetchHero.d.ts +0 -17
- package/dist/client/http/fetchHero.d.ts.map +0 -1
- package/dist/client/http/fetchHero.js +0 -55
- package/dist/client/http/fetchMainInfos.d.ts +0 -17
- package/dist/client/http/fetchMainInfos.d.ts.map +0 -1
- package/dist/client/http/fetchMainInfos.js +0 -44
- package/dist/client/http/fetchVideos.d.ts +0 -13
- package/dist/client/http/fetchVideos.d.ts.map +0 -1
- package/dist/client/http/fetchVideos.js +0 -36
- package/dist/client/http/index.d.ts +0 -19
- package/dist/client/http/index.d.ts.map +0 -1
- package/dist/client/http/index.js +0 -11
- package/dist/error-handling/circuit-breaker.d.ts +0 -262
- package/dist/error-handling/circuit-breaker.d.ts.map +0 -1
- package/dist/error-handling/circuit-breaker.js +0 -550
- package/dist/error-handling/retry.d.ts +0 -194
- package/dist/error-handling/retry.d.ts.map +0 -1
- package/dist/error-handling/retry.js +0 -455
- package/dist/errors/index.d.ts +0 -23
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js +0 -40
- package/dist/generated/agents/index.d.ts +0 -8
- package/dist/generated/agents/index.d.ts.map +0 -1
- package/dist/generated/agents/index.js +0 -7
- package/dist/generated/components/index.d.ts +0 -8
- package/dist/generated/components/index.d.ts.map +0 -1
- package/dist/generated/components/index.js +0 -7
- package/dist/generated/functions/index.d.ts +0 -8
- package/dist/generated/functions/index.d.ts.map +0 -1
- package/dist/generated/functions/index.js +0 -7
- package/dist/generated/hooks/index.d.ts +0 -8
- package/dist/generated/hooks/index.d.ts.map +0 -1
- package/dist/generated/hooks/index.js +0 -7
- package/dist/generated/plans/index.d.ts +0 -8
- package/dist/generated/plans/index.d.ts.map +0 -1
- package/dist/generated/plans/index.js +0 -7
- package/dist/generated/prompts/index.d.ts +0 -8
- package/dist/generated/prompts/index.d.ts.map +0 -1
- package/dist/generated/prompts/index.js +0 -7
- package/dist/generated/tools/index.d.ts +0 -8
- package/dist/generated/tools/index.d.ts.map +0 -1
- package/dist/generated/tools/index.js +0 -7
- package/dist/generated/types/supabase.d.ts +0 -193
- package/dist/generated/types/supabase.d.ts.map +0 -1
- package/dist/generated/types/supabase.js +0 -5
- package/dist/optimization/asset-optimizer.d.ts +0 -206
- package/dist/optimization/asset-optimizer.d.ts.map +0 -1
- package/dist/optimization/asset-optimizer.js +0 -336
- package/dist/optimization/build-optimizer.d.ts +0 -202
- package/dist/optimization/build-optimizer.d.ts.map +0 -1
- package/dist/optimization/build-optimizer.js +0 -271
- package/dist/optimization/bundle-analyzer.d.ts +0 -98
- package/dist/optimization/bundle-analyzer.d.ts.map +0 -1
- package/dist/optimization/bundle-analyzer.js +0 -346
- package/dist/optimization/code-splitting.d.ts +0 -121
- package/dist/optimization/code-splitting.d.ts.map +0 -1
- package/dist/optimization/code-splitting.js +0 -261
- package/dist/plugin/index.d.ts +0 -12
- package/dist/plugin/index.d.ts.map +0 -1
- package/dist/plugin/index.js +0 -4
- package/dist/security/audit.d.ts +0 -188
- package/dist/security/audit.d.ts.map +0 -1
- package/dist/security/audit.js +0 -433
- package/dist/security/auth.d.ts +0 -110
- package/dist/security/auth.d.ts.map +0 -1
- package/dist/security/auth.js +0 -257
- package/dist/security/authorization.d.ts +0 -211
- package/dist/security/authorization.d.ts.map +0 -1
- package/dist/security/authorization.js +0 -492
- package/dist/security/encryption.d.ts +0 -226
- package/dist/security/encryption.d.ts.map +0 -1
- package/dist/security/encryption.js +0 -534
- package/dist/security/gdpr-storage.d.ts +0 -102
- package/dist/security/gdpr-storage.d.ts.map +0 -1
- package/dist/security/gdpr-storage.js +0 -65
- package/dist/security/gdpr.d.ts +0 -320
- package/dist/security/gdpr.d.ts.map +0 -1
- package/dist/security/gdpr.js +0 -531
- package/dist/security/headers.d.ts +0 -184
- package/dist/security/headers.d.ts.map +0 -1
- package/dist/security/headers.js +0 -420
- package/dist/utils/jwt-validation.d.ts +0 -14
- package/dist/utils/jwt-validation.d.ts.map +0 -1
- package/dist/utils/jwt-validation.js +0 -36
- package/dist/utils/request-headers.d.ts +0 -15
- package/dist/utils/request-headers.d.ts.map +0 -1
- package/dist/utils/request-headers.js +0 -31
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../src/security/encryption.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,EA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M5C;AAED;;GAEG;AACH,iBAAS,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKpC;AAED;;GAEG;AACH,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,GAAE,MAAU,GAAG,MAAM,CAU9D;AAED,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC;AAEX;;GAEG;AAEH;;;GAGG;AACH,iBAAS,aAAa,CAAC,MAAM,GAAE,MAAW,GAAG,MAAM,CAKlD;AAED;;GAEG;AACH,iBAAS,YAAY,IAAI,MAAM,CAO9B;AAED;;GAEG;AACH,iBAAS,cAAc,CAAC,MAAM,GAAE,MAAa,GAAG,MAAM,CAGrD;AAED;;GAEG;AACH,iBAAS,iBAAiB,IAAI,MAAM,CAEnC;AAED,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC"}
|
|
@@ -1,534 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encryption Utilities
|
|
3
|
-
*
|
|
4
|
-
* Data encryption for at-rest and in-transit protection
|
|
5
|
-
*/
|
|
6
|
-
const DEFAULT_CONFIG = {
|
|
7
|
-
algorithm: 'AES-GCM',
|
|
8
|
-
keySize: 256,
|
|
9
|
-
ivSize: 12,
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Encryption system
|
|
13
|
-
*/
|
|
14
|
-
export class EncryptionSystem {
|
|
15
|
-
config;
|
|
16
|
-
keys = new Map();
|
|
17
|
-
constructor(config = {}) {
|
|
18
|
-
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Generate encryption key
|
|
22
|
-
*/
|
|
23
|
-
async generateKey(keyId) {
|
|
24
|
-
const crypto = globalThis.crypto;
|
|
25
|
-
if (!crypto) {
|
|
26
|
-
throw new Error('Crypto API not available');
|
|
27
|
-
}
|
|
28
|
-
const key = await crypto.subtle.generateKey({
|
|
29
|
-
name: this.config.algorithm,
|
|
30
|
-
length: this.config.keySize,
|
|
31
|
-
}, true, // extractable
|
|
32
|
-
['encrypt', 'decrypt']);
|
|
33
|
-
if (keyId) {
|
|
34
|
-
this.keys.set(keyId, key);
|
|
35
|
-
}
|
|
36
|
-
return key;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Import key from raw data
|
|
40
|
-
*/
|
|
41
|
-
async importKey(keyData, keyId) {
|
|
42
|
-
const crypto = globalThis.crypto;
|
|
43
|
-
if (!crypto) {
|
|
44
|
-
throw new Error('Crypto API not available');
|
|
45
|
-
}
|
|
46
|
-
const key = await crypto.subtle.importKey('raw', keyData, {
|
|
47
|
-
name: this.config.algorithm,
|
|
48
|
-
length: this.config.keySize,
|
|
49
|
-
}, true, ['encrypt', 'decrypt']);
|
|
50
|
-
if (keyId) {
|
|
51
|
-
this.keys.set(keyId, key);
|
|
52
|
-
}
|
|
53
|
-
return key;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Export key to raw data
|
|
57
|
-
*/
|
|
58
|
-
async exportKey(key) {
|
|
59
|
-
const crypto = globalThis.crypto;
|
|
60
|
-
if (!crypto) {
|
|
61
|
-
throw new Error('Crypto API not available');
|
|
62
|
-
}
|
|
63
|
-
return crypto.subtle.exportKey('raw', key);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Encrypt data
|
|
67
|
-
*/
|
|
68
|
-
async encrypt(data, keyOrId) {
|
|
69
|
-
const crypto = globalThis.crypto;
|
|
70
|
-
if (!crypto) {
|
|
71
|
-
throw new Error('Crypto API not available');
|
|
72
|
-
}
|
|
73
|
-
// Get key
|
|
74
|
-
const key = typeof keyOrId === 'string' ? this.keys.get(keyOrId) : keyOrId;
|
|
75
|
-
if (!key) {
|
|
76
|
-
throw new Error('Key not found');
|
|
77
|
-
}
|
|
78
|
-
// Generate IV
|
|
79
|
-
const iv = crypto.getRandomValues(new Uint8Array(this.config.ivSize || 12));
|
|
80
|
-
// Encode data
|
|
81
|
-
const encoder = new TextEncoder();
|
|
82
|
-
const encodedData = encoder.encode(data);
|
|
83
|
-
// Encrypt
|
|
84
|
-
const encrypted = await crypto.subtle.encrypt({
|
|
85
|
-
name: this.config.algorithm,
|
|
86
|
-
iv,
|
|
87
|
-
}, key, encodedData);
|
|
88
|
-
// Convert to base64
|
|
89
|
-
const encryptedArray = new Uint8Array(encrypted);
|
|
90
|
-
const ivArray = new Uint8Array(iv);
|
|
91
|
-
return {
|
|
92
|
-
data: this.arrayBufferToBase64(encryptedArray),
|
|
93
|
-
iv: this.arrayBufferToBase64(ivArray),
|
|
94
|
-
algorithm: this.config.algorithm,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Decrypt data
|
|
99
|
-
*/
|
|
100
|
-
async decrypt(encryptedData, keyOrId) {
|
|
101
|
-
const crypto = globalThis.crypto;
|
|
102
|
-
if (!crypto) {
|
|
103
|
-
throw new Error('Crypto API not available');
|
|
104
|
-
}
|
|
105
|
-
// Get key
|
|
106
|
-
const key = typeof keyOrId === 'string' ? this.keys.get(keyOrId) : keyOrId;
|
|
107
|
-
if (!key) {
|
|
108
|
-
throw new Error('Key not found');
|
|
109
|
-
}
|
|
110
|
-
// Decode data
|
|
111
|
-
const data = this.base64ToArrayBuffer(encryptedData.data);
|
|
112
|
-
const iv = this.base64ToArrayBuffer(encryptedData.iv);
|
|
113
|
-
// Decrypt
|
|
114
|
-
const decrypted = await crypto.subtle.decrypt({
|
|
115
|
-
name: encryptedData.algorithm,
|
|
116
|
-
iv: iv,
|
|
117
|
-
}, key, data);
|
|
118
|
-
// Decode text
|
|
119
|
-
const decoder = new TextDecoder();
|
|
120
|
-
return decoder.decode(decrypted);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Encrypt object
|
|
124
|
-
*/
|
|
125
|
-
async encryptObject(obj, keyOrId) {
|
|
126
|
-
const json = JSON.stringify(obj);
|
|
127
|
-
return this.encrypt(json, keyOrId);
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Decrypt object
|
|
131
|
-
*/
|
|
132
|
-
async decryptObject(encryptedData, keyOrId) {
|
|
133
|
-
const json = await this.decrypt(encryptedData, keyOrId);
|
|
134
|
-
return JSON.parse(json);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Hash data
|
|
138
|
-
*/
|
|
139
|
-
async hash(data, algorithm = 'SHA-256') {
|
|
140
|
-
const crypto = globalThis.crypto;
|
|
141
|
-
if (!crypto) {
|
|
142
|
-
throw new Error('Crypto API not available');
|
|
143
|
-
}
|
|
144
|
-
const encoder = new TextEncoder();
|
|
145
|
-
const encodedData = encoder.encode(data);
|
|
146
|
-
const hashBuffer = await crypto.subtle.digest(algorithm, encodedData);
|
|
147
|
-
return this.arrayBufferToBase64(new Uint8Array(hashBuffer));
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Generate random bytes
|
|
151
|
-
*/
|
|
152
|
-
randomBytes(length) {
|
|
153
|
-
const crypto = globalThis.crypto;
|
|
154
|
-
if (!crypto) {
|
|
155
|
-
throw new Error('Crypto API not available');
|
|
156
|
-
}
|
|
157
|
-
return crypto.getRandomValues(new Uint8Array(length));
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Generate random string
|
|
161
|
-
*/
|
|
162
|
-
randomString(length, charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') {
|
|
163
|
-
// Rejection sampling to avoid modulo bias:
|
|
164
|
-
// Only accept bytes below the largest multiple of charset.length that fits in a byte.
|
|
165
|
-
const maxValid = 256 - (256 % charset.length);
|
|
166
|
-
const result = [];
|
|
167
|
-
while (result.length < length) {
|
|
168
|
-
const bytes = this.randomBytes(length - result.length + 16);
|
|
169
|
-
for (const byte of bytes) {
|
|
170
|
-
if (byte < maxValid) {
|
|
171
|
-
result.push(charset[byte % charset.length]);
|
|
172
|
-
if (result.length === length)
|
|
173
|
-
break;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return result.join('');
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Convert ArrayBuffer to base64
|
|
181
|
-
*/
|
|
182
|
-
arrayBufferToBase64(buffer) {
|
|
183
|
-
const bytes = Array.from(buffer);
|
|
184
|
-
const binary = bytes.map((byte) => String.fromCharCode(byte)).join('');
|
|
185
|
-
if (typeof btoa !== 'undefined') {
|
|
186
|
-
return btoa(binary);
|
|
187
|
-
}
|
|
188
|
-
if (typeof Buffer !== 'undefined') {
|
|
189
|
-
return Buffer.from(binary, 'binary').toString('base64');
|
|
190
|
-
}
|
|
191
|
-
throw new Error('No base64 encoding available');
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Convert base64 to ArrayBuffer
|
|
195
|
-
*/
|
|
196
|
-
base64ToArrayBuffer(base64) {
|
|
197
|
-
let binary;
|
|
198
|
-
if (typeof atob !== 'undefined') {
|
|
199
|
-
binary = atob(base64);
|
|
200
|
-
}
|
|
201
|
-
else if (typeof Buffer !== 'undefined') {
|
|
202
|
-
binary = Buffer.from(base64, 'base64').toString('binary');
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
throw new Error('No base64 decoding available');
|
|
206
|
-
}
|
|
207
|
-
const bytes = new Uint8Array(binary.length);
|
|
208
|
-
for (let i = 0; i < binary.length; i++) {
|
|
209
|
-
bytes[i] = binary.charCodeAt(i);
|
|
210
|
-
}
|
|
211
|
-
return bytes;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Store key
|
|
215
|
-
*/
|
|
216
|
-
storeKey(keyId, key) {
|
|
217
|
-
this.keys.set(keyId, key);
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Get key
|
|
221
|
-
*/
|
|
222
|
-
getKey(keyId) {
|
|
223
|
-
return this.keys.get(keyId);
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Remove key
|
|
227
|
-
*/
|
|
228
|
-
removeKey(keyId) {
|
|
229
|
-
this.keys.delete(keyId);
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Clear all keys
|
|
233
|
-
*/
|
|
234
|
-
clearKeys() {
|
|
235
|
-
this.keys.clear();
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Global encryption instance
|
|
240
|
-
*/
|
|
241
|
-
export const encryption = new EncryptionSystem();
|
|
242
|
-
/**
|
|
243
|
-
* Field-level encryption
|
|
244
|
-
*/
|
|
245
|
-
export class FieldEncryption {
|
|
246
|
-
encryption;
|
|
247
|
-
key = null;
|
|
248
|
-
constructor(encryption) {
|
|
249
|
-
this.encryption = encryption;
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Initialize with key
|
|
253
|
-
*/
|
|
254
|
-
async initialize(key) {
|
|
255
|
-
this.key = key;
|
|
256
|
-
}
|
|
257
|
-
/**
|
|
258
|
-
* Encrypt field
|
|
259
|
-
*/
|
|
260
|
-
async encryptField(value) {
|
|
261
|
-
if (!this.key) {
|
|
262
|
-
throw new Error('Encryption not initialized');
|
|
263
|
-
}
|
|
264
|
-
const stringValue = typeof value === 'string' ? value : JSON.stringify(value);
|
|
265
|
-
return this.encryption.encrypt(stringValue, this.key);
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Decrypt field
|
|
269
|
-
*/
|
|
270
|
-
async decryptField(encryptedData) {
|
|
271
|
-
if (!this.key) {
|
|
272
|
-
throw new Error('Encryption not initialized');
|
|
273
|
-
}
|
|
274
|
-
const decrypted = await this.encryption.decrypt(encryptedData, this.key);
|
|
275
|
-
// Try to parse as JSON
|
|
276
|
-
try {
|
|
277
|
-
return JSON.parse(decrypted);
|
|
278
|
-
}
|
|
279
|
-
catch {
|
|
280
|
-
return decrypted;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Encrypt object fields
|
|
285
|
-
*/
|
|
286
|
-
async encryptFields(obj, fields) {
|
|
287
|
-
const result = { ...obj };
|
|
288
|
-
for (const field of fields) {
|
|
289
|
-
if (field in result) {
|
|
290
|
-
result[field] = (await this.encryptField(result[field]));
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return result;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Decrypt object fields
|
|
297
|
-
*/
|
|
298
|
-
async decryptFields(obj, fields) {
|
|
299
|
-
const result = { ...obj };
|
|
300
|
-
for (const field of fields) {
|
|
301
|
-
if (field in result && typeof result[field] === 'object' && result[field] !== null) {
|
|
302
|
-
const encryptedData = result[field];
|
|
303
|
-
if ('data' in encryptedData && 'iv' in encryptedData) {
|
|
304
|
-
result[field] = (await this.decryptField(encryptedData));
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
return result;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Key rotation
|
|
313
|
-
*/
|
|
314
|
-
export class KeyRotationManager {
|
|
315
|
-
encryption;
|
|
316
|
-
currentKeyId;
|
|
317
|
-
oldKeys = new Map();
|
|
318
|
-
keyCreationDates = new Map();
|
|
319
|
-
constructor(encryption, initialKeyId) {
|
|
320
|
-
this.encryption = encryption;
|
|
321
|
-
this.currentKeyId = initialKeyId;
|
|
322
|
-
this.keyCreationDates.set(initialKeyId, new Date());
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Rotate to new key
|
|
326
|
-
*/
|
|
327
|
-
async rotate(newKeyId, newKey) {
|
|
328
|
-
// Store old key
|
|
329
|
-
const oldKey = this.encryption.getKey(this.currentKeyId);
|
|
330
|
-
if (oldKey) {
|
|
331
|
-
this.oldKeys.set(this.currentKeyId, oldKey);
|
|
332
|
-
}
|
|
333
|
-
// Set new key
|
|
334
|
-
this.encryption.storeKey(newKeyId, newKey);
|
|
335
|
-
this.currentKeyId = newKeyId;
|
|
336
|
-
this.keyCreationDates.set(newKeyId, new Date());
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Re-encrypt data with new key
|
|
340
|
-
*/
|
|
341
|
-
async reencrypt(encryptedData, oldKeyId) {
|
|
342
|
-
// Get keys
|
|
343
|
-
const oldKey = this.oldKeys.get(oldKeyId) || this.encryption.getKey(oldKeyId);
|
|
344
|
-
const newKey = this.encryption.getKey(this.currentKeyId);
|
|
345
|
-
if (!(oldKey && newKey)) {
|
|
346
|
-
throw new Error('Keys not found');
|
|
347
|
-
}
|
|
348
|
-
// Decrypt with old key
|
|
349
|
-
const decrypted = await this.encryption.decrypt(encryptedData, oldKey);
|
|
350
|
-
// Encrypt with new key
|
|
351
|
-
return this.encryption.encrypt(decrypted, newKey);
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Get current key ID
|
|
355
|
-
*/
|
|
356
|
-
getCurrentKeyId() {
|
|
357
|
-
return this.currentKeyId;
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Clean up old keys created before the specified date.
|
|
361
|
-
* Never removes the current active key.
|
|
362
|
-
*/
|
|
363
|
-
cleanupOldKeys(olderThan) {
|
|
364
|
-
for (const [keyId, createdAt] of this.keyCreationDates.entries()) {
|
|
365
|
-
if (keyId !== this.currentKeyId && createdAt < olderThan) {
|
|
366
|
-
this.oldKeys.delete(keyId);
|
|
367
|
-
this.encryption.removeKey(keyId);
|
|
368
|
-
this.keyCreationDates.delete(keyId);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Envelope encryption for large data
|
|
375
|
-
*/
|
|
376
|
-
export class EnvelopeEncryption {
|
|
377
|
-
encryption;
|
|
378
|
-
masterKey;
|
|
379
|
-
constructor(encryption, masterKey) {
|
|
380
|
-
this.encryption = encryption;
|
|
381
|
-
this.masterKey = masterKey;
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Encrypt with envelope encryption
|
|
385
|
-
*/
|
|
386
|
-
async encrypt(data) {
|
|
387
|
-
// Generate data encryption key (DEK)
|
|
388
|
-
const dek = await this.encryption.generateKey();
|
|
389
|
-
// Encrypt data with DEK
|
|
390
|
-
const encryptedData = await this.encryption.encrypt(data, dek);
|
|
391
|
-
// Export DEK
|
|
392
|
-
const dekRaw = await this.encryption.exportKey(dek);
|
|
393
|
-
const dekBase64 = this.arrayBufferToBase64(new Uint8Array(dekRaw));
|
|
394
|
-
// Encrypt DEK with master key
|
|
395
|
-
const encryptedKey = await this.encryption.encrypt(dekBase64, this.masterKey);
|
|
396
|
-
return { encryptedData, encryptedKey };
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* Decrypt with envelope encryption
|
|
400
|
-
*/
|
|
401
|
-
async decrypt(encryptedData, encryptedKey) {
|
|
402
|
-
// Decrypt DEK with master key
|
|
403
|
-
const dekBase64 = await this.encryption.decrypt(encryptedKey, this.masterKey);
|
|
404
|
-
const dekRaw = this.base64ToArrayBuffer(dekBase64);
|
|
405
|
-
// Import DEK
|
|
406
|
-
const dek = await this.encryption.importKey(dekRaw.buffer);
|
|
407
|
-
// Decrypt data with DEK
|
|
408
|
-
return this.encryption.decrypt(encryptedData, dek);
|
|
409
|
-
}
|
|
410
|
-
arrayBufferToBase64(buffer) {
|
|
411
|
-
const bytes = Array.from(buffer);
|
|
412
|
-
const binary = bytes.map((byte) => String.fromCharCode(byte)).join('');
|
|
413
|
-
return typeof btoa !== 'undefined'
|
|
414
|
-
? btoa(binary)
|
|
415
|
-
: Buffer.from(binary, 'binary').toString('base64');
|
|
416
|
-
}
|
|
417
|
-
base64ToArrayBuffer(base64) {
|
|
418
|
-
const binary = typeof atob !== 'undefined' ? atob(base64) : Buffer.from(base64, 'base64').toString('binary');
|
|
419
|
-
const bytes = new Uint8Array(binary.length);
|
|
420
|
-
for (let i = 0; i < binary.length; i++) {
|
|
421
|
-
bytes[i] = binary.charCodeAt(i);
|
|
422
|
-
}
|
|
423
|
-
return bytes;
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Data masking utilities
|
|
428
|
-
*/
|
|
429
|
-
/**
|
|
430
|
-
* Mask email
|
|
431
|
-
*/
|
|
432
|
-
function maskEmail(email) {
|
|
433
|
-
const [local, domain] = email.split('@');
|
|
434
|
-
if (!(local && domain))
|
|
435
|
-
return email;
|
|
436
|
-
const maskedLocal = local.length > 2
|
|
437
|
-
? local[0] + '*'.repeat(local.length - 2) + local[local.length - 1]
|
|
438
|
-
: `${local[0]}*`;
|
|
439
|
-
return `${maskedLocal}@${domain}`;
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* Mask phone number
|
|
443
|
-
*/
|
|
444
|
-
function maskPhone(phone) {
|
|
445
|
-
const digits = phone.replace(/\D/g, '');
|
|
446
|
-
if (digits.length < 4)
|
|
447
|
-
return phone;
|
|
448
|
-
const lastFour = digits.slice(-4);
|
|
449
|
-
const masked = '*'.repeat(digits.length - 4) + lastFour;
|
|
450
|
-
return phone.replace(/\d/g, (char, index) => {
|
|
451
|
-
const digitIndex = phone.slice(0, index + 1).replace(/\D/g, '').length - 1;
|
|
452
|
-
return masked[digitIndex] || char;
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Mask credit card
|
|
457
|
-
*/
|
|
458
|
-
function maskCreditCard(card) {
|
|
459
|
-
const digits = card.replace(/\D/g, '');
|
|
460
|
-
if (digits.length < 4)
|
|
461
|
-
return card;
|
|
462
|
-
const lastFour = digits.slice(-4);
|
|
463
|
-
return `****-****-****-${lastFour}`;
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* Mask SSN
|
|
467
|
-
*/
|
|
468
|
-
function maskSSN(ssn) {
|
|
469
|
-
const digits = ssn.replace(/\D/g, '');
|
|
470
|
-
if (digits.length !== 9)
|
|
471
|
-
return ssn;
|
|
472
|
-
return `***-**-${digits.slice(-4)}`;
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* Mask string (keep first and last character)
|
|
476
|
-
*/
|
|
477
|
-
function maskString(str, keepChars = 1) {
|
|
478
|
-
if (str.length <= keepChars * 2) {
|
|
479
|
-
return '*'.repeat(str.length);
|
|
480
|
-
}
|
|
481
|
-
const prefix = str.slice(0, keepChars);
|
|
482
|
-
const suffix = str.slice(-keepChars);
|
|
483
|
-
const masked = '*'.repeat(str.length - keepChars * 2);
|
|
484
|
-
return `${prefix}${masked}${suffix}`;
|
|
485
|
-
}
|
|
486
|
-
export const DataMasking = {
|
|
487
|
-
maskEmail,
|
|
488
|
-
maskPhone,
|
|
489
|
-
maskCreditCard,
|
|
490
|
-
maskSSN,
|
|
491
|
-
maskString,
|
|
492
|
-
};
|
|
493
|
-
/**
|
|
494
|
-
* Secure random token generator
|
|
495
|
-
*/
|
|
496
|
-
/**
|
|
497
|
-
* Generate secure token. `length` is the number of random bytes;
|
|
498
|
-
* the returned string is hex-encoded, so it will be `length * 2` characters.
|
|
499
|
-
*/
|
|
500
|
-
function generateToken(length = 32) {
|
|
501
|
-
const bytes = encryption.randomBytes(length);
|
|
502
|
-
return Array.from(bytes)
|
|
503
|
-
.map((b) => b.toString(16).padStart(2, '0'))
|
|
504
|
-
.join('');
|
|
505
|
-
}
|
|
506
|
-
/**
|
|
507
|
-
* Generate UUID v4
|
|
508
|
-
*/
|
|
509
|
-
function generateUUID() {
|
|
510
|
-
const crypto = globalThis.crypto;
|
|
511
|
-
if (!crypto) {
|
|
512
|
-
throw new Error('Crypto API not available');
|
|
513
|
-
}
|
|
514
|
-
return crypto.randomUUID();
|
|
515
|
-
}
|
|
516
|
-
/**
|
|
517
|
-
* Generate API key
|
|
518
|
-
*/
|
|
519
|
-
function generateAPIKey(prefix = 'sk') {
|
|
520
|
-
const token = generateToken(32);
|
|
521
|
-
return `${prefix}_${token}`;
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* Generate session ID
|
|
525
|
-
*/
|
|
526
|
-
function generateSessionID() {
|
|
527
|
-
return generateToken(64);
|
|
528
|
-
}
|
|
529
|
-
export const TokenGenerator = {
|
|
530
|
-
generate: generateToken,
|
|
531
|
-
generateUUID,
|
|
532
|
-
generateAPIKey,
|
|
533
|
-
generateSessionID,
|
|
534
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GDPR Storage Abstraction
|
|
3
|
-
*
|
|
4
|
-
* Record-oriented storage interface for GDPR compliance data.
|
|
5
|
-
* Provides a clean seam for replacing the default in-memory implementation
|
|
6
|
-
* with a database-backed store in production.
|
|
7
|
-
*/
|
|
8
|
-
import type { ConsentRecord, ConsentType, DataBreach, DataDeletionRequest } from './gdpr.js';
|
|
9
|
-
/**
|
|
10
|
-
* Storage interface for GDPR consent records and deletion requests.
|
|
11
|
-
*
|
|
12
|
-
* All methods are async to support database-backed implementations.
|
|
13
|
-
* The default `InMemoryGDPRStorage` is suitable for testing and development
|
|
14
|
-
* but must be replaced with a persistent store for production use.
|
|
15
|
-
*/
|
|
16
|
-
export interface GDPRStorage {
|
|
17
|
-
/**
|
|
18
|
-
* Store or update a consent record, keyed by `userId:consentType`.
|
|
19
|
-
*/
|
|
20
|
-
setConsent(userId: string, type: ConsentType, record: ConsentRecord): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* Retrieve a consent record by user and type. Returns `undefined` if not found.
|
|
23
|
-
*/
|
|
24
|
-
getConsent(userId: string, type: ConsentType): Promise<ConsentRecord | undefined>;
|
|
25
|
-
/**
|
|
26
|
-
* Retrieve all consent records for a given user.
|
|
27
|
-
*/
|
|
28
|
-
getConsentsByUser(userId: string): Promise<ConsentRecord[]>;
|
|
29
|
-
/**
|
|
30
|
-
* Retrieve every consent record in storage (used for aggregate statistics).
|
|
31
|
-
*/
|
|
32
|
-
getAllConsents(): Promise<ConsentRecord[]>;
|
|
33
|
-
/**
|
|
34
|
-
* Store a deletion request, keyed by its `id`.
|
|
35
|
-
*/
|
|
36
|
-
setDeletionRequest(request: DataDeletionRequest): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Retrieve a deletion request by ID. Returns `undefined` if not found.
|
|
39
|
-
*/
|
|
40
|
-
getDeletionRequest(requestId: string): Promise<DataDeletionRequest | undefined>;
|
|
41
|
-
/**
|
|
42
|
-
* Retrieve all deletion requests for a given user.
|
|
43
|
-
*/
|
|
44
|
-
getDeletionRequestsByUser(userId: string): Promise<DataDeletionRequest[]>;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Storage interface for data breach records.
|
|
48
|
-
*
|
|
49
|
-
* All methods are async to support database-backed implementations.
|
|
50
|
-
* The default `InMemoryBreachStorage` is suitable for testing and development
|
|
51
|
-
* but must be replaced with a persistent store for production GDPR compliance.
|
|
52
|
-
*/
|
|
53
|
-
export interface BreachStorage {
|
|
54
|
-
/**
|
|
55
|
-
* Store a data breach record.
|
|
56
|
-
*/
|
|
57
|
-
setBreach(breach: DataBreach): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Retrieve a breach by ID. Returns `undefined` if not found.
|
|
60
|
-
*/
|
|
61
|
-
getBreach(id: string): Promise<DataBreach | undefined>;
|
|
62
|
-
/**
|
|
63
|
-
* Retrieve all breach records.
|
|
64
|
-
*/
|
|
65
|
-
getAllBreaches(): Promise<DataBreach[]>;
|
|
66
|
-
/**
|
|
67
|
-
* Update an existing breach record (e.g., status change, add mitigation).
|
|
68
|
-
*/
|
|
69
|
-
updateBreach(id: string, updates: Partial<DataBreach>): Promise<void>;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* In-memory implementation of `BreachStorage`.
|
|
73
|
-
*
|
|
74
|
-
* WARNING: All data is lost on process restart or serverless cold start.
|
|
75
|
-
* GDPR requires breach records be retained — use database-backed storage in production.
|
|
76
|
-
*/
|
|
77
|
-
export declare class InMemoryBreachStorage implements BreachStorage {
|
|
78
|
-
private breaches;
|
|
79
|
-
setBreach(breach: DataBreach): Promise<void>;
|
|
80
|
-
getBreach(id: string): Promise<DataBreach | undefined>;
|
|
81
|
-
getAllBreaches(): Promise<DataBreach[]>;
|
|
82
|
-
updateBreach(id: string, updates: Partial<DataBreach>): Promise<void>;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* In-memory implementation of `GDPRStorage`.
|
|
86
|
-
*
|
|
87
|
-
* WARNING: All data is lost on process restart or serverless cold start.
|
|
88
|
-
* Use this only for development, testing, or as a reference implementation.
|
|
89
|
-
* Production deployments MUST supply a database-backed `GDPRStorage`.
|
|
90
|
-
*/
|
|
91
|
-
export declare class InMemoryGDPRStorage implements GDPRStorage {
|
|
92
|
-
private consents;
|
|
93
|
-
private deletionRequests;
|
|
94
|
-
setConsent(userId: string, type: ConsentType, record: ConsentRecord): Promise<void>;
|
|
95
|
-
getConsent(userId: string, type: ConsentType): Promise<ConsentRecord | undefined>;
|
|
96
|
-
getConsentsByUser(userId: string): Promise<ConsentRecord[]>;
|
|
97
|
-
getAllConsents(): Promise<ConsentRecord[]>;
|
|
98
|
-
setDeletionRequest(request: DataDeletionRequest): Promise<void>;
|
|
99
|
-
getDeletionRequest(requestId: string): Promise<DataDeletionRequest | undefined>;
|
|
100
|
-
getDeletionRequestsByUser(userId: string): Promise<DataDeletionRequest[]>;
|
|
101
|
-
}
|
|
102
|
-
//# sourceMappingURL=gdpr-storage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gdpr-storage.d.ts","sourceRoot":"","sources":["../../src/security/gdpr-storage.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAE7F;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAG1B;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpF;;OAEG;IACH,UAAU,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