Skip to main content

Crate steam_totp

Crate steam_totp 

Source
Expand description

Steam TOTP and confirmation key generation.

This crate provides a pure Rust implementation of the node-steam-totp library, offering utilities for:

  • Generating Steam-compatible TOTP authentication codes
  • Creating confirmation keys for mobile trade confirmations
  • Generating device IDs from SteamIDs
  • Querying Steam server time offsets

§Example

use steam_totp::{generate_auth_code, Secret};

// Generate a TOTP code from a base64 shared secret
let secret = Secret::from_base64("SGVsbG9Xb3JsZDEyMzQ1Njc4OTA=").expect("totp error");
let code = generate_auth_code(&secret, 0).expect("totp error");
println!("Your Steam Guard code: {}", code);

Structs§

Secret
A secret key that can be provided in multiple formats.
SteamID
Represents a Steam ID with all its components.
TimeOffsetResponse
Response from querying Steam’s time server.

Enums§

TotpError
Errors that can occur during TOTP operations.

Functions§

generate_auth_code
Generate a Steam-style TOTP authentication code.
generate_auth_code_for_time
Generate a Steam-style TOTP code for a specific Unix timestamp.
generate_confirmation_key
Generate a base64 confirmation key for use with mobile trade confirmations.
generate_device_id
Generate a standardized device ID based on a SteamID.
generate_device_id_with_env_salt
Generate a device ID using the STEAM_TOTP_SALT environment variable if set.
get_time_offset
Query the Steam servers for the time offset.
time
Returns the current local Unix time with an optional offset.

Type Aliases§

Result
Result type for TOTP operations.