🔒 RFC 8188 Encrypted Content-Encoding for HTTP in TypeScript
🚀 Features
- Implements RFC 8188 for encrypted content-encoding in HTTP.
- Supports AES-128-GCM encryption algorithm.
- Additionally, supports AES-256-GCM encryption algorithm (non-standard).
- Provides functions for both encryption and decryption of data.
- Flexible configuration options for encoding parameters.
💻 Installation
To install the package, you can use npm or yarn:
npm install @exact-realty/rfc8188
or
yarn add @exact-realty/rfc8188
📚 Usage
Decrypting Data
import { encodings, decrypt } from '@exact-realty/rfc8188';
const maxRecordSize = Infinity;
const lookupIKM = async (keyId) => {
return new ArrayBuffer(16);
};
const dataStreamToDecrypt = new ReadableStream();
const decryptedDataSteam = decrypt(
encodings.aes128gcm,
dataStreamToDecrypt,
lookupIKM,
maxRecordSize,
);
Encrypting Data
import { encodings, encrypt } from '@exact-realty/rfc8188';
const dataStreamToEncrypt = new ReadableStream();
const recordSize = 512;
const keyId = new ArrayBuffer(0);
const IKM = new ArrayBuffer(0);
const salt = new ArrayBuffer(16);
const encryptedDataStream = await encrypt(
encodings.aes128gcm,
dataStreamToEncrypt,
recordSize,
keyId,
IKM,
salt,
);
🤝 Contributing
We welcome any contributions and feedback! Please feel free to submit pull
requests, bug reports or feature requests to our GitHub repository.
📜 License
This project is released under the ISC license. Check out the LICENSE
file for
more information.