Struct keyauth_obf::v1_2::KeyauthApi
source · pub struct KeyauthApi {Show 16 fields
pub api_url: String,
pub num_keys: String,
pub num_online_users: String,
pub num_users: String,
pub app_version: String,
pub customer_panel_link: String,
pub username: String,
pub ip: String,
pub hwid: String,
pub create_date: String,
pub last_login: String,
pub subscription: String,
pub message: String,
pub success: bool,
pub blacklisted: bool,
pub response: String,
/* private fields */
}Expand description
every function in this struct (accept log) returns a Result and Err(“Request was tampered with”) will be returned if the request signature doesnt mathc the sha256 hmac of the message
Fields§
§api_url: String§num_keys: String§num_online_users: String§num_users: String§app_version: String§customer_panel_link: String§username: String§ip: String§hwid: String§create_date: String§last_login: String§subscription: String§message: String§success: bool§blacklisted: bool§response: StringImplementations§
source§impl KeyauthApi
impl KeyauthApi
sourcepub fn new(
name: &str,
owner_id: &str,
secret: &str,
version: &str,
api_url: &str
) -> Self
pub fn new( name: &str, owner_id: &str, secret: &str, version: &str, api_url: &str ) -> Self
creats a new KeyauthApi and its defaults, api_url has to be api version 1.2 example: “https://keyauth.win/api/1.2/” or if you have a custom api domain: “https://api.example.com/1.2/”
sourcepub async fn init(&mut self, hash: Option<&str>) -> Res<()>
pub async fn init(&mut self, hash: Option<&str>) -> Res<()>
initializes a session, required to run before any other function in this struct!!! accept new
sourcepub async fn register(
&mut self,
username: String,
password: String,
license: String,
hwid: Option<String>
) -> Res<()>
pub async fn register( &mut self, username: String, password: String, license: String, hwid: Option<String> ) -> Res<()>
registeres a new user
sourcepub async fn upgrade(&mut self, username: String, license: String) -> Res<()>
pub async fn upgrade(&mut self, username: String, license: String) -> Res<()>
upgrades a user license level or extends a license
sourcepub async fn login(
&mut self,
username: String,
password: String,
hwid: Option<String>
) -> Res<()>
pub async fn login( &mut self, username: String, password: String, hwid: Option<String> ) -> Res<()>
login self explanatory
sourcepub async fn var(&mut self, varid: String) -> Res<String>
pub async fn var(&mut self, varid: String) -> Res<String>
this will get a global variable (not user) and return it
sourcepub async fn file(&mut self, fileid: String) -> Res<Vec<u8>>
pub async fn file(&mut self, fileid: String) -> Res<Vec<u8>>
downloads a file, and decodes using base16::decode
sourcepub async fn webhook(&mut self, webid: String, params: String) -> Res<String>
pub async fn webhook(&mut self, webid: String, params: String) -> Res<String>
sends a webhook from keyauth’s servers so the url isnt exposed
sourcepub async fn checkblacklist(&mut self) -> Res<()>
pub async fn checkblacklist(&mut self) -> Res<()>
checks if the user is blacklisted and sets self.blacklisted acordingly
sourcepub async fn check_session(&mut self) -> Res<bool>
pub async fn check_session(&mut self) -> Res<bool>
checks if the session is still active or if it expired
sourcepub async fn fetch_online(&mut self) -> Res<Value>
pub async fn fetch_online(&mut self) -> Res<Value>
gets json of online users
sourcepub async fn get_chat(&mut self, channel: String) -> Res<Value>
pub async fn get_chat(&mut self, channel: String) -> Res<Value>
gets the arry of messages in a channel
sourcepub async fn send_chat_message(
&mut self,
channel: String,
message: String
) -> Res<()>
pub async fn send_chat_message( &mut self, channel: String, message: String ) -> Res<()>
sends a chat message in a channel
sourcepub async fn setvar(&mut self, varname: String, varvalue: String) -> Res<()>
pub async fn setvar(&mut self, varname: String, varvalue: String) -> Res<()>
sets a user variable to varvalue
sourcepub async fn change_username(&mut self, new_username: String) -> Res<String>
pub async fn change_username(&mut self, new_username: String) -> Res<String>
changes Username,
Trait Implementations§
source§impl Clone for KeyauthApi
impl Clone for KeyauthApi
source§fn clone(&self) -> KeyauthApi
fn clone(&self) -> KeyauthApi
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more