Crates.io | salvo-captcha |
lib.rs | salvo-captcha |
version | 0.3.1 |
source | src |
created_at | 2024-01-29 20:32:47.567946 |
updated_at | 2024-08-12 21:37:37.627648 |
description | A captcha middleware for Salvo framework. |
homepage | |
repository | https://git.4rs.nl/awiteb/salvo-captcha |
max_upload_size | |
id | 1119328 |
size | 113,944 |
A captcha middleware for salvo framework. With fully customizable captchas generator, storage, and finders
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
See the examples directory for a complete example. You can also see the implemented generators, storages, and finders in the source code.
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.
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"] }
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.
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.
In this table, you can see the difference between the difficulties and the name of the captcha.
Name | Easy | Medium | Hard |
---|---|---|---|
Normal | |||
SlightlyTwisted | |||
VeryTwisted |
This project is licensed under the MIT license for more details see LICENSE or http://opensource.org/licenses/MIT.