Cryptoflare is a lightweight library designed to enhance Cloudflare Workers with robust cryptographic functionality. By utilizing Rust and WebAssembly (WASM), Cryptoflare provides high-performance and secure cryptographic operations within the Cloudflare Workers environment.
To use cryptoflare, clone this repository and deploy it to your Cloudflare account. Make sure you have wrangler and Rust's toolchain installed.
git clone git@github.com:mstephen77/cryptoflare.git
cd ./cryptoflare
npm install
npm run deployUse cryptoflare by binding the cryptoflare worker to another worker, then call:
const result = await (await env.CRYPTOFLARE.fetch($ENDPOINT, {
method: 'POST',
body: JSON.stringify($DATA),
})).json();-
Endpoints:
/argon2/hash, with availableOption:{ "time_cost": number, /* defaults to 2 */ "memory_cost": number, /* defaults to 19 * 1024 = 19456 */ "parallelism": number /* defaults to 1 */ }
/bcrypt/hash, with availableOption:{ "work_factor": number /* defaults to 12 */ }
-
Request:
{ "password": string, "options"?: Option }
-
Response:
{ "hash": string }
-
Endpoints:
/argon2/verify/bcrypt/verify
-
Request:
{ "hash": string, "password": string }
-
Response:
{ "result": boolean }
Contributions are welcome! Feel free to open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License. See the LICENSE file for details.