Documentation Index Fetch the complete documentation index at: https://mintlify.com/claration/Impactor/llms.txt
Use this file to discover all available pages before exploring further.
The authentication module provides functionality for logging into Apple accounts using the SRP (Secure Remote Password) protocol and managing authentication tokens.
Account struct
pub struct Account {
pub anisette : Arc < Mutex < AnisetteData >>,
pub spd : Option < plist :: Dictionary >,
pub client : Client ,
}
Represents an authenticated Apple ID session.
Creating an account
Login with credentials
With existing anisette
use plume_core :: auth :: Account ;
use omnisette :: AnisetteConfiguration ;
let config = AnisetteConfiguration :: default ();
let account = Account :: login (
|| Ok (( "user@example.com" . to_string (), "password" . to_string ())),
|| Ok ( "123456" . to_string ()), // 2FA code
config
) . await ? ;
Methods
pub async fn new ( config : AnisetteConfiguration ) -> Result < Self , Error >
Creates a new account instance with anisette data
pub async fn login (
appleid_closure : impl Fn () -> Result <( String , String ), String >,
tfa_closure : impl Fn () -> Result < String , String >,
config : AnisetteConfiguration ,
) -> Result < Account , Error >
Authenticates with Apple ID credentials. The closures are called when credentials or 2FA codes are needed. Returns (username, password) tuple
Returns the two-factor authentication code when required
Configuration for anisette data generation
pub async fn login_email_pass (
& mut self ,
username : & str ,
password : & str ,
) -> Result < LoginState , Error >
Attempts to log in with email and password. Returns the current login state.
pub async fn get_app_token ( & self , app : & str ) -> Result < AppToken , Error >
Retrieves an app-specific authentication token (e.g., “com.apple.gs.xcode.auth”)
pub fn get_name ( & self ) -> ( String , String )
Returns (first_name, last_name) from the authenticated session
pub fn get_pet ( & self ) -> Option < String >
Retrieves the PET (Profile Exchange Token) from the session
Login state
pub enum LoginState {
LoggedIn ,
NeedsDevice2FA ,
Needs2FAVerification ,
NeedsSMS2FA ,
NeedsSMS2FAVerification ( VerifyBody ),
NeedsExtraStep ( String ),
NeedsLogin ,
}
Represents the current state of the authentication flow.
Authentication completed successfully
Two-factor authentication code sent to trusted devices
Waiting for 2FA code verification
SMS two-factor authentication required
Waiting for SMS 2FA code verification
Additional authentication step required (e.g., security questions)
App token
pub struct AppToken {
pub app_tokens : plist :: Dictionary ,
pub auth_token : String ,
pub app : String ,
}
Contains authentication tokens for specific Apple services.
Two-factor authentication
Trusted phone numbers
pub struct TrustedPhoneNumber {
pub number_with_dial_code : String ,
pub last_two_digits : String ,
pub push_mode : String ,
pub id : u32 ,
}
pub struct AuthenticationExtras {
pub trusted_phone_numbers : Vec < TrustedPhoneNumber >,
pub recovery_url : Option < String >,
pub cant_use_phone_number_url : Option < String >,
pub dont_have_access_url : Option < String >,
pub recovery_web_url : Option < String >,
pub repair_phone_number_url : Option < String >,
pub repair_phone_number_web_url : Option < String >,
}
Example: Full authentication flow
use plume_core :: auth :: Account ;
use omnisette :: AnisetteConfiguration ;
#[tokio :: main]
async fn main () -> Result <(), plume_core :: Error > {
let config = AnisetteConfiguration :: default ();
let account = Account :: login (
|| {
// Prompt user for credentials
Ok (( "user@icloud.com" . to_string (), "password" . to_string ()))
},
|| {
// Prompt user for 2FA code
Ok ( "123456" . to_string ())
},
config
) . await ? ;
let ( first_name , last_name ) = account . get_name ();
println! ( "Logged in as: {} {}" , first_name , last_name );
Ok (())
}