List of all items
Structs
- AddNotification
- Captcha
- CreateCaptcha
- Level
- NameHash
- Notification
- Register
- Secret
- StatsUnixTimestamp
- TrafficPattern
- UpdateEmail
diff --git a/crates.js b/crates.js index e343d53a..33cb38b3 100644 --- a/crates.js +++ b/crates.js @@ -1 +1 @@ -window.ALL_CRATES = ["mcaptcha","tests_migrate"]; \ No newline at end of file +window.ALL_CRATES = ["db_core","db_sqlx_postgres","mcaptcha"]; \ No newline at end of file diff --git a/db_core/all.html b/db_core/all.html new file mode 100644 index 00000000..387959f7 --- /dev/null +++ b/db_core/all.html @@ -0,0 +1,7 @@ +
#[async_trait]useful imports for supporting a new database
+pub use super::prelude::*;types of credentials used as identifiers during login
+Username(&'a str)username as login
+Email(&'a str)email as login
+Deserialize this value from the given Serde deserializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub enum DBError {
+ DBError(BoxDynError),
+ UsernameTaken,
+ EmailTaken,
+ SecretTaken,
+ CaptchaKeyTaken,
+ AccountNotFound,
+ CaptchaNotFound,
+ TrafficPatternNotFound,
+ NotificationNotFound,
+}Error data structure grouping various error subtypes
+DBError(BoxDynError)errors that are specific to a database implementation
+UsernameTakenUsername is taken
+EmailTakenEmail is taken
+SecretTakenSecret is taken
+CaptchaKeyTakenCaptcha key is taken
+AccountNotFoundAccount not found
+CaptchaNotFoundCaptcha not found
+TrafficPatternNotFoundTraffic pattern not found
+NotificationNotFoundNotification not found
+The lower-level source of this error, if any. Read more
+backtrace)Returns a stack backtrace, if available, of where this error occurred. Read more
+use the Display impl or to_string()
+Mutably borrows from an owned value. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
represents all the ways a trait can fail using this crate
+Error data structure grouping various error subtypes
+Convenience type alias for grouping driver-specific errors
+Generic result data structure
+mCaptcha database operationsTraits and datastructures used in mCaptcha to interact with database.
+To use an unsupported database with mCaptcha, traits present within this crate should be +implemented.
+Database functionallity is divided accross various modules:
+ +pub use ops::GetConnection;useful imports for supporting a new database
+represents all the ways a trait can fail using this crate
+meta operations like migration and connecting to a database
+useful imports for users working with a supported database
+Test utilities
+Data required to add notification
+Data representing a captcha
+data requried to create new captcha
+Level struct that describes threshold-difficulty factor mapping
+type encapsulating username and hashed password of a user
+Represents notification
+Data required to register a new user
+datastructure representing a user’s secret
+Captcha statistics with time recorded in UNIX epoch formats
+User’s traffic pattern; used in generating a captcha configuration
+data required to update them email of a user
+types of credentials used as identifiers during login
+Trait to clone MCDatabase
+mCaptcha’s database requirements. To implement support for $Database, kindly implement this +trait.
+meta operations like migration and connecting to a database
+Create databse connection
+Database operations trait(migrations, pool creation and fetching connection from pool)
+Get database connection
+database migrations
+pub trait Connect {
+ type Pool: MCDatabase;
+ fn connect<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = DBResult<Self::Pool>> + Send + 'async_trait>>
where
Self: 'async_trait;
+}Create databse connection
+database specific pool-type
+pub trait GetConnection {
+ type Conn;
+ fn get_conn<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = DBResult<Self::Conn>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
+}Get database connection
+pub struct AddNotification<'a> {
+ pub to: &'a str,
+ pub from: &'a str,
+ pub heading: &'a str,
+ pub message: &'a str,
+}Data required to add notification
+to: &'a strwho is the notification addressed to?
+from: &'a strnotification sender
+heading: &'a strheading of the notification
+message: &'a strmesage of the notification
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct Captcha {
+ pub config_id: i32,
+ pub duration: i32,
+ pub description: String,
+ pub key: String,
+}Data representing a captcha
+config_id: i32Database assigned ID
+duration: i32cool down duration
+description: Stringdescription of the captcha
+key: Stringsecret key of the captcha
+Deserialize this value from the given Serde deserializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct CreateCaptcha<'a> {
+ pub duration: i32,
+ pub description: &'a str,
+ pub key: &'a str,
+}data requried to create new captcha
+duration: i32cool down duration
+description: &'a strdescription of the captcha
+key: &'a strsecret key of the captcha
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Level struct that describes threshold-difficulty factor mapping
+visitor_threshold: u32difficulty_factor: u32Deserialize this value from the given Serde deserializer. Read more
+Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
type encapsulating username and hashed password of a user
+username: Stringusername
+hash: Stringhashed password
+Deserialize this value from the given Serde deserializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct Notification {
+ pub name: Option<String>,
+ pub heading: Option<String>,
+ pub message: Option<String>,
+ pub received: Option<i64>,
+ pub id: Option<i32>,
+}Represents notification
+name: Option<String>receiver name of the notification
+heading: Option<String>heading of the notification
+message: Option<String>message of the notification
+received: Option<i64>when notification was received
+id: Option<i32>db assigned ID of the notification
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct Register<'a> {
+ pub username: &'a str,
+ pub secret: &'a str,
+ pub hash: &'a str,
+ pub email: Option<&'a str>,
+}Data required to register a new user
+username: &'a strusername of new user
+secret: &'a strsecret of new user
+hash: &'a strhashed password of new use
+email: Option<&'a str>Optionally, email of new use
+Deserialize this value from the given Serde deserializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct Secret {
+ pub secret: String,
+}datastructure representing a user’s secret
+secret: Stringuser’s secret
+Deserialize this value from the given Serde deserializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct StatsUnixTimestamp {
+ pub config_fetches: Vec<i64>,
+ pub solves: Vec<i64>,
+ pub confirms: Vec<i64>,
+}Captcha statistics with time recorded in UNIX epoch formats
+config_fetches: Vec<i64>times at which the configuration were fetched
+solves: Vec<i64>times at which the PoW was solved
+confirms: Vec<i64>times at which the PoW token was verified
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct TrafficPattern {
+ pub avg_traffic: u32,
+ pub peak_sustainable_traffic: u32,
+ pub broke_my_site_traffic: Option<u32>,
+}User’s traffic pattern; used in generating a captcha configuration
+avg_traffic: u32average traffic of user’s website
+peak_sustainable_traffic: u32the peak traffic that the user’s website can handle
+broke_my_site_traffic: Option<u32>trafic that bought the user’s website down; optional
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
data required to update them email of a user
+username: &'a strusername of the user
+new_email: &'a strnew email address of the user
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub async fn database_works<'a, T: MCDatabase>(
db: &T,
p: &Register<'a>,
c: &CreateCaptcha<'a>,
l: &[Level],
tp: &TrafficPattern,
an: &AddNotification<'a>
)test all database functions
+pub trait CloneSPDatabase {
+ fn clone_db(&self) -> Box<dyn MCDatabase>;
+}Trait to clone MCDatabase
+clone DB
+pub trait MCDatabase: Send + Sync + CloneSPDatabase {
+Show 35 methods
fn ping<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait;
+ fn register<'life0, 'life1, 'async_trait>(
&'life0 self,
p: &'life1 Register<'_>
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn delete_user<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn username_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = DBResult<bool>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn get_email<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = DBResult<Option<String>>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn email_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str
) -> Pin<Box<dyn Future<Output = DBResult<bool>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn update_email<'life0, 'life1, 'async_trait>(
&'life0 self,
p: &'life1 UpdateEmail<'_>
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn get_password<'life0, 'life1, 'async_trait>(
&'life0 self,
l: &'life1 Login<'_>
) -> Pin<Box<dyn Future<Output = DBResult<NameHash>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn update_password<'life0, 'life1, 'async_trait>(
&'life0 self,
p: &'life1 NameHash
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn update_username<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
current: &'life1 str,
new: &'life2 str
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn get_secret<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = DBResult<Secret>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn update_secret<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
secret: &'life2 str
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn create_captcha<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
p: &'life2 CreateCaptcha<'_>
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn get_captcha_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
key: &'life2 str
) -> Pin<Box<dyn Future<Output = DBResult<Captcha>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn get_all_user_captchas<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = DBResult<Vec<Captcha>>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn update_captcha_metadata<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
p: &'life2 CreateCaptcha<'_>
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn update_captcha_key<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
username: &'life1 str,
old_key: &'life2 str,
new_key: &'life3 str
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
+ fn add_captcha_levels<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
username: &'life1 str,
captcha_key: &'life2 str,
levels: &'life3 [Level]
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
+ fn captcha_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: Option<&'life1 str>,
captcha_key: &'life2 str
) -> Pin<Box<dyn Future<Output = DBResult<bool>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn delete_captcha_levels<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
captcha_key: &'life2 str
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn delete_captcha<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
captcha_key: &'life2 str
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn get_captcha_levels<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: Option<&'life1 str>,
captcha_key: &'life2 str
) -> Pin<Box<dyn Future<Output = DBResult<Vec<Level>>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn get_captcha_cooldown<'life0, 'life1, 'async_trait>(
&'life0 self,
captcha_key: &'life1 str
) -> Pin<Box<dyn Future<Output = DBResult<i32>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn add_traffic_pattern<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
username: &'life1 str,
captcha_key: &'life2 str,
pattern: &'life3 TrafficPattern
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
+ fn get_traffic_pattern<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
captcha_key: &'life2 str
) -> Pin<Box<dyn Future<Output = DBResult<TrafficPattern>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn delete_traffic_pattern<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
captcha_key: &'life2 str
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn create_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
p: &'life1 AddNotification<'_>
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn get_all_unread_notifications<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = DBResult<Vec<Notification>>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn mark_notification_read<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str,
id: i32
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn record_fetch<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn record_solve<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn record_confirm<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str
) -> Pin<Box<dyn Future<Output = DBResult<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn fetch_config_fetched<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user: &'life1 str,
key: &'life2 str
) -> Pin<Box<dyn Future<Output = DBResult<Vec<i64>>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn fetch_solve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user: &'life1 str,
key: &'life2 str
) -> Pin<Box<dyn Future<Output = DBResult<Vec<i64>>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn fetch_confirm<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user: &'life1 str,
key: &'life2 str
) -> Pin<Box<dyn Future<Output = DBResult<Vec<i64>>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+}mCaptcha’s database requirements. To implement support for $Database, kindly implement this +trait.
+ping DB
+register a new user
+delete a user
+check if username exists
+get user email
+check if email exists
+update a user’s email
+get a user’s password
+update user’s password
+update username
+get a user’s secret
+update a user’s secret
+create new captcha
+Get captcha config
+Get all captchas belonging to user
+update captcha metadata; doesn’t change captcha key
+update captcha key; doesn’t change metadata
+Add levels to captcha
+check if captcha exists
+Delete all levels of a captcha
+Delete captcha
+Get captcha levels
+Get captcha’s cooldown period
+Add traffic configuration
+Get traffic configuration
+Delete traffic configuration
+create new notification
+get all unread notifications
+mark a notification read
+record PoWConfig fetches
+record PoWConfig solves
+record PoWConfig confirms
+featch PoWConfig fetches
+featch PoWConfig solves
+featch PoWConfig confirms
+#[async_trait]#[async_trait]pub enum DBError {
+ DBError(Box<dyn Error + Send + Sync + 'static, Global>),
+ UsernameTaken,
+ EmailTaken,
+ SecretTaken,
+ CaptchaKeyTaken,
+ AccountNotFound,
+ CaptchaNotFound,
+ TrafficPatternNotFound,
+ NotificationNotFound,
+}Error data structure grouping various error subtypes
+DBError(Box<dyn Error + Send + Sync + 'static, Global>)errors that are specific to a database implementation
+UsernameTakenUsername is taken
+EmailTakenEmail is taken
+SecretTakenSecret is taken
+CaptchaKeyTakenCaptcha key is taken
+AccountNotFoundAccount not found
+CaptchaNotFoundCaptcha not found
+TrafficPatternNotFoundTraffic pattern not found
+NotificationNotFoundNotification not found
+The lower-level source of this error, if any. Read more
+backtrace)Returns a stack backtrace, if available, of where this error occurred. Read more
+use the Display impl or to_string()
+Mutably borrows from an owned value. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
types of credentials used as identifiers during login
+Username(&'a str)username as login
+Email(&'a str)email as login
+Deserialize this value from the given Serde deserializer. Read more
+Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
useful imports for supporting a new database
+useful imports for users working with a supported database
+Data required to add notification
+Data representing a captcha
+data requried to create new captcha
+Level struct that describes threshold-difficulty factor mapping
+type encapsulating username and hashed password of a user
+Represents notification
+Data required to register a new user
+datastructure representing a user’s secret
+Captcha statistics with time recorded in UNIX epoch formats
+User’s traffic pattern; used in generating a captcha configuration
+data required to update them email of a user
+Error data structure grouping various error subtypes
+types of credentials used as identifiers during login
+Trait to clone MCDatabase
+Create databse connection
+Database operations trait(migrations, pool creation and fetching connection from pool)
+Get database connection
+mCaptcha’s database requirements. To implement support for $Database, kindly implement this +trait.
+database migrations
+Convenience type alias for grouping driver-specific errors
+Generic result data structure
+pub enum DBError {
+ DBError(Box<dyn Error + Send + Sync + 'static, Global>),
+ UsernameTaken,
+ EmailTaken,
+ SecretTaken,
+ CaptchaKeyTaken,
+ AccountNotFound,
+ CaptchaNotFound,
+ TrafficPatternNotFound,
+ NotificationNotFound,
+}Error data structure grouping various error subtypes
+DBError(Box<dyn Error + Send + Sync + 'static, Global>)errors that are specific to a database implementation
+UsernameTakenUsername is taken
+EmailTakenEmail is taken
+SecretTakenSecret is taken
+CaptchaKeyTakenCaptcha key is taken
+AccountNotFoundAccount not found
+CaptchaNotFoundCaptcha not found
+TrafficPatternNotFoundTraffic pattern not found
+NotificationNotFoundNotification not found
+The lower-level source of this error, if any. Read more
+backtrace)Returns a stack backtrace, if available, of where this error occurred. Read more
+use the Display impl or to_string()
+Mutably borrows from an owned value. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
types of credentials used as identifiers during login
+Username(&'a str)username as login
+Email(&'a str)email as login
+Deserialize this value from the given Serde deserializer. Read more
+Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
useful imports for users working with a supported database
+Data required to add notification
+Data representing a captcha
+data requried to create new captcha
+Level struct that describes threshold-difficulty factor mapping
+type encapsulating username and hashed password of a user
+Represents notification
+Data required to register a new user
+datastructure representing a user’s secret
+Captcha statistics with time recorded in UNIX epoch formats
+User’s traffic pattern; used in generating a captcha configuration
+data required to update them email of a user
+Error data structure grouping various error subtypes
+types of credentials used as identifiers during login
+Trait to clone MCDatabase
+Create databse connection
+Database operations trait(migrations, pool creation and fetching connection from pool)
+Get database connection
+mCaptcha’s database requirements. To implement support for $Database, kindly implement this +trait.
+database migrations
+Convenience type alias for grouping driver-specific errors
+Generic result data structure
+pub struct AddNotification<'a> {
+ pub to: &'a str,
+ pub from: &'a str,
+ pub heading: &'a str,
+ pub message: &'a str,
+}Data required to add notification
+to: &'a strwho is the notification addressed to?
+from: &'a strnotification sender
+heading: &'a strheading of the notification
+message: &'a strmesage of the notification
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct Captcha {
+ pub config_id: i32,
+ pub duration: i32,
+ pub description: String,
+ pub key: String,
+}Data representing a captcha
+config_id: i32Database assigned ID
+duration: i32cool down duration
+description: Stringdescription of the captcha
+key: Stringsecret key of the captcha
+Deserialize this value from the given Serde deserializer. Read more
+Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct CreateCaptcha<'a> {
+ pub duration: i32,
+ pub description: &'a str,
+ pub key: &'a str,
+}data requried to create new captcha
+duration: i32cool down duration
+description: &'a strdescription of the captcha
+key: &'a strsecret key of the captcha
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Level struct that describes threshold-difficulty factor mapping
+visitor_threshold: u32difficulty_factor: u32Deserialize this value from the given Serde deserializer. Read more
+Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
type encapsulating username and hashed password of a user
+username: Stringusername
+hash: Stringhashed password
+Deserialize this value from the given Serde deserializer. Read more
+Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct Notification {
+ pub name: Option<String>,
+ pub heading: Option<String>,
+ pub message: Option<String>,
+ pub received: Option<i64>,
+ pub id: Option<i32>,
+}Represents notification
+name: Option<String>receiver name of the notification
+heading: Option<String>heading of the notification
+message: Option<String>message of the notification
+received: Option<i64>when notification was received
+id: Option<i32>db assigned ID of the notification
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+Converts to this type from the input type.
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct Register<'a> {
+ pub username: &'a str,
+ pub secret: &'a str,
+ pub hash: &'a str,
+ pub email: Option<&'a str>,
+}Data required to register a new user
+username: &'a strusername of new user
+secret: &'a strsecret of new user
+hash: &'a strhashed password of new use
+email: Option<&'a str>Optionally, email of new use
+Deserialize this value from the given Serde deserializer. Read more
+Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct Secret {
+ pub secret: String,
+}datastructure representing a user’s secret
+secret: Stringuser’s secret
+Deserialize this value from the given Serde deserializer. Read more
+Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct StatsUnixTimestamp {
+ pub config_fetches: Vec<i64, Global>,
+ pub solves: Vec<i64, Global>,
+ pub confirms: Vec<i64, Global>,
+}Captcha statistics with time recorded in UNIX epoch formats
+config_fetches: Vec<i64, Global>times at which the configuration were fetched
+solves: Vec<i64, Global>times at which the PoW was solved
+confirms: Vec<i64, Global>times at which the PoW token was verified
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct TrafficPattern {
+ pub avg_traffic: u32,
+ pub peak_sustainable_traffic: u32,
+ pub broke_my_site_traffic: Option<u32>,
+}User’s traffic pattern; used in generating a captcha configuration
+avg_traffic: u32average traffic of user’s website
+peak_sustainable_traffic: u32the peak traffic that the user’s website can handle
+broke_my_site_traffic: Option<u32>trafic that bought the user’s website down; optional
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
data required to update them email of a user
+username: &'a strusername of the user
+new_email: &'a strnew email address of the user
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub trait CloneSPDatabase {
+ fn clone_db(&self) -> Box<dyn MCDatabase + 'static, Global>;
+}Trait to clone MCDatabase
+clone DB
+pub trait Connect {
+ type Pool: MCDatabase;
+ fn connect<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Result<Self::Pool, DBError>> + Send + 'async_trait, Global>>
where
Self: 'async_trait;
+}Create databse connection
+database specific pool-type
+pub trait DBOps: GetConnection + Migrate { }Database operations trait(migrations, pool creation and fetching connection from pool)
+pub trait GetConnection {
+ type Conn;
+ fn get_conn<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Conn, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
Self: 'async_trait;
+}Get database connection
+pub trait MCDatabase: Send + Sync + CloneSPDatabase {
+Show 35 methods
fn ping<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
Self: 'async_trait;
+ fn register<'life0, 'life1, 'async_trait>(
&'life0 self,
p: &'life1 Register<'_>
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn delete_user<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn username_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<bool, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn get_email<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Option<String>, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn email_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<bool, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn update_email<'life0, 'life1, 'async_trait>(
&'life0 self,
p: &'life1 UpdateEmail<'_>
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn get_password<'life0, 'life1, 'async_trait>(
&'life0 self,
l: &'life1 Login<'_>
) -> Pin<Box<dyn Future<Output = Result<NameHash, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn update_password<'life0, 'life1, 'async_trait>(
&'life0 self,
p: &'life1 NameHash
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn update_username<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
current: &'life1 str,
new: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn get_secret<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Secret, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn update_secret<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
secret: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn create_captcha<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
p: &'life2 CreateCaptcha<'_>
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn get_captcha_config<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
key: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<Captcha, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn get_all_user_captchas<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Vec<Captcha, Global>, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn update_captcha_metadata<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
p: &'life2 CreateCaptcha<'_>
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn update_captcha_key<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
username: &'life1 str,
old_key: &'life2 str,
new_key: &'life3 str
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
+ fn add_captcha_levels<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
username: &'life1 str,
captcha_key: &'life2 str,
levels: &'life3 [Level]
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
+ fn captcha_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: Option<&'life1 str>,
captcha_key: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<bool, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn delete_captcha_levels<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
captcha_key: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn delete_captcha<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
captcha_key: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn get_captcha_levels<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: Option<&'life1 str>,
captcha_key: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<Vec<Level, Global>, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn get_captcha_cooldown<'life0, 'life1, 'async_trait>(
&'life0 self,
captcha_key: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<i32, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn add_traffic_pattern<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
username: &'life1 str,
captcha_key: &'life2 str,
pattern: &'life3 TrafficPattern
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
+ fn get_traffic_pattern<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
captcha_key: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<TrafficPattern, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn delete_traffic_pattern<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
captcha_key: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn create_notification<'life0, 'life1, 'async_trait>(
&'life0 self,
p: &'life1 AddNotification<'_>
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn get_all_unread_notifications<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Vec<Notification, Global>, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn mark_notification_read<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str,
id: i32
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn record_fetch<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn record_solve<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn record_confirm<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<(), DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
+ fn fetch_config_fetched<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user: &'life1 str,
key: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<Vec<i64, Global>, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn fetch_solve<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user: &'life1 str,
key: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<Vec<i64, Global>, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+ fn fetch_confirm<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user: &'life1 str,
key: &'life2 str
) -> Pin<Box<dyn Future<Output = Result<Vec<i64, Global>, DBError>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait;
+}mCaptcha’s database requirements. To implement support for $Database, kindly implement this +trait.
+ping DB
+register a new user
+delete a user
+check if username exists
+get user email
+check if email exists
+update a user’s email
+get a user’s password
+update user’s password
+update username
+get a user’s secret
+update a user’s secret
+create new captcha
+Get captcha config
+Get all captchas belonging to user
+update captcha metadata; doesn’t change captcha key
+update captcha key; doesn’t change metadata
+Add levels to captcha
+check if captcha exists
+Delete all levels of a captcha
+Delete captcha
+Get captcha levels
+Get captcha’s cooldown period
+Add traffic configuration
+Get traffic configuration
+Delete traffic configuration
+create new notification
+get all unread notifications
+mark a notification read
+record PoWConfig fetches
+record PoWConfig solves
+record PoWConfig confirms
+featch PoWConfig fetches
+featch PoWConfig solves
+featch PoWConfig confirms
+pub struct AddNotification<'a> {
+ pub to: &'a str,
+ pub from: &'a str,
+ pub heading: &'a str,
+ pub message: &'a str,
+}Data required to add notification
+to: &'a strwho is the notification addressed to?
+from: &'a strnotification sender
+heading: &'a strheading of the notification
+message: &'a strmesage of the notification
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct Captcha {
+ pub config_id: i32,
+ pub duration: i32,
+ pub description: String,
+ pub key: String,
+}Data representing a captcha
+config_id: i32Database assigned ID
+duration: i32cool down duration
+description: Stringdescription of the captcha
+key: Stringsecret key of the captcha
+Deserialize this value from the given Serde deserializer. Read more
+Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct CreateCaptcha<'a> {
+ pub duration: i32,
+ pub description: &'a str,
+ pub key: &'a str,
+}data requried to create new captcha
+duration: i32cool down duration
+description: &'a strdescription of the captcha
+key: &'a strsecret key of the captcha
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Level struct that describes threshold-difficulty factor mapping
+visitor_threshold: u32difficulty_factor: u32Deserialize this value from the given Serde deserializer. Read more
+Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
type encapsulating username and hashed password of a user
+username: Stringusername
+hash: Stringhashed password
+Deserialize this value from the given Serde deserializer. Read more
+Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct Notification {
+ pub name: Option<String>,
+ pub heading: Option<String>,
+ pub message: Option<String>,
+ pub received: Option<i64>,
+ pub id: Option<i32>,
+}Represents notification
+name: Option<String>receiver name of the notification
+heading: Option<String>heading of the notification
+message: Option<String>message of the notification
+received: Option<i64>when notification was received
+id: Option<i32>db assigned ID of the notification
+Returns a copy of the value. Read more
+Performs copy-assignment from source. Read more
Returns the “default value” for a type. Read more
+Deserialize this value from the given Serde deserializer. Read more
+Converts to this type from the input type.
+This method tests for self and other values to be equal, and is used
+by ==. Read more
This method tests for !=.
Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub struct Register<'a> {
+ pub username: &'a str,
+ pub secret: &'a str,
+ pub hash: &'a str,
+ pub email: Option<&'a str>,
+}Data required to register a new user
+username: &'a strusername of new user
+secret: &'a strsecret of new user
+hash: &'a strhashed password of new use
+email: Option<&'a str>Optionally, email of new use
+Deserialize this value from the given Serde deserializer. Read more
+Serialize this value into the given Serde serializer. Read more
+Mutably borrows from an owned value. Read more
+The resulting type after obtaining ownership.
+toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
+Attaches the provided Subscriber to this type, returning a
+WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a
+WithDispatch wrapper. Read more
pub async fn delete_user(name: &str, data: &AppData) -> Result<(), ServiceError>pub fn services(cfg: &mut ServiceConfig)pub struct Email {
pub email: String,
-}email: StringReturns a copy of the value. Read more
+}email: StringDeserialize this value from the given Serde deserializer. Read more
-Deserialize this value from the given Serde deserializer. Read more
+Mutably borrows from an owned value. Read more
diff --git a/mcaptcha/api/v1/account/email/struct.email_exists.html b/mcaptcha/api/v1/account/email/struct.email_exists.html index 115d3b27..666b23f2 100644 --- a/mcaptcha/api/v1/account/email/struct.email_exists.html +++ b/mcaptcha/api/v1/account/email/struct.email_exists.html @@ -4,7 +4,7 @@pub struct email_exists;Gets the TypeId of self. Read more
pub struct email_exists;Mutably borrows from an owned value. Read more
Returns the argument unchanged.
diff --git a/mcaptcha/api/v1/account/email/struct.set_email.html b/mcaptcha/api/v1/account/email/struct.set_email.html index 56a3b6b4..7fcbe432 100644 --- a/mcaptcha/api/v1/account/email/struct.set_email.html +++ b/mcaptcha/api/v1/account/email/struct.set_email.html @@ -4,8 +4,8 @@pub struct set_email;update email
-Gets the TypeId of self. Read more
pub struct set_email;update email
+Mutably borrows from an owned value. Read more
Returns the argument unchanged.
diff --git a/mcaptcha/api/v1/account/password/fn.services.html b/mcaptcha/api/v1/account/password/fn.services.html index 03fe8a2a..3d3d7e9d 100644 --- a/mcaptcha/api/v1/account/password/fn.services.html +++ b/mcaptcha/api/v1/account/password/fn.services.html @@ -4,5 +4,5 @@pub fn services(cfg: &mut ServiceConfig)async fn update_password_runner(
user: &str,
update: UpdatePassword,
data: &Data
) -> Result<(), ServiceError>async fn update_password_runner(
user: &str,
update: UpdatePassword,
data: &Data
) -> Result<(), ServiceError>