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: String

Implementations§

source§

impl KeyauthApi

source

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/”

source

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

source

pub async fn register( &mut self, username: String, password: String, license: String, hwid: Option<String> ) -> Res<()>

registeres a new user

source

pub async fn upgrade(&mut self, username: String, license: String) -> Res<()>

upgrades a user license level or extends a license

source

pub async fn login( &mut self, username: String, password: String, hwid: Option<String> ) -> Res<()>

login self explanatory

source

pub async fn license( &mut self, license: String, hwid: Option<String> ) -> Res<()>

source

pub async fn var(&mut self, varid: String) -> Res<String>

this will get a global variable (not user) and return it

source

pub async fn file(&mut self, fileid: String) -> Res<Vec<u8>>

downloads a file, and decodes using base16::decode

source

pub async fn webhook(&mut self, webid: String, params: String) -> Res<String>

sends a webhook from keyauth’s servers so the url isnt exposed

source

pub async fn checkblacklist(&mut self) -> Res<()>

checks if the user is blacklisted and sets self.blacklisted acordingly

source

pub async fn check_session(&mut self) -> Res<bool>

checks if the session is still active or if it expired

source

pub async fn fetch_online(&mut self) -> Res<Value>

gets json of online users

source

pub async fn get_chat(&mut self, channel: String) -> Res<Value>

gets the arry of messages in a channel

source

pub async fn send_chat_message( &mut self, channel: String, message: String ) -> Res<()>

sends a chat message in a channel

source

pub async fn ban(&mut self)

self explanatory

source

pub async fn setvar(&mut self, varname: String, varvalue: String) -> Res<()>

sets a user variable to varvalue

source

pub async fn getvar(&mut self, varname: String) -> Res<String>

gets a user variable

source

pub async fn log(&mut self, message: String, pcuser: Option<String>)

logs somethink to keyauth

source

pub async fn change_username(&mut self, new_username: String) -> Res<String>

changes Username,

source

pub async fn web_login(&mut self, hwid: Option<String>) -> Res<()>

WARNING THIS FUNCTION ISNT OBFUSCATED DUE TO ERRORS

source

pub async fn button(&self, button: &str) -> Res<()>

Trait Implementations§

source§

impl Clone for KeyauthApi

source§

fn clone(&self) -> KeyauthApi

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for KeyauthApi

source§

fn default() -> KeyauthApi

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more