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 deploy
Use 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 availableoptions
:{ "time_cost": 2, "memory_cost": 19456, // = 19 * 1024 "parallelism": 1 }
/bcrypt/hash
, with availableoptions
:{ "work_factor": 12 }
-
Request:
{ "password": "thePasswordToHash!" // , // "options": options }
-
Response:
{ "hash": "theResultingHash" }
-
Endpoints:
/argon2/verify
/bcrypt/verify
-
Request:
{ "hash": "passwordHash", "password": "plainTextPassword" }
-
Response:
{ "result": true|false }
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.