Struct DeviceCode

Source
pub struct DeviceCode { /* private fields */ }
Expand description

Device Code Authentication

This struct represents the device code authentication process for Minecraft, specifically designed for use with custom Azure applications. It is used to authenticate a device and obtain a token that can be used to launch Minecraft.

Implementations§

Source§

impl DeviceCode

Source

pub fn new(client_id: &str) -> impl AsyncSendSync<Result<Self, Error>>

Initializes a new DeviceCode instance.

This method starts the device code authentication process by making an asynchronous request to the authentication server. It returns a future that resolves to a Result containing the DeviceCode instance on success or an error if the request fails.

§Arguments
  • client_id - The client ID obtained from the Minecraft authentication service.
§Returns
  • impl async_trait_alias::AsyncSendSync<Result<Self, reqwest::Error>> - A future that resolves to a Result containing the DeviceCode instance or an error.
Source

pub fn preinfo(&self) -> (&str, &str, u32, &str)

Provides pre-launch information.

This method returns a tuple containing the verification URL, the message to display to the user, the expiration time of the device code, and the user code. This information is useful for guiding the user through the device code authentication process.

§Returns
  • (&str, &str, u32, &str) - A tuple containing the verification URL, the message, the expiration time, and the user code.
Source

pub async fn launch( &self, bedrock_relm: bool, ) -> Result<CustomAuthData, Box<dyn Error>>

Launches Minecraft using the device code authentication process.

This method completes the device code authentication process by authenticating the device and obtaining a token. It then uses this token to launch Minecraft. The method supports both Bedrock Edition and Java Edition of Minecraft.

§Arguments
  • bedrock_relm - A boolean indicating whether to launch the Bedrock Edition of Minecraft.
§Returns
  • Result<CustomAuthData, Box<dyn std::error::Error>> - A result containing the authentication data or an error if the process fails.
Source

pub async fn refresh(&self)

Refreshes the device code authentication process.

This method is marked as experimental and currently does not perform any actions.

§Note

This method is intended for future use when implementing refresh functionality for the device code authentication process.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

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 T
where U: From<T>,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
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
Source§

impl<T> ErasedDestructor for T
where T: 'static,