[][src]Struct sage_auth::session::Session

pub struct Session { /* fields omitted */ }

A Minecraft authentication session with access_token and client_token saved.

Methods

impl Session[src]

pub async fn from_token<S: Into<String>>(
    access_token: S,
    client_token: Uuid
) -> Result<Session>
[src]

Use saved access_token to create a session.

let session = Session::from_token("ACCESS_TOKEN", Uuid::new_v4()).await?;

pub async fn login<'_, '_>(
    username: &'_ str,
    password: &'_ str
) -> Result<Session>
[src]

Login to create a session.

let session = Session::login("USERNAME", "PASSWORD").await?;

pub async fn join_server<'_, '_>(
    &'_ self,
    server_id_hash: &'_ str
) -> Result<()>
[src]

Post a join message to Mojang session server.

Note: server_id_hash is generated by a special hash function, which can be found in wiki.vg

let session = Session::login("USERNAME", "PASSWORD").await?;
let server_hash = "...";

session.join_server(server_hash).await?;

pub fn access_token(&self) -> &str[src]

Get access_token

pub fn client_token(&self) -> Uuid[src]

Get client_token

Trait Implementations

impl Debug for Session[src]

Auto Trait Implementations

impl RefUnwindSafe for Session

impl Send for Session

impl Sync for Session

impl Unpin for Session

impl UnwindSafe for Session

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,