Skip to content

mstephen77/cryptoflare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cryptoflare

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.

Installation

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 [email protected]:mstephen77/cryptoflare.git
cd ./cryptoflare
npm install
npm run deploy

Usage

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();

API Specification

Hash

  • Endpoints:

    • /argon2/hash, with available Option:
      {
        "time_cost": number, /* defaults to 2 */
        "memory_cost": number, /* defaults to 19 * 1024 = 19456 */
        "parallelism": number /* defaults to 1 */
      }
    • /bcrypt/hash, with available Option:
      { "work_factor": number /* defaults to 12 */ }
  • Request:

    {
      "password": string,
      "options"?: Option
    }
  • Response:

    { "hash": string }

Verify

  • Endpoints:

    • /argon2/verify
    • /bcrypt/verify
  • Request:

    {
      "hash": string,
      "password": string
    }
  • Response:

    { "result": boolean }

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages