Skip to main content

determine_required_code_type

Function determine_required_code_type 

Source
pub fn determine_required_code_type(
    confirmations: &[AllowedConfirmation],
) -> Option<EAuthSessionGuardType>
Expand description

Determine which Steam Guard code type is required from confirmations.

This is a pure function that examines the allowed confirmations and determines if an email code or device (TOTP) code is needed.

§Arguments

  • confirmations - List of allowed confirmations from the auth response

§Returns

  • Some(EAuthSessionGuardType) - The code type required (email or device)
  • None - If no code is required

§Example

use steam_auth::validation::determine_required_code_type;

let confirmations = vec![AllowedConfirmation {
    confirmation_type: EAuthSessionGuardType::KEAuthSessionGuardTypeEmailCode,
    message: Some("test@example.com".to_string()),
}];

let code_type = determine_required_code_type(&confirmations);
assert_eq!(code_type, Some(EAuthSessionGuardType::KEAuthSessionGuardTypeEmailCode));