A captcha middleware for Salvo framework
Find a file
Awiteb 5324724260
All checks were successful
Rust CI / Rust CI (push) Successful in 1m45s
chore: Bump the version to 0.3.1
Signed-off-by: Awiteb <a@4rs.nl>
2024-08-12 21:37:03 +00:00
.forgejo/workflows chore: Bump the version to 0.2.0 2024-08-12 21:29:40 +00:00
.github/workflows chore: Moving to Forgejo instead of Github 2024-08-08 14:51:21 +00:00
examples feat: Add case insensitive option to the captcha 2024-08-12 23:30:21 +03:00
src chore: Bump the version to 0.2.0 2024-08-12 21:29:40 +00:00
.gitignore First commit 2024-01-29 23:24:35 +03:00
Cargo.toml chore: Bump the version to 0.3.1 2024-08-12 21:37:03 +00:00
Justfile chore: Bump the version to 0.2.0 2024-08-12 21:29:40 +00:00
LICENSE chore: Update my email address 2024-08-08 11:53:06 +03:00
README.md chore: Update README.md 2024-08-12 21:36:32 +00:00

salvo-captcha

A captcha middleware for salvo framework. With fully customizable captchas generator, storage, and finders

salvo-captcha-video

Add to your project

First, add the following to your Cargo.toml:

[dependencies]
salvo-captcha = "0.3"

Or use cargo add to add the dependency to your Cargo.toml:

$ cargo add salvo-captcha

Usage

See the examples directory for a complete example. You can also see the implemented generators, storages, and finders in the source code.

Storage

There is a default storage, which is MemoryStorage it's a simple in-memory storage. You can implement your own storage by implementing the CaptchaStorage trait.

Cacache Storage

A high-performance, concurrent, content-addressable disk cache. The storage is based on cacache-rs crate. to use it, you need to enable the cacache-storage feature.

[dependencies]
salvo-captcha = { version = "0.3", features = ["cacache-storage"] }

Captcha Finder

We provide fully customizable query parameters, form fields, and headers to find the captcha token and the captcha answer. You can implement your own finder by implementing the CaptchaFinder trait.

Captcha Generator

We provide SimpleCaptchaGenerator which is a simple captcha generator based on the captcha crate, you can enable it by enabling the simple-generator feature.

[dependencies]
salvo-captcha = { version = "0.3", features = ["simple-generator"] }

You can implement your own generator by implementing the CaptchaGenerator trait.

Captcha name and difficulty

In this table, you can see the difference between the difficulties and the name of the captcha.

Name Easy Medium Hard
Normal Simple Simple Simple
SlightlyTwisted Simple Simple Simple
VeryTwisted Simple Simple Simple

Mirrors

Main Repository

License

This project is licensed under the MIT license for more details see LICENSE or http://opensource.org/licenses/MIT.