@efsf/typescript 0.1.0
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 +242 -0
- package/dist/index.d.mts +990 -0
- package/dist/index.d.ts +990 -0
- package/dist/index.js +1382 -0
- package/dist/index.mjs +1322 -0
- package/package.json +85 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,990 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EFSF Destruction Certificates
|
|
3
|
+
*
|
|
4
|
+
* Provides cryptographically signed proof of data destruction
|
|
5
|
+
* for compliance and audit purposes (GDPR, CCPA, HIPAA, SOX).
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Methods used to destroy data.
|
|
9
|
+
*/
|
|
10
|
+
declare enum DestructionMethod {
|
|
11
|
+
/** Encryption key destroyed, data unrecoverable */
|
|
12
|
+
CRYPTO_SHRED = "crypto_shred",
|
|
13
|
+
/** Memory overwritten with zeros */
|
|
14
|
+
MEMORY_ZERO = "memory_zero",
|
|
15
|
+
/** Multiple overwrites (secure deletion) */
|
|
16
|
+
SECURE_DELETE = "secure_delete",
|
|
17
|
+
/** Trusted Execution Environment terminated */
|
|
18
|
+
TEE_EXIT = "tee_exit",
|
|
19
|
+
/** Storage TTL triggered automatic expiration */
|
|
20
|
+
TTL_EXPIRE = "ttl_expire",
|
|
21
|
+
/** Explicit deletion request */
|
|
22
|
+
MANUAL = "manual"
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Serialized format for resource info.
|
|
26
|
+
*/
|
|
27
|
+
interface ResourceInfoData {
|
|
28
|
+
type: string;
|
|
29
|
+
id: string;
|
|
30
|
+
classification: string;
|
|
31
|
+
metadata: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Describes a resource that was destroyed.
|
|
35
|
+
*/
|
|
36
|
+
declare class ResourceInfo {
|
|
37
|
+
readonly resourceType: string;
|
|
38
|
+
readonly resourceId: string;
|
|
39
|
+
readonly classification: string;
|
|
40
|
+
readonly metadata: Record<string, unknown>;
|
|
41
|
+
constructor(resourceType: string, resourceId: string, classification: string, metadata?: Record<string, unknown>);
|
|
42
|
+
/**
|
|
43
|
+
* Convert to a plain object for serialization.
|
|
44
|
+
*/
|
|
45
|
+
toDict(): ResourceInfoData;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* An access event in the chain of custody.
|
|
49
|
+
*/
|
|
50
|
+
interface AccessEvent {
|
|
51
|
+
timestamp: string;
|
|
52
|
+
accessor: string;
|
|
53
|
+
action: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Serialized format for chain of custody.
|
|
57
|
+
*/
|
|
58
|
+
interface ChainOfCustodyData {
|
|
59
|
+
created_at: string;
|
|
60
|
+
created_by: string | null;
|
|
61
|
+
access_count: number;
|
|
62
|
+
hash_chain: string[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Tracks the lifecycle of a resource with tamper-evident logging.
|
|
66
|
+
*
|
|
67
|
+
* The hash chain provides cryptographic proof that the access log
|
|
68
|
+
* has not been modified after the fact.
|
|
69
|
+
*/
|
|
70
|
+
declare class ChainOfCustody {
|
|
71
|
+
readonly createdAt: Date;
|
|
72
|
+
readonly createdBy: string | null;
|
|
73
|
+
readonly accessLog: AccessEvent[];
|
|
74
|
+
readonly hashChain: string[];
|
|
75
|
+
constructor(createdAt: Date, createdBy?: string | null);
|
|
76
|
+
/**
|
|
77
|
+
* Record an access event and extend the hash chain.
|
|
78
|
+
*
|
|
79
|
+
* @param accessor - Identity of the accessor
|
|
80
|
+
* @param action - Action performed (create, read, destroy, etc.)
|
|
81
|
+
* @param timestamp - Optional timestamp (defaults to now)
|
|
82
|
+
*/
|
|
83
|
+
addAccess(accessor: string, action: string, timestamp?: Date): void;
|
|
84
|
+
/**
|
|
85
|
+
* Convert to a plain object for serialization.
|
|
86
|
+
* Returns only the last 5 hashes for brevity.
|
|
87
|
+
*/
|
|
88
|
+
toDict(): ChainOfCustodyData;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Serialized format for destruction certificates.
|
|
92
|
+
*/
|
|
93
|
+
interface DestructionCertificateData {
|
|
94
|
+
version: string;
|
|
95
|
+
certificate_id: string;
|
|
96
|
+
resource: ResourceInfoData;
|
|
97
|
+
destruction: {
|
|
98
|
+
method: string;
|
|
99
|
+
timestamp: string;
|
|
100
|
+
verified_by: string;
|
|
101
|
+
};
|
|
102
|
+
chain_of_custody?: ChainOfCustodyData;
|
|
103
|
+
signature?: string;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Cryptographically signed proof of data destruction.
|
|
107
|
+
*
|
|
108
|
+
* Destruction certificates provide verifiable evidence for compliance
|
|
109
|
+
* with data protection regulations (GDPR Article 17, CCPA, HIPAA, SOX).
|
|
110
|
+
*/
|
|
111
|
+
declare class DestructionCertificate {
|
|
112
|
+
readonly certificateId: string;
|
|
113
|
+
readonly version: string;
|
|
114
|
+
readonly resource: ResourceInfo;
|
|
115
|
+
readonly destructionMethod: DestructionMethod;
|
|
116
|
+
readonly destructionTimestamp: Date;
|
|
117
|
+
verifiedBy: string;
|
|
118
|
+
readonly chainOfCustody: ChainOfCustody | null;
|
|
119
|
+
signature: string | null;
|
|
120
|
+
constructor(certificateId: string, version: string, resource: ResourceInfo, destructionMethod: DestructionMethod, destructionTimestamp: Date, verifiedBy: string, chainOfCustody?: ChainOfCustody | null, signature?: string | null);
|
|
121
|
+
/**
|
|
122
|
+
* Factory method to create a new destruction certificate.
|
|
123
|
+
*
|
|
124
|
+
* @param resource - The destroyed resource info
|
|
125
|
+
* @param destructionMethod - How the data was destroyed
|
|
126
|
+
* @param verifiedBy - Authority that verified the destruction
|
|
127
|
+
* @param chainOfCustody - Optional chain of custody
|
|
128
|
+
*/
|
|
129
|
+
static create(resource: ResourceInfo, destructionMethod: DestructionMethod, verifiedBy?: string, chainOfCustody?: ChainOfCustody | null): DestructionCertificate;
|
|
130
|
+
/**
|
|
131
|
+
* Convert to a plain object for serialization.
|
|
132
|
+
*
|
|
133
|
+
* @param includeSignature - Whether to include the signature field
|
|
134
|
+
*/
|
|
135
|
+
toDict(includeSignature?: boolean): DestructionCertificateData;
|
|
136
|
+
/**
|
|
137
|
+
* Convert to JSON string.
|
|
138
|
+
*/
|
|
139
|
+
toJSON(indent?: number): string;
|
|
140
|
+
/**
|
|
141
|
+
* Get canonical byte representation for signing.
|
|
142
|
+
*
|
|
143
|
+
* Uses deterministic JSON serialization (sorted keys, no whitespace)
|
|
144
|
+
* to ensure consistent signatures.
|
|
145
|
+
*/
|
|
146
|
+
canonicalBytes(): Buffer;
|
|
147
|
+
/**
|
|
148
|
+
* Compute SHA-256 hash of the certificate.
|
|
149
|
+
*/
|
|
150
|
+
computeHash(): string;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Authority that issues and verifies destruction certificates.
|
|
154
|
+
*
|
|
155
|
+
* Uses Ed25519 digital signatures for non-repudiation.
|
|
156
|
+
*/
|
|
157
|
+
declare class AttestationAuthority {
|
|
158
|
+
readonly authorityId: string;
|
|
159
|
+
private readonly privateKey;
|
|
160
|
+
private readonly publicKey;
|
|
161
|
+
private readonly issuedCertificates;
|
|
162
|
+
/**
|
|
163
|
+
* Create a new AttestationAuthority.
|
|
164
|
+
*
|
|
165
|
+
* @param authorityId - Identifier for this authority
|
|
166
|
+
*/
|
|
167
|
+
constructor(authorityId?: string);
|
|
168
|
+
/**
|
|
169
|
+
* Get the public key as raw bytes.
|
|
170
|
+
*/
|
|
171
|
+
get publicKeyBytes(): Buffer;
|
|
172
|
+
/**
|
|
173
|
+
* Get the public key as base64-encoded string.
|
|
174
|
+
*/
|
|
175
|
+
get publicKeyB64(): string;
|
|
176
|
+
/**
|
|
177
|
+
* Sign a destruction certificate.
|
|
178
|
+
*
|
|
179
|
+
* @param certificate - The certificate to sign
|
|
180
|
+
* @returns The signed certificate
|
|
181
|
+
*/
|
|
182
|
+
signCertificate(certificate: DestructionCertificate): DestructionCertificate;
|
|
183
|
+
/**
|
|
184
|
+
* Verify a certificate's signature.
|
|
185
|
+
*
|
|
186
|
+
* @param certificate - The certificate to verify
|
|
187
|
+
* @returns true if the signature is valid
|
|
188
|
+
* @throws AttestationError if verification fails
|
|
189
|
+
*/
|
|
190
|
+
verifyCertificate(certificate: DestructionCertificate): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Issue a new signed destruction certificate.
|
|
193
|
+
*
|
|
194
|
+
* @param resourceType - Type of resource (ephemeral_data, sealed_compute, etc.)
|
|
195
|
+
* @param resourceId - Unique identifier of the resource
|
|
196
|
+
* @param classification - Data classification level
|
|
197
|
+
* @param destructionMethod - How the data was destroyed
|
|
198
|
+
* @param chainOfCustody - Optional chain of custody
|
|
199
|
+
* @param metadata - Optional additional metadata
|
|
200
|
+
* @returns The signed certificate
|
|
201
|
+
*/
|
|
202
|
+
issueCertificate(resourceType: string, resourceId: string, classification: string, destructionMethod: DestructionMethod, chainOfCustody?: ChainOfCustody | null, metadata?: Record<string, unknown>): DestructionCertificate;
|
|
203
|
+
/**
|
|
204
|
+
* Retrieve a previously issued certificate by ID.
|
|
205
|
+
*
|
|
206
|
+
* @param certificateId - The certificate ID
|
|
207
|
+
* @returns The certificate or null if not found
|
|
208
|
+
*/
|
|
209
|
+
getCertificate(certificateId: string): DestructionCertificate | null;
|
|
210
|
+
/**
|
|
211
|
+
* List issued certificates with optional filtering.
|
|
212
|
+
*
|
|
213
|
+
* @param resourceId - Optional resource ID to filter by
|
|
214
|
+
* @param since - Optional date to filter certificates issued after
|
|
215
|
+
* @returns List of certificates sorted by destruction timestamp (newest first)
|
|
216
|
+
*/
|
|
217
|
+
listCertificates(resourceId?: string, since?: Date): DestructionCertificate[];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* EFSF Cryptographic Operations
|
|
222
|
+
*
|
|
223
|
+
* Provides encryption, decryption, and key management for ephemeral data.
|
|
224
|
+
* Uses AES-256-GCM for authenticated encryption via Node.js crypto module.
|
|
225
|
+
*/
|
|
226
|
+
/**
|
|
227
|
+
* Serialized format for encrypted payloads.
|
|
228
|
+
*/
|
|
229
|
+
interface EncryptedPayloadData {
|
|
230
|
+
ciphertext: string;
|
|
231
|
+
nonce: string;
|
|
232
|
+
key_id: string;
|
|
233
|
+
algorithm: string;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Container for encrypted data with all necessary decryption metadata.
|
|
237
|
+
*/
|
|
238
|
+
declare class EncryptedPayload {
|
|
239
|
+
readonly ciphertext: string;
|
|
240
|
+
readonly nonce: string;
|
|
241
|
+
readonly keyId: string;
|
|
242
|
+
readonly algorithm: string;
|
|
243
|
+
constructor(ciphertext: string, // base64 encoded (includes auth tag)
|
|
244
|
+
nonce: string, // base64 encoded
|
|
245
|
+
keyId: string, algorithm?: string);
|
|
246
|
+
/**
|
|
247
|
+
* Convert to a plain object for serialization.
|
|
248
|
+
*/
|
|
249
|
+
toDict(): EncryptedPayloadData;
|
|
250
|
+
/**
|
|
251
|
+
* Reconstruct from serialized data.
|
|
252
|
+
*/
|
|
253
|
+
static fromDict(data: EncryptedPayloadData): EncryptedPayload;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Data Encryption Key (DEK) with lifecycle tracking.
|
|
257
|
+
*
|
|
258
|
+
* Each DEK is tied to the TTL of the data it protects. When the DEK
|
|
259
|
+
* is destroyed (crypto-shredding), all data encrypted with it becomes
|
|
260
|
+
* permanently unrecoverable.
|
|
261
|
+
*/
|
|
262
|
+
declare class DataEncryptionKey {
|
|
263
|
+
readonly keyId: string;
|
|
264
|
+
private _keyMaterial;
|
|
265
|
+
readonly createdAt: Date;
|
|
266
|
+
readonly expiresAt: Date;
|
|
267
|
+
private _destroyed;
|
|
268
|
+
private _destroyedAt;
|
|
269
|
+
constructor(keyId: string, _keyMaterial: Buffer, createdAt: Date, expiresAt: Date);
|
|
270
|
+
/**
|
|
271
|
+
* Generate a new DEK with the specified TTL.
|
|
272
|
+
*
|
|
273
|
+
* @param ttlMs - Time-to-live in milliseconds
|
|
274
|
+
* @param keyId - Optional key identifier (auto-generated if not provided)
|
|
275
|
+
*/
|
|
276
|
+
static generate(ttlMs: number, keyId?: string): DataEncryptionKey;
|
|
277
|
+
/**
|
|
278
|
+
* Get the key material for cryptographic operations.
|
|
279
|
+
* @throws CryptoError if the key has been destroyed
|
|
280
|
+
*/
|
|
281
|
+
get keyMaterial(): Buffer;
|
|
282
|
+
/**
|
|
283
|
+
* Check if the key has been destroyed.
|
|
284
|
+
*/
|
|
285
|
+
get destroyed(): boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Get the timestamp when the key was destroyed, if applicable.
|
|
288
|
+
*/
|
|
289
|
+
get destroyedAt(): Date | null;
|
|
290
|
+
/**
|
|
291
|
+
* Check if the key is expired or destroyed.
|
|
292
|
+
*/
|
|
293
|
+
get isExpired(): boolean;
|
|
294
|
+
/**
|
|
295
|
+
* Securely destroy the key material (crypto-shredding).
|
|
296
|
+
*
|
|
297
|
+
* This overwrites the key material with random data then zeros,
|
|
298
|
+
* making any data encrypted with this key permanently unrecoverable.
|
|
299
|
+
*
|
|
300
|
+
* Note: In JavaScript/Node.js, we cannot guarantee memory is fully
|
|
301
|
+
* zeroed due to garbage collection. This is best-effort. For true
|
|
302
|
+
* security guarantees, use hardware security modules (HSM).
|
|
303
|
+
*/
|
|
304
|
+
destroy(): void;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Cryptographic provider for ephemeral data encryption.
|
|
308
|
+
*
|
|
309
|
+
* Manages Data Encryption Keys (DEKs) and provides AES-256-GCM
|
|
310
|
+
* authenticated encryption for protecting ephemeral data.
|
|
311
|
+
*/
|
|
312
|
+
declare class CryptoProvider {
|
|
313
|
+
private readonly masterKey;
|
|
314
|
+
private readonly keys;
|
|
315
|
+
/**
|
|
316
|
+
* Create a new CryptoProvider.
|
|
317
|
+
*
|
|
318
|
+
* @param masterKey - Optional master key for key derivation.
|
|
319
|
+
* If not provided, a random key is generated.
|
|
320
|
+
* In production, this should come from a KMS.
|
|
321
|
+
*/
|
|
322
|
+
constructor(masterKey?: Buffer);
|
|
323
|
+
/**
|
|
324
|
+
* Generate a new Data Encryption Key with the specified TTL.
|
|
325
|
+
*
|
|
326
|
+
* @param ttlMs - Time-to-live in milliseconds
|
|
327
|
+
* @returns The generated DEK
|
|
328
|
+
*/
|
|
329
|
+
generateDEK(ttlMs: number): DataEncryptionKey;
|
|
330
|
+
/**
|
|
331
|
+
* Retrieve a DEK by its identifier.
|
|
332
|
+
*
|
|
333
|
+
* @param keyId - The key identifier
|
|
334
|
+
* @returns The DEK if found and valid, null otherwise
|
|
335
|
+
*/
|
|
336
|
+
getDEK(keyId: string): DataEncryptionKey | null;
|
|
337
|
+
/**
|
|
338
|
+
* Destroy a DEK (crypto-shredding).
|
|
339
|
+
*
|
|
340
|
+
* After destruction, any data encrypted with this key becomes
|
|
341
|
+
* permanently unrecoverable.
|
|
342
|
+
*
|
|
343
|
+
* @param keyId - The key identifier
|
|
344
|
+
* @returns true if the key was found and destroyed, false otherwise
|
|
345
|
+
*/
|
|
346
|
+
destroyDEK(keyId: string): boolean;
|
|
347
|
+
/**
|
|
348
|
+
* Encrypt plaintext using AES-256-GCM.
|
|
349
|
+
*
|
|
350
|
+
* @param plaintext - The data to encrypt
|
|
351
|
+
* @param dek - The Data Encryption Key to use
|
|
352
|
+
* @param associatedData - Optional additional authenticated data (AAD)
|
|
353
|
+
* @returns The encrypted payload
|
|
354
|
+
* @throws CryptoError if the key is destroyed or expired
|
|
355
|
+
*/
|
|
356
|
+
encrypt(plaintext: Buffer, dek: DataEncryptionKey, associatedData?: Buffer): EncryptedPayload;
|
|
357
|
+
/**
|
|
358
|
+
* Decrypt an encrypted payload.
|
|
359
|
+
*
|
|
360
|
+
* @param payload - The encrypted payload to decrypt
|
|
361
|
+
* @param associatedData - Optional additional authenticated data (must match encryption)
|
|
362
|
+
* @returns The decrypted plaintext
|
|
363
|
+
* @throws CryptoError if decryption fails or key is unavailable
|
|
364
|
+
*/
|
|
365
|
+
decrypt(payload: EncryptedPayload, associatedData?: Buffer): Buffer;
|
|
366
|
+
/**
|
|
367
|
+
* Encrypt a JSON-serializable object.
|
|
368
|
+
*
|
|
369
|
+
* @param data - The object to encrypt
|
|
370
|
+
* @param dek - The Data Encryption Key to use
|
|
371
|
+
* @returns The encrypted payload
|
|
372
|
+
*/
|
|
373
|
+
encryptJSON(data: Record<string, unknown>, dek: DataEncryptionKey): EncryptedPayload;
|
|
374
|
+
/**
|
|
375
|
+
* Decrypt a payload and parse as JSON.
|
|
376
|
+
*
|
|
377
|
+
* @param payload - The encrypted payload
|
|
378
|
+
* @returns The decrypted object
|
|
379
|
+
*/
|
|
380
|
+
decryptJSON(payload: EncryptedPayload): Record<string, unknown>;
|
|
381
|
+
/**
|
|
382
|
+
* Derive a key from the master key using HKDF.
|
|
383
|
+
*
|
|
384
|
+
* @param context - Context bytes for domain separation
|
|
385
|
+
* @param length - Desired key length in bytes (default: 32)
|
|
386
|
+
* @returns The derived key material
|
|
387
|
+
*/
|
|
388
|
+
deriveKey(context: Buffer, length?: number): Buffer;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Compare two buffers in constant time to prevent timing attacks.
|
|
392
|
+
*
|
|
393
|
+
* @param a - First buffer
|
|
394
|
+
* @param b - Second buffer
|
|
395
|
+
* @returns true if buffers are equal, false otherwise
|
|
396
|
+
*/
|
|
397
|
+
declare function constantTimeCompare(a: Buffer, b: Buffer): boolean;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* EFSF Record Types
|
|
401
|
+
*
|
|
402
|
+
* Defines the EphemeralRecord class and related data structures
|
|
403
|
+
* for managing ephemeral data with classification and TTL policies.
|
|
404
|
+
*/
|
|
405
|
+
/**
|
|
406
|
+
* Data classification levels with associated TTL policies.
|
|
407
|
+
*
|
|
408
|
+
* Each classification defines default and maximum TTL values:
|
|
409
|
+
* - TRANSIENT: Short-lived data (sessions, tokens) - max 24 hours
|
|
410
|
+
* - SHORT_LIVED: Temporary data (carts, uploads) - max 7 days
|
|
411
|
+
* - RETENTION_BOUND: Compliance data (invoices, logs) - max 7 years
|
|
412
|
+
* - PERSISTENT: Permanent data (legal holds) - no TTL limit
|
|
413
|
+
*/
|
|
414
|
+
declare enum DataClassification {
|
|
415
|
+
TRANSIENT = "TRANSIENT",
|
|
416
|
+
SHORT_LIVED = "SHORT_LIVED",
|
|
417
|
+
RETENTION_BOUND = "RETENTION_BOUND",
|
|
418
|
+
PERSISTENT = "PERSISTENT"
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Get the default TTL for a classification in milliseconds.
|
|
422
|
+
*/
|
|
423
|
+
declare function getDefaultTTL(classification: DataClassification): number | null;
|
|
424
|
+
/**
|
|
425
|
+
* Get the maximum TTL for a classification in milliseconds.
|
|
426
|
+
*/
|
|
427
|
+
declare function getMaxTTL(classification: DataClassification): number | null;
|
|
428
|
+
/**
|
|
429
|
+
* Serialized record format for storage.
|
|
430
|
+
*/
|
|
431
|
+
interface EphemeralRecordData {
|
|
432
|
+
id: string;
|
|
433
|
+
classification: string;
|
|
434
|
+
created_at: string;
|
|
435
|
+
expires_at: string;
|
|
436
|
+
ttl_seconds: number;
|
|
437
|
+
encrypted: boolean;
|
|
438
|
+
key_id: string | null;
|
|
439
|
+
access_count: number;
|
|
440
|
+
metadata: Record<string, unknown>;
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Options for creating an ephemeral record.
|
|
444
|
+
*/
|
|
445
|
+
interface EphemeralRecordCreateOptions {
|
|
446
|
+
classification?: DataClassification;
|
|
447
|
+
ttl?: number;
|
|
448
|
+
metadata?: Record<string, unknown>;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Represents metadata for an ephemeral record stored in the system.
|
|
452
|
+
*
|
|
453
|
+
* EphemeralRecord tracks the lifecycle of stored data including:
|
|
454
|
+
* - Unique identifier and encryption key reference
|
|
455
|
+
* - Classification and TTL policy
|
|
456
|
+
* - Creation and expiration timestamps
|
|
457
|
+
* - Access count for auditing
|
|
458
|
+
*/
|
|
459
|
+
declare class EphemeralRecord {
|
|
460
|
+
readonly id: string;
|
|
461
|
+
readonly classification: DataClassification;
|
|
462
|
+
readonly createdAt: Date;
|
|
463
|
+
readonly expiresAt: Date;
|
|
464
|
+
readonly ttl: number;
|
|
465
|
+
readonly encrypted: boolean;
|
|
466
|
+
keyId: string | null;
|
|
467
|
+
accessCount: number;
|
|
468
|
+
readonly metadata: Record<string, unknown>;
|
|
469
|
+
constructor(id: string, classification: DataClassification, createdAt: Date, expiresAt: Date, ttl: number, // milliseconds
|
|
470
|
+
encrypted?: boolean, keyId?: string | null, accessCount?: number, metadata?: Record<string, unknown>);
|
|
471
|
+
/**
|
|
472
|
+
* Factory method to create a new ephemeral record.
|
|
473
|
+
*
|
|
474
|
+
* @param options - Configuration options for the record
|
|
475
|
+
* @returns A new EphemeralRecord instance
|
|
476
|
+
* @throws Error if TTL exceeds the classification's maximum
|
|
477
|
+
*/
|
|
478
|
+
static create(options?: EphemeralRecordCreateOptions): EphemeralRecord;
|
|
479
|
+
/**
|
|
480
|
+
* Check if the record has expired.
|
|
481
|
+
*/
|
|
482
|
+
get isExpired(): boolean;
|
|
483
|
+
/**
|
|
484
|
+
* Get remaining time until expiration in milliseconds.
|
|
485
|
+
*/
|
|
486
|
+
get timeRemaining(): number;
|
|
487
|
+
/**
|
|
488
|
+
* Convert to a plain object for serialization.
|
|
489
|
+
*/
|
|
490
|
+
toDict(): EphemeralRecordData;
|
|
491
|
+
/**
|
|
492
|
+
* Reconstruct an EphemeralRecord from serialized data.
|
|
493
|
+
*/
|
|
494
|
+
static fromDict(data: EphemeralRecordData): EphemeralRecord;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Parse a human-readable TTL string into milliseconds.
|
|
498
|
+
*
|
|
499
|
+
* Supported formats:
|
|
500
|
+
* - Seconds: "30s", "30sec", "30second", "30seconds"
|
|
501
|
+
* - Minutes: "5m", "5min", "5minute", "5minutes"
|
|
502
|
+
* - Hours: "2h", "2hr", "2hour", "2hours"
|
|
503
|
+
* - Days: "7d", "7day", "7days"
|
|
504
|
+
*
|
|
505
|
+
* @param ttlString - Human-readable TTL string
|
|
506
|
+
* @returns TTL in milliseconds
|
|
507
|
+
* @throws Error if the string cannot be parsed
|
|
508
|
+
*
|
|
509
|
+
* @example
|
|
510
|
+
* parseTTL("30s") // 30000
|
|
511
|
+
* parseTTL("5m") // 300000
|
|
512
|
+
* parseTTL("2h") // 7200000
|
|
513
|
+
* parseTTL("7d") // 604800000
|
|
514
|
+
*/
|
|
515
|
+
declare function parseTTL(ttlString: string): number;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* EFSF Ephemeral Store
|
|
519
|
+
*
|
|
520
|
+
* The primary interface for storing and retrieving ephemeral data
|
|
521
|
+
* with automatic TTL enforcement and crypto-shredding.
|
|
522
|
+
*/
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Interface for pluggable storage backends.
|
|
526
|
+
*
|
|
527
|
+
* Implementations must support TTL-based expiration.
|
|
528
|
+
*/
|
|
529
|
+
interface StorageBackend {
|
|
530
|
+
/**
|
|
531
|
+
* Store a value with TTL.
|
|
532
|
+
* @param key - Storage key
|
|
533
|
+
* @param value - Value to store (JSON string)
|
|
534
|
+
* @param ttlSeconds - Time-to-live in seconds
|
|
535
|
+
*/
|
|
536
|
+
set(key: string, value: string, ttlSeconds: number): Promise<boolean>;
|
|
537
|
+
/**
|
|
538
|
+
* Retrieve a value by key.
|
|
539
|
+
* @param key - Storage key
|
|
540
|
+
* @returns The value or null if not found/expired
|
|
541
|
+
*/
|
|
542
|
+
get(key: string): Promise<string | null>;
|
|
543
|
+
/**
|
|
544
|
+
* Delete a value by key.
|
|
545
|
+
* @param key - Storage key
|
|
546
|
+
* @returns true if deleted, false if not found
|
|
547
|
+
*/
|
|
548
|
+
delete(key: string): Promise<boolean>;
|
|
549
|
+
/**
|
|
550
|
+
* Check if a key exists.
|
|
551
|
+
* @param key - Storage key
|
|
552
|
+
*/
|
|
553
|
+
exists(key: string): Promise<boolean>;
|
|
554
|
+
/**
|
|
555
|
+
* Get remaining TTL in seconds.
|
|
556
|
+
* @param key - Storage key
|
|
557
|
+
* @returns Remaining seconds or null if not found
|
|
558
|
+
*/
|
|
559
|
+
ttl(key: string): Promise<number | null>;
|
|
560
|
+
/**
|
|
561
|
+
* Close the backend and release resources.
|
|
562
|
+
*/
|
|
563
|
+
close(): Promise<void>;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* In-memory storage backend for testing and development.
|
|
567
|
+
*
|
|
568
|
+
* TTL is enforced on access (not automatically expired).
|
|
569
|
+
*/
|
|
570
|
+
declare class MemoryBackend implements StorageBackend {
|
|
571
|
+
private readonly data;
|
|
572
|
+
set(key: string, value: string, ttlSeconds: number): Promise<boolean>;
|
|
573
|
+
get(key: string): Promise<string | null>;
|
|
574
|
+
delete(key: string): Promise<boolean>;
|
|
575
|
+
exists(key: string): Promise<boolean>;
|
|
576
|
+
ttl(key: string): Promise<number | null>;
|
|
577
|
+
close(): Promise<void>;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Redis storage backend for production use.
|
|
581
|
+
*
|
|
582
|
+
* Uses native Redis TTL for automatic expiration.
|
|
583
|
+
* Requires the 'ioredis' package.
|
|
584
|
+
*/
|
|
585
|
+
declare class RedisBackend implements StorageBackend {
|
|
586
|
+
private client;
|
|
587
|
+
private readonly prefix;
|
|
588
|
+
constructor(url: string, options?: Record<string, unknown>);
|
|
589
|
+
private key;
|
|
590
|
+
set(key: string, value: string, ttlSeconds: number): Promise<boolean>;
|
|
591
|
+
get(key: string): Promise<string | null>;
|
|
592
|
+
delete(key: string): Promise<boolean>;
|
|
593
|
+
exists(key: string): Promise<boolean>;
|
|
594
|
+
ttl(key: string): Promise<number | null>;
|
|
595
|
+
close(): Promise<void>;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* Create a storage backend from a URL.
|
|
599
|
+
*
|
|
600
|
+
* Supported schemes:
|
|
601
|
+
* - memory:// - In-memory storage (for testing)
|
|
602
|
+
* - redis://host:port/db - Redis storage
|
|
603
|
+
* - rediss://host:port/db - Redis over TLS
|
|
604
|
+
*
|
|
605
|
+
* @param backendUrl - Backend URL
|
|
606
|
+
* @returns Storage backend instance
|
|
607
|
+
*/
|
|
608
|
+
declare function createBackend(backendUrl: string): StorageBackend;
|
|
609
|
+
/**
|
|
610
|
+
* Options for creating an EphemeralStore.
|
|
611
|
+
*/
|
|
612
|
+
interface EphemeralStoreOptions {
|
|
613
|
+
/** Backend URL or instance */
|
|
614
|
+
backend?: string | StorageBackend;
|
|
615
|
+
/** Default TTL (string like "1h" or milliseconds) */
|
|
616
|
+
defaultTTL?: string | number;
|
|
617
|
+
/** Enable destruction certificate generation */
|
|
618
|
+
attestation?: boolean;
|
|
619
|
+
/** Custom crypto provider */
|
|
620
|
+
cryptoProvider?: CryptoProvider;
|
|
621
|
+
/** Custom attestation authority */
|
|
622
|
+
attestationAuthority?: AttestationAuthority;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Options for the put() method.
|
|
626
|
+
*/
|
|
627
|
+
interface PutOptions {
|
|
628
|
+
/** TTL (string like "30m" or milliseconds) */
|
|
629
|
+
ttl?: string | number;
|
|
630
|
+
/** Data classification level */
|
|
631
|
+
classification?: DataClassification | string;
|
|
632
|
+
/** Additional metadata */
|
|
633
|
+
metadata?: Record<string, unknown>;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Store statistics.
|
|
637
|
+
*/
|
|
638
|
+
interface StoreStats {
|
|
639
|
+
/** Number of active (non-expired) records */
|
|
640
|
+
activeRecords: number;
|
|
641
|
+
/** Number of destruction certificates issued */
|
|
642
|
+
certificatesIssued: number;
|
|
643
|
+
/** Whether attestation is enabled */
|
|
644
|
+
attestationEnabled: boolean;
|
|
645
|
+
}
|
|
646
|
+
/**
|
|
647
|
+
* The primary interface for storing and retrieving ephemeral data.
|
|
648
|
+
*
|
|
649
|
+
* Features:
|
|
650
|
+
* - Automatic encryption with per-record keys (AES-256-GCM)
|
|
651
|
+
* - TTL enforcement with crypto-shredding on expiration
|
|
652
|
+
* - Destruction certificates for compliance
|
|
653
|
+
* - Chain of custody tracking
|
|
654
|
+
*
|
|
655
|
+
* @example
|
|
656
|
+
* ```typescript
|
|
657
|
+
* const store = new EphemeralStore({
|
|
658
|
+
* backend: 'memory://',
|
|
659
|
+
* defaultTTL: '1h',
|
|
660
|
+
* attestation: true,
|
|
661
|
+
* });
|
|
662
|
+
*
|
|
663
|
+
* // Store sensitive data
|
|
664
|
+
* const record = await store.put(
|
|
665
|
+
* { user_id: '123', token: 'secret' },
|
|
666
|
+
* { ttl: '30m', classification: DataClassification.TRANSIENT }
|
|
667
|
+
* );
|
|
668
|
+
*
|
|
669
|
+
* // Retrieve data
|
|
670
|
+
* const data = await store.get(record.id);
|
|
671
|
+
*
|
|
672
|
+
* // Destroy with certificate
|
|
673
|
+
* const cert = await store.destroy(record.id);
|
|
674
|
+
* ```
|
|
675
|
+
*/
|
|
676
|
+
declare class EphemeralStore {
|
|
677
|
+
private readonly backend;
|
|
678
|
+
private readonly defaultTTL;
|
|
679
|
+
private readonly crypto;
|
|
680
|
+
private readonly attestationEnabled;
|
|
681
|
+
private readonly authority;
|
|
682
|
+
private readonly records;
|
|
683
|
+
private readonly custody;
|
|
684
|
+
private readonly certificates;
|
|
685
|
+
constructor(options?: EphemeralStoreOptions);
|
|
686
|
+
/**
|
|
687
|
+
* Store data with automatic encryption and TTL.
|
|
688
|
+
*
|
|
689
|
+
* @param data - Data to store (must be JSON-serializable)
|
|
690
|
+
* @param options - Storage options (TTL, classification, metadata)
|
|
691
|
+
* @returns The ephemeral record metadata
|
|
692
|
+
*/
|
|
693
|
+
put(data: Record<string, unknown>, options?: PutOptions): Promise<EphemeralRecord>;
|
|
694
|
+
/**
|
|
695
|
+
* Retrieve data by record ID.
|
|
696
|
+
*
|
|
697
|
+
* @param recordId - The record identifier
|
|
698
|
+
* @returns The decrypted data
|
|
699
|
+
* @throws RecordNotFoundError if the record doesn't exist
|
|
700
|
+
* @throws RecordExpiredError if the record has expired
|
|
701
|
+
*/
|
|
702
|
+
get(recordId: string): Promise<Record<string, unknown>>;
|
|
703
|
+
/**
|
|
704
|
+
* Check if a record exists and is not expired.
|
|
705
|
+
*
|
|
706
|
+
* @param recordId - The record identifier
|
|
707
|
+
*/
|
|
708
|
+
exists(recordId: string): Promise<boolean>;
|
|
709
|
+
/**
|
|
710
|
+
* Get remaining TTL for a record in milliseconds.
|
|
711
|
+
*
|
|
712
|
+
* @param recordId - The record identifier
|
|
713
|
+
* @returns Remaining TTL in milliseconds, or null if not found
|
|
714
|
+
*/
|
|
715
|
+
ttl(recordId: string): Promise<number | null>;
|
|
716
|
+
/**
|
|
717
|
+
* Manually destroy a record immediately (crypto-shredding).
|
|
718
|
+
*
|
|
719
|
+
* This destroys the encryption key, making the data permanently
|
|
720
|
+
* unrecoverable, and generates a destruction certificate.
|
|
721
|
+
*
|
|
722
|
+
* @param recordId - The record identifier
|
|
723
|
+
* @returns The destruction certificate, or null if attestation is disabled
|
|
724
|
+
*/
|
|
725
|
+
destroy(recordId: string): Promise<DestructionCertificate | null>;
|
|
726
|
+
/**
|
|
727
|
+
* Handle record expiration or destruction.
|
|
728
|
+
*/
|
|
729
|
+
private handleExpiration;
|
|
730
|
+
/**
|
|
731
|
+
* Get the destruction certificate for a destroyed record.
|
|
732
|
+
*
|
|
733
|
+
* @param recordId - The record identifier
|
|
734
|
+
* @returns The certificate or null if not found
|
|
735
|
+
*/
|
|
736
|
+
getDestructionCertificate(recordId: string): DestructionCertificate | null;
|
|
737
|
+
/**
|
|
738
|
+
* List all destruction certificates.
|
|
739
|
+
*
|
|
740
|
+
* @param since - Optional date to filter certificates issued after
|
|
741
|
+
* @returns List of certificates sorted by destruction timestamp (newest first)
|
|
742
|
+
*/
|
|
743
|
+
listCertificates(since?: Date): DestructionCertificate[];
|
|
744
|
+
/**
|
|
745
|
+
* Get store statistics.
|
|
746
|
+
*/
|
|
747
|
+
stats(): StoreStats;
|
|
748
|
+
/**
|
|
749
|
+
* Close the store and release resources.
|
|
750
|
+
*/
|
|
751
|
+
close(): Promise<void>;
|
|
752
|
+
/** @internal */
|
|
753
|
+
get _crypto(): CryptoProvider;
|
|
754
|
+
/** @internal */
|
|
755
|
+
get _authority(): AttestationAuthority | null;
|
|
756
|
+
/** @internal */
|
|
757
|
+
get _records(): Map<string, EphemeralRecord>;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
/**
|
|
761
|
+
* EFSF Sealed Execution
|
|
762
|
+
*
|
|
763
|
+
* Provides sealed execution contexts where all state is guaranteed
|
|
764
|
+
* to be destroyed upon exit.
|
|
765
|
+
*
|
|
766
|
+
* Note: In pure JavaScript without hardware TEE support, memory zeroing
|
|
767
|
+
* is best-effort. For production use with sensitive data, integrate
|
|
768
|
+
* with Intel SGX, AMD SEV, or AWS Nitro Enclaves.
|
|
769
|
+
*/
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Attempt to securely zero memory containing sensitive data.
|
|
773
|
+
*
|
|
774
|
+
* WARNING: This is best-effort in JavaScript due to:
|
|
775
|
+
* - Garbage collection may have already copied data
|
|
776
|
+
* - String interning
|
|
777
|
+
* - Immutable types cannot be modified
|
|
778
|
+
*
|
|
779
|
+
* For true security guarantees, use hardware enclaves or HSMs.
|
|
780
|
+
*
|
|
781
|
+
* @param data - The data to zero
|
|
782
|
+
*/
|
|
783
|
+
declare function secureZeroMemory(data: unknown): void;
|
|
784
|
+
/**
|
|
785
|
+
* Options for creating a SealedContext.
|
|
786
|
+
*/
|
|
787
|
+
interface SealedContextOptions {
|
|
788
|
+
executionId?: string;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Execution context for sealed code blocks.
|
|
792
|
+
*
|
|
793
|
+
* Tracks objects for cleanup and allows registration of
|
|
794
|
+
* cleanup callbacks.
|
|
795
|
+
*/
|
|
796
|
+
declare class SealedContext {
|
|
797
|
+
readonly executionId: string;
|
|
798
|
+
readonly startedAt: Date;
|
|
799
|
+
private readonly sensitiveRefs;
|
|
800
|
+
private readonly cleanupCallbacks;
|
|
801
|
+
constructor(options?: SealedContextOptions);
|
|
802
|
+
/**
|
|
803
|
+
* Track an object for cleanup on context exit.
|
|
804
|
+
*
|
|
805
|
+
* @param obj - Object to track
|
|
806
|
+
* @returns The same object for chaining
|
|
807
|
+
*/
|
|
808
|
+
track<T extends object>(obj: T): T;
|
|
809
|
+
/**
|
|
810
|
+
* Register a cleanup callback to run on context exit.
|
|
811
|
+
*
|
|
812
|
+
* @param callback - Function to call during cleanup
|
|
813
|
+
*/
|
|
814
|
+
onCleanup(callback: () => void): void;
|
|
815
|
+
/**
|
|
816
|
+
* Internal: Run cleanup routines.
|
|
817
|
+
*/
|
|
818
|
+
_cleanup(): void;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Options for SealedExecution.
|
|
822
|
+
*/
|
|
823
|
+
interface SealedExecutionOptions {
|
|
824
|
+
/** Generate destruction certificate on exit */
|
|
825
|
+
attestation?: boolean;
|
|
826
|
+
/** Custom attestation authority */
|
|
827
|
+
authority?: AttestationAuthority;
|
|
828
|
+
/** Additional metadata for the certificate */
|
|
829
|
+
metadata?: Record<string, unknown>;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* Sealed execution manager that guarantees state destruction on exit.
|
|
833
|
+
*
|
|
834
|
+
* Can be used with the run() method for automatic cleanup:
|
|
835
|
+
* ```typescript
|
|
836
|
+
* const seal = new SealedExecution({ attestation: true });
|
|
837
|
+
* const result = await seal.run((ctx) => {
|
|
838
|
+
* const sensitive = ctx.track({ ssn: '123-45-6789' });
|
|
839
|
+
* return processData(sensitive);
|
|
840
|
+
* });
|
|
841
|
+
* // All tracked state is now destroyed
|
|
842
|
+
* // seal.certificate contains the destruction proof
|
|
843
|
+
* ```
|
|
844
|
+
*/
|
|
845
|
+
declare class SealedExecution {
|
|
846
|
+
private static defaultAuthority;
|
|
847
|
+
readonly attestation: boolean;
|
|
848
|
+
readonly authority: AttestationAuthority | null;
|
|
849
|
+
readonly metadata: Record<string, unknown>;
|
|
850
|
+
context: SealedContext | null;
|
|
851
|
+
certificate: DestructionCertificate | null;
|
|
852
|
+
private chainOfCustody;
|
|
853
|
+
constructor(options?: SealedExecutionOptions);
|
|
854
|
+
/**
|
|
855
|
+
* Enter the sealed execution context.
|
|
856
|
+
*
|
|
857
|
+
* Use with try/finally or the run() method for automatic cleanup.
|
|
858
|
+
*
|
|
859
|
+
* @returns The sealed context for tracking objects
|
|
860
|
+
*/
|
|
861
|
+
enter(): SealedContext;
|
|
862
|
+
/**
|
|
863
|
+
* Exit the sealed execution context and destroy all state.
|
|
864
|
+
*
|
|
865
|
+
* @param error - Optional error if exiting due to an exception
|
|
866
|
+
*/
|
|
867
|
+
exit(error?: Error): void;
|
|
868
|
+
/**
|
|
869
|
+
* Run a function within the sealed context.
|
|
870
|
+
*
|
|
871
|
+
* Automatically handles enter/exit and cleanup.
|
|
872
|
+
*
|
|
873
|
+
* @param fn - Function to execute within the sealed context
|
|
874
|
+
* @returns The function's return value
|
|
875
|
+
*/
|
|
876
|
+
run<T>(fn: (ctx: SealedContext) => T | Promise<T>): Promise<T>;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Options for the sealed decorator.
|
|
880
|
+
*/
|
|
881
|
+
interface SealedDecoratorOptions {
|
|
882
|
+
/** Generate destruction certificate on exit */
|
|
883
|
+
attestation?: boolean;
|
|
884
|
+
/** Custom attestation authority */
|
|
885
|
+
authority?: AttestationAuthority;
|
|
886
|
+
/** Additional metadata for the certificate */
|
|
887
|
+
metadata?: Record<string, unknown>;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Higher-order function that wraps a function in a sealed execution context.
|
|
891
|
+
*
|
|
892
|
+
* All arguments are tracked for cleanup, and the function executes within
|
|
893
|
+
* a sealed context that is destroyed on return.
|
|
894
|
+
*
|
|
895
|
+
* @example
|
|
896
|
+
* ```typescript
|
|
897
|
+
* const processPayment = sealed({ attestation: true })(
|
|
898
|
+
* async (cardNumber: string, amount: number) => {
|
|
899
|
+
* // All local state destroyed on return
|
|
900
|
+
* return { success: true, masked: `****${cardNumber.slice(-4)}` };
|
|
901
|
+
* }
|
|
902
|
+
* );
|
|
903
|
+
*
|
|
904
|
+
* const result = await processPayment('4111-1111-1111-1234', 99.99);
|
|
905
|
+
* // result._destruction_certificate contains the proof
|
|
906
|
+
* ```
|
|
907
|
+
*
|
|
908
|
+
* @param options - Sealed execution options
|
|
909
|
+
* @returns A function wrapper
|
|
910
|
+
*/
|
|
911
|
+
declare function sealed<TArgs extends unknown[], TReturn>(options?: SealedDecoratorOptions): (fn: (...args: TArgs) => TReturn | Promise<TReturn>) => (...args: TArgs) => Promise<TReturn>;
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* EFSF Exceptions
|
|
915
|
+
*
|
|
916
|
+
* Custom error classes for the Ephemeral-First Security Framework.
|
|
917
|
+
* All errors extend from the base EFSFError class.
|
|
918
|
+
*/
|
|
919
|
+
/**
|
|
920
|
+
* Base error class for all EFSF errors.
|
|
921
|
+
*/
|
|
922
|
+
declare class EFSFError extends Error {
|
|
923
|
+
constructor(message: string);
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Raised when a record cannot be found in the store.
|
|
927
|
+
*/
|
|
928
|
+
declare class RecordNotFoundError extends EFSFError {
|
|
929
|
+
readonly recordId: string;
|
|
930
|
+
constructor(recordId: string, message?: string);
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Raised when attempting to access an expired record.
|
|
934
|
+
*/
|
|
935
|
+
declare class RecordExpiredError extends EFSFError {
|
|
936
|
+
readonly recordId: string;
|
|
937
|
+
readonly expiredAt?: string | undefined;
|
|
938
|
+
constructor(recordId: string, expiredAt?: string | undefined);
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Raised when a cryptographic operation fails.
|
|
942
|
+
*/
|
|
943
|
+
declare class CryptoError extends EFSFError {
|
|
944
|
+
readonly operation: string;
|
|
945
|
+
constructor(operation: string, message?: string);
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Raised when attestation or certificate operations fail.
|
|
949
|
+
*/
|
|
950
|
+
declare class AttestationError extends EFSFError {
|
|
951
|
+
constructor(message?: string);
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Raised when a storage backend operation fails.
|
|
955
|
+
*/
|
|
956
|
+
declare class BackendError extends EFSFError {
|
|
957
|
+
readonly backend: string;
|
|
958
|
+
constructor(backend: string, message?: string);
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Raised when input validation fails.
|
|
962
|
+
*/
|
|
963
|
+
declare class ValidationError extends EFSFError {
|
|
964
|
+
readonly field: string;
|
|
965
|
+
constructor(field: string, message?: string);
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Raised when a TTL policy is violated.
|
|
969
|
+
*/
|
|
970
|
+
declare class TTLViolationError extends EFSFError {
|
|
971
|
+
readonly recordId: string;
|
|
972
|
+
readonly expectedTTL: string;
|
|
973
|
+
readonly actualTTL?: string | undefined;
|
|
974
|
+
constructor(recordId: string, expectedTTL: string, actualTTL?: string | undefined);
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/**
|
|
978
|
+
* EFSF - Ephemeral-First Security Framework
|
|
979
|
+
*
|
|
980
|
+
* A framework for building systems where data transience is a first-class
|
|
981
|
+
* security primitive. Implements the core thesis that "data that no longer
|
|
982
|
+
* exists cannot be stolen."
|
|
983
|
+
*
|
|
984
|
+
* @packageDocumentation
|
|
985
|
+
*/
|
|
986
|
+
|
|
987
|
+
/** SDK version */
|
|
988
|
+
declare const VERSION = "0.1.0";
|
|
989
|
+
|
|
990
|
+
export { type AccessEvent, AttestationAuthority, AttestationError, BackendError, ChainOfCustody, type ChainOfCustodyData, CryptoError, CryptoProvider, DataClassification, DataEncryptionKey, DestructionCertificate, type DestructionCertificateData, DestructionMethod, EFSFError, EncryptedPayload, type EncryptedPayloadData, EphemeralRecord, type EphemeralRecordCreateOptions, type EphemeralRecordData, EphemeralStore, type EphemeralStoreOptions, MemoryBackend, type PutOptions, RecordExpiredError, RecordNotFoundError, RedisBackend, ResourceInfo, type ResourceInfoData, SealedContext, type SealedContextOptions, type SealedDecoratorOptions, SealedExecution, type SealedExecutionOptions, type StorageBackend, type StoreStats, TTLViolationError, VERSION, ValidationError, constantTimeCompare, createBackend, getDefaultTTL, getMaxTTL, parseTTL, sealed, secureZeroMemory };
|