From 94f224ef0fd7398b9ab97789647b489575f16f0d Mon Sep 17 00:00:00 2001 From: realaravinth Date: Tue, 2 Mar 2021 18:02:06 +0530 Subject: [PATCH] readme --- Cargo.lock | 28 ++++++++++++++-------------- README.md | 46 ++++++++++++++++++++++++++++++++++++++-------- browser/Cargo.toml | 2 +- browser/README.md | 7 +++++-- browser/src/lib.rs | 13 +++++++++++++ cli/README.md | 1 + 6 files changed, 72 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 013372c..51164f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -187,20 +187,6 @@ dependencies = [ "byte-tools", ] -[[package]] -name = "browser" -version = "0.1.0" -dependencies = [ - "console_error_panic_hook", - "pow_sha256", - "serde", - "serde_derive", - "serde_json", - "wasm-bindgen", - "wasm-bindgen-test", - "wee_alloc", -] - [[package]] name = "bumpalo" version = "3.6.1" @@ -678,6 +664,20 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "mCaptcha-browser" +version = "0.1.0" +dependencies = [ + "console_error_panic_hook", + "pow_sha256", + "serde", + "serde_derive", + "serde_json", + "wasm-bindgen", + "wasm-bindgen-test", + "wee_alloc", +] + [[package]] name = "m_captcha" version = "0.1.0" diff --git a/README.md b/README.md index 7e993d5..9d38a8e 100644 --- a/README.md +++ b/README.md @@ -12,17 +12,47 @@ -## Features -TODO +### STATUS: ACTIVE DEVELOPMENT (fancy word for unusable) + +mCaptcha uses SHA256 based proof-of-work(PoW) to rate limit users. + +**If someone wants to hammer your site, they will have to do more work to +send requests than your server will have to do to respond to their +request.** + +## Why use mCaptcha? +- Free software, privacy focused +- Seamless UX - No more annoying captchas! +- IP address independent(sort of) - your users are behind a NAT? We got you covered! +- Automatic bot throttling +- Resistant to replay attacks - bye-bye captcha farms! + +## Demo + +I'll try to write a dedicated demo server but until then you can try +[Shuttlecraft/identity](github.com/shuttlecraft/identity)'s sign up page +available at https://accounts.shuttlecraft.io/signup. Feel free to +provide bogus information while signing up(project under development, +database frequently wiped). + +Be sure to open dev tools' network tab to witness the magic! ## Usage: -Add this to your `Cargo.toml`: +mCaptcha is made up of three components: -```toml -mCaptcha = { version = "0.1", git = "https://github.com/mcaptcha/mCaptcha" } -``` +#### 1. Front-end library +We have a WASM library now, Android and iOS libraries soon -## Examples: +#### 2. Back-end library +We have Rust library, other languages will have support soon -TODO +#### 3. Rate limiting service +Under development. + +A paid, managed service will be made available soon but +I([@realaravinth](https://batsense.net)) encourage you guys to +self-host. Go decentralisation! + +## Contributing +yes please! diff --git a/browser/Cargo.toml b/browser/Cargo.toml index d7ccd04..f0f6b34 100644 --- a/browser/Cargo.toml +++ b/browser/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "browser" +name = "mCaptcha-browser" version = "0.1.0" authors = ["realaravinth "] edition = "2018" diff --git a/browser/README.md b/browser/README.md index 7415c2a..80cef1f 100644 --- a/browser/README.md +++ b/browser/README.md @@ -2,7 +2,7 @@

PoW JavaScript library

- JavaScript library to generate PoW for Shuttlecraft + JavaScript library to generate PoW for mCaptcha @@ -15,7 +15,10 @@ for more information. ``` $ /path/to/wasm-opt pkg/pow_bg.wasm -o pkg/pow_bg.wasm -O --enable-mutable-globals ``` -My /path/to/wasm-opt is `~/.cache/.wasm-pack/wasm-opt-4d7a65327e9363b7/wasm-opt` +My `/path/to/wasm-opt` is `~/.cache/.wasm-pack/wasm-opt-4d7a65327e9363b7/wasm-opt` + + +----

Default documentation provided by Rust wasm:

diff --git a/browser/src/lib.rs b/browser/src/lib.rs index 8d99d77..45878f8 100644 --- a/browser/src/lib.rs +++ b/browser/src/lib.rs @@ -1,3 +1,16 @@ +//! mCaptcha is a proof of work based Denaial-of-Service attack protection system. +//! This is is a WASM library that you can embed in your frontend code to protect your +//! service. +//! +//! A commercial managed solution is in the works but I'd much rather prefer +//! folks host their own instances as it will make the more decentralized and free. +//! +//! ## Workflow: +//! mCaptcha workflow in the frontend is simple. +//! 1. Call service to get a proof of work(PoW) configuration +//! 2. Call into mCaptcha to get PoW +//! 3. Send PoW to your service + use wasm_bindgen::prelude::*; // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global diff --git a/cli/README.md b/cli/README.md index 33e2ed0..f38a57b 100644 --- a/cli/README.md +++ b/cli/README.md @@ -3,6 +3,7 @@

mCaptcha - PoW based DoS protection

+ ## Usage