Skip to content

mstephen77/cryptoflare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 git@github.com: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 options:
      {
        "time_cost": 2,
        "memory_cost": 19456, // = 19 * 1024
        "parallelism": 1
      }
    • /bcrypt/hash, with available options:
      { "work_factor": 12 }
  • Request:

    {
      "password": "thePasswordToHash!" // ,
      // "options": options
    }
  • Response:

    { "hash": "theResultingHash" }

Verify

  • Endpoints:

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

    {
      "hash": "passwordHash",
      "password": "plainTextPassword"
    }
  • Response:

    { "result": true|false }

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