-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
featureNew feature implementationNew feature implementationpriority: highShould be done soonShould be done soon
Description
Description
Implement the core encryption module using Web Crypto API for AES-GCM encryption/decryption that works in Cloudflare Workers edge runtime.
Tasks
- Create
lib/crypto.tswith the following functions:-
generateEncryptionKey()- Generate 256-bit AES key -
exportKey(key: CryptoKey)- Export key to base64url -
importKey(keyString: string)- Import base64url key -
encrypt(data: Uint8Array, key: CryptoKey)- AES-GCM encryption with fresh IV -
decrypt(encryptedData: Uint8Array, key: CryptoKey)- AES-GCM decryption
-
- Implement proper error handling with custom error classes
- Add JSDoc documentation for all functions
- Create comprehensive unit tests
Technical Requirements
- Use Web Crypto API (no Node.js crypto)
- 256-bit AES-GCM encryption
- 12-byte IV (crypto.getRandomValues)
- Base64url encoding for URL safety
- Edge runtime compatible
Acceptance Criteria
- All crypto operations use Web Crypto API
- Tests pass in edge runtime environment
- Proper error handling for invalid keys/data
- Type-safe implementation with TypeScript
Metadata
Metadata
Assignees
Labels
featureNew feature implementationNew feature implementationpriority: highShould be done soonShould be done soon