### Install steamguard-cli on Ubuntu/Debian Source: https://github.com/dyc3/steamguard-cli/blob/master/docs/quickstart.md Installs the steamguard-cli .deb package on Ubuntu or Debian systems using dpkg. Requires sudo privileges and assumes the .deb file is downloaded to the current directory. ```bash sudo dpkg -i ./steamguard-cli__amd64.deb ``` -------------------------------- ### Make steamguard executable and move to PATH on Linux Source: https://github.com/dyc3/steamguard-cli/blob/master/docs/quickstart.md Makes the steamguard binary executable and moves it to /usr/local/bin for system-wide access. Requires sudo privileges to move the file to a system directory. ```bash chmod +x ./steamguard sudo mv ./steamguard /usr/local/bin ``` -------------------------------- ### Import SDA maFile into steamguard-cli Source: https://github.com/dyc3/steamguard-cli/blob/master/docs/quickstart.md Imports a single maFile from Steam Desktop Authenticator into steamguard-cli. The path to the maFile must be specified as an argument. ```bash steamguard import --sda ``` -------------------------------- ### Setup Tooltips on DOMContentLoaded Source: https://github.com/dyc3/steamguard-cli/blob/master/steamguard/src/fixtures/confirmations/email-change.html Initializes tooltips with a specific CSS class ('community_tooltip') once the HTML document has been fully loaded and parsed. This enhances user experience by providing contextual information on hover. ```javascript document.addEventListener('DOMContentLoaded', function (event) { SetupTooltips({ tooltipCSSClass: 'community_tooltip' }); }); ``` -------------------------------- ### Setup New Steam Authenticator (CLI) Source: https://context7.com/dyc3/steamguard-cli/llms.txt Initiates an interactive command-line process to link a new Steam account and set up two-factor authentication. This involves entering credentials, verifying via email/SMS, and saving a revocation code. No direct output, but saves account data. ```bash # Interactive setup process steamguard setup # Follow prompts: # 1. Enter Steam username and password # 2. Complete email verification if required # 3. Receive and save revocation code (R#####) # 4. Enter SMS or email confirmation code # 5. Verify authenticator finalization # The account is saved to ~/.config/steamguard-cli/maFiles/ ``` -------------------------------- ### Setup New Steam Authenticator (Rust) Source: https://context7.com/dyc3/steamguard-cli/llms.txt Programmatically links a new Steam authenticator using provided access and refresh tokens. It handles potential errors like needing email confirmation or an existing authenticator. Outputs a revocation code upon success, which is critical for recovery. ```rust use steamguard::{AccountLinker, AccountLinkError, Tokens}; use steamguard::transport::WebApiTransport; // After logging in and obtaining tokens let transport = WebApiTransport::new(reqwest::blocking::Client::new()); let tokens = Tokens::new("access_token", "refresh_token"); let mut linker = AccountLinker::new(transport, tokens); // Attempt to link authenticator match linker.link() { Ok(link) => { let account = link.into_account(); println!("Revocation code: {}", account.revocation_code.expose_secret()); // Save revocation code - critical for account recovery }, Err(AccountLinkError::MustConfirmEmail) => { println!("Check email and confirm"); }, Err(AccountLinkError::AuthenticatorPresent) => { println!("Authenticator already exists"); }, Err(e) => eprintln!("Error: {}", e), } ``` -------------------------------- ### Transfer Mobile Authenticator to steamguard-cli Source: https://context7.com/dyc3/steamguard-cli/llms.txt Transfer existing authenticator from Steam mobile app without full revocation, resulting in only 2-day trade ban instead of 15 days. Requires setup interaction with transfer option selection and SMS verification. The transfer process involves starting transfer, receiving SMS code, and completing transfer with account creation. Provides revocation code for backup. ```bash # During setup, choose transfer option when authenticator exists steamguard setup # Select [T] Transfer authenticator option # Enter SMS code sent to phone # Authenticator is transferred with 2-day trade ban ``` ```rust use steamguard::{AccountLinker, SteamGuardAccount}; use steamguard::transport::WebApiTransport; let transport = WebApiTransport::new(reqwest::blocking::Client::new()); let mut linker = AccountLinker::new(transport, tokens); // Start transfer process linker.transfer_start() .expect("Failed to start transfer - phone number required"); // Enter SMS code received on phone let sms_code = "123456".to_string(); let account = linker.transfer_finish(sms_code) .expect("Failed to complete transfer"); println!("Transfer successful!"); println!("Revocation code: {}", account.revocation_code.expose_secret()); // Results in 2-day trade ban instead of 15 days ``` -------------------------------- ### jQuery and Tooltip/Economy Initialization Source: https://github.com/dyc3/steamguard-cli/blob/master/steamguard/src/fixtures/confirmations/phone-number-change.html This code utilizes jQuery to initialize various UI elements. It sets up tooltips on DOMContentLoaded, and later initializes economy-related hovers and functionality after the DOM is ready. ```javascript document.addEventListener('DOMContentLoaded', function(event) { SetupTooltips( { tooltipCSSClass: 'community_tooltip'} ); }); $J( function() { window.location="steammobile:\/\/settitle?title=Confirmations"; }); $J( function() { InitEconomyHovers( "https:\/\/community.cloudflare.steamstatic.com\/public\/css\/skin_1\/economy.css?v=wliPEsKn4dhI&l=english&\_cdn=cloudflare", "https:\/\/community.cloudflare.steamstatic.com\/public\/javascript\/economy_common.js?v=tsXdRVB0yEaR&l=english&\_cdn=cloudflare", "https:\/\/community.cloudflare.steamstatic.com\/public\/javascript\/economy.js?v=n3ZFab2IK68b&l=english&\_cdn=cloudflare" );}); ``` -------------------------------- ### Configure CLI with Global Options and Custom Settings Source: https://context7.com/dyc3/steamguard-cli/llms.txt Configure command-line interface with user selection, account processing, encryption settings, proxy configuration, and verbosity control. Supports environment variable passkey, HTTP proxy with authentication, and dangerous certificate acceptance. Multiple accounts can be processed simultaneously with custom maFiles locations. ```bash # Generate code for specific user steamguard -u username # Use all accounts steamguard --all confirm --accept-all # Custom maFiles directory steamguard -m /path/to/maFiles confirm # Specify encryption passkey via environment export STEAMGUARD_CLI_PASSKEY="my_passkey" steamguard confirm # Use HTTP proxy steamguard --http-proxy http://proxy:8080 confirm # Proxy with authentication steamguard --http-proxy http://proxy:8080 --proxy-credentials user:pass confirm # Set verbosity level steamguard -v debug confirm # Accept invalid TLS certificates (dangerous) steamguard --danger-accept-invalid-certs confirm ``` -------------------------------- ### JavaScript Initialization for Steam Mobile Confirmations Source: https://github.com/dyc3/steamguard-cli/blob/master/steamguard/src/fixtures/confirmations/multiple-confirmations.html This script initializes Google Analytics tracking, preserves built-in prototypes, sets up jQuery and JSON polyfill if needed, defines global variables like session ID and Steam ID, and initializes UI components such as tooltips, miniprofile hovers, emoticon hovers, adult content preferences, and economy hovers. It depends on jQuery and external Steam static resources; inputs are page context and user session, outputs include redirected mobile app title and enhanced UI interactions. Limitations include reliance on external CDNs and potential issues with JSON support in older browsers. ```javascript (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-33779068-1', 'auto', { 'sampleRate': 0.4 }); ga('set', 'dimension1', true ); ga('set', 'dimension2', 'Steam Mobile App' ); ga('set', 'dimension3', 'mobileconf' ); ga('set', 'dimension4', "mobileconf/conf" ); ga('send', 'pageview' ); var __PrototypePreserve=[]; __PrototypePreserve[0] = Array.from; __PrototypePreserve[1] = Function.prototype.bind; Array.from = __PrototypePreserve[0] || Array.from; Function.prototype.bind = __PrototypePreserve[1] || Function.prototype.bind; Object.seal && [ Object, Array, String, Number ].map( function( builtin ) { Object.seal( builtin.prototype ); } ); $J = jQuery.noConflict(); if ( typeof JSON != 'object' || !JSON.stringify || !JSON.parse ) { document.write( "\n" ); }; VALVE_PUBLIC_PATH = "https://community.cloudflare.steamstatic.com/public/"; document.addEventListener('DOMContentLoaded', function(event) { SetupTooltips( { tooltipCSSClass: 'community_tooltip'} ); }); $J(function() { window.location="steammobile://settitle?title=Confirmations"; }); g_sessionID = "1234"; g_steamID = "76561198054667933"; g_strLanguage = "english"; g_SNR = '2_mobileconf_conf_'; g_bAllowAppImpressions = true; g_CommunityPreferences = {"hide_adult_content_violence":1,"hide_adult_content_sex":1,"parenthesize_nicknames":0,"text_filter_setting":1,"text_filter_ignore_friends":1,"text_filter_words_revision":0,"timestamp_updated":0}; setTimezoneCookies(); $J( function() { InitMiniprofileHovers(); InitEmoticonHovers(); ApplyAdultContentPreferences(); }); $J( function() { InitEconomyHovers( "https://community.cloudflare.steamstatic.com/public/css/skin_1/economy.css?v=wliPEsKn4dhI&l=english&_cdn=cloudflare", "https://community.cloudflare.steamstatic.com/public/javascript/economy_common.js?v=tsXdRVB0yEaR&l=english&_cdn=cloudflare", "https://community.cloudflare.steamstatic.com/public/javascript/economy.js?v=n3ZFab2IK68b&l=english&_cdn=cloudflare" );}); ``` -------------------------------- ### Initialize UI Hover Effects Source: https://github.com/dyc3/steamguard-cli/blob/master/steamguard/src/fixtures/confirmations/email-change.html Initializes various UI hover effects using jQuery. This includes setting up tooltips for user profiles (miniprofiles), emoticons, and applying adult content preferences to elements on the page. ```javascript $J(function () { InitMiniprofileHovers(('https%3A%2F%2Fsteamcommunity.com')); InitEmoticonHovers(); ApplyAdultContentPreferences(); }); ``` -------------------------------- ### Confirm Trade and Market Transactions (CLI) Source: https://context7.com/dyc3/steamguard-cli/llms.txt Manages Steam mobile confirmations for trades and market listings via the command line. Supports interactive selection, bulk acceptance, and specifying accounts. No direct code output, but performs actions on Steam. ```bash # Interactive menu to accept/deny confirmations steamguard confirm # Accept all pending confirmations automatically steamguard confirm --accept-all # Specify account with username steamguard -u myusername confirm # Process all accounts steamguard --all confirm --accept-all ``` -------------------------------- ### Initialize Economy Hover Effects Source: https://github.com/dyc3/steamguard-cli/blob/master/steamguard/src/fixtures/confirmations/email-change.html Loads and initializes specific JavaScript and CSS for Steam's economy features. This enables hover effects and functionality related to items within the Steam economy, such as tooltips and data loading. ```javascript $J(function () { InitEconomyHovers("https:\/\/community.akamai.steamstatic.com\/public\/css\/skin_1\/economy.css?v=W1lpCYkssBMO&l=english", "https:\/\/community.akamai.steamstatic.com\/public\/javascript\/economy_common.js?v=tsXdRVB0yEaR&l=english", "https:\/\/community.akamai.steamstatic.com\/public\/javascript\/economy.js?v=zBu5E2N7nc-G&l=english"); }); ``` -------------------------------- ### Import Steam Authenticators (Bash) Source: https://context7.com/dyc3/steamguard-cli/llms.txt Imports Steam authenticator files (maFiles) into the SteamGuard CLI. Supports importing single or multiple accounts. The imported accounts are merged into the existing manifest. ```bash # Import single account steamguard import --files ./account.maFile # Import multiple accounts steamguard import --files ./account1.maFile ./account2.maFile ./account3.maFile # The accounts are merged into the existing manifest ``` -------------------------------- ### Initialize Google Analytics Source: https://github.com/dyc3/steamguard-cli/blob/master/steamguard/src/fixtures/confirmations/email-change.html Initializes Google Analytics tracking for the Steam Community page. It sets up the GA object, sends a pageview event, and configures various custom dimensions related to the user's session and device. ```javascript function (i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); ga('create', 'UA-33779068-1', 'auto', { 'sampleRate': 0.4 }); ga('set', 'dimension1', true); ga('set', 'dimension2', 'Steam Mobile App'); ga('set', 'dimension3', 'mobileconf'); ga('set', 'dimension4', "mobileconf\/conf"); ga('send', 'pageview'); ``` -------------------------------- ### Generate QR Codes for 2FA Export (Bash) Source: https://context7.com/dyc3/steamguard-cli/llms.txt Generates QR codes for 2FA secrets, allowing export to password managers or other TOTP applications. Supports Unicode and ASCII rendering directly in the terminal. Options to specify a user or generate for all accounts are available. ```bash # Generate QR code for first account (Unicode rendering) steamguard qr # Generate for specific account steamguard -u myusername qr # Use ASCII characters for compatibility steamguard qr --ascii # Generate for all accounts steamguard --all qr ``` -------------------------------- ### Global Variables and Preferences Initialization Source: https://github.com/dyc3/steamguard-cli/blob/master/steamguard/src/fixtures/confirmations/phone-number-change.html This snippet declares global variables for session ID, Steam ID, language, and other configuration parameters. It also initializes community preferences and calls functions to set timezone cookies and apply adult content preferences. ```javascript g_sessionID = "1234"; g_steamID = "76561199155706892"; g_strLanguage = "english"; g_SNR = '2_mobileconf_conf_'; g_bAllowAppImpressions = true g_CommunityPreferences = {"hide_adult_content_violence":1,"hide_adult_content_sex":1,"parenthesize_nicknames":0,"text_filter_setting":1,"text_filter_ignore_friends":1,"text_filter_words_revision":0,"timestamp_updated":0}; // We always want to have the timezone cookie set for PHP to use setTimezoneCookies(); $J( function() { InitMiniprofileHovers(); InitEmoticonHovers(); ApplyAdultContentPreferences(); }); ``` -------------------------------- ### Confirm Trade and Market Transactions (Rust) Source: https://context7.com/dyc3/steamguard-cli/llms.txt Fetches and processes Steam mobile confirmations programmatically using Rust. It allows viewing confirmation details and accepting them in bulk. Requires an account file and a web transport client. Outputs confirmation details and success/error messages. ```rust use steamguard::{Confirmer, Confirmation, SteamGuardAccount}; use steamguard::transport::WebApiTransport; use std::sync::{Arc, Mutex}; let transport = WebApiTransport::new(reqwest::blocking::Client::new()); let account = Arc::new(Mutex::new( SteamGuardAccount::from_file("account.maFile").unwrap() )); let account_guard = account.lock().unwrap(); let confirmer = Confirmer::new(transport, &account_guard); // Fetch pending confirmations match confirmer.get_confirmations() { Ok(confirmations) => { for conf in &confirmations { println!("Confirmation: {}", conf.description()); println!("Type: {:?}", conf.conf_type()); } // Accept all confirmations confirmer.accept_confirmations_bulk(&confirmations) .expect("Failed to accept confirmations"); }, Err(e) => eprintln!("Error fetching confirmations: {}", e), } ``` -------------------------------- ### Manage Steam Accounts with Encryption (Rust) Source: https://context7.com/dyc3/steamguard-cli/llms.txt Manages multiple Steam accounts using encrypted storage with Argon2 key derivation and AES-256-CBC encryption. It supports system keyring integration for secure passkey storage. New manifests can be created or existing ones loaded. ```rust use steamguard_cli::{AccountManager, EncryptionScheme}; use secrecy::SecretString; use std::path::Path; // Create new manifest let manifest_path = Path::new("maFiles/manifest.json"); let mut manager = AccountManager::new(manifest_path); // Submit encryption passkey let passkey = SecretString::new("my_secure_passkey".to_string()); manager.submit_passkey(Some(passkey)); // Load or create account let account = manager.get_or_load_account("username") .expect("Failed to load account"); // Save encrypted manifest manager.save().expect("Failed to save manifest"); // Load existing manifest let mut manager = AccountManager::load(manifest_path) .expect("Failed to load manifest"); ``` -------------------------------- ### Render 2FA QR Codes from SteamGuard Account (Rust) Source: https://context7.com/dyc3/steamguard-cli/llms.txt Generates QR codes from SteamGuard account URIs, which can then be rendered in the terminal using Unicode or ASCII characters. This is useful for exporting 2FA secrets to compatible applications. It relies on the `qrcode` crate for rendering. ```rust use steamguard::SteamGuardAccount; use qrcode::QrCode; use secrecy::ExposeSecret; let account = SteamGuardAccount::from_file("account.maFile") .expect("Failed to load account"); // Generate QR code from URI let qr = QrCode::new(account.uri.expose_secret()) .expect("Failed to generate QR code"); // Render as Unicode use qrcode::render::unicode; let qr_string = qr.render::() .dark_color(unicode::Dense1x2::Light) .light_color(unicode::Dense1x2::Dark) .build(); println!("{}", qr_string); // Or render as ASCII let qr_ascii = qr.render() .light_color(' ') .dark_color('#') .module_dimensions(2, 1) .build(); println!("{}", qr_ascii); ``` -------------------------------- ### Google Analytics Initialization and Pageview Source: https://github.com/dyc3/steamguard-cli/blob/master/steamguard/src/fixtures/confirmations/phone-number-change.html This snippet initializes Google Analytics with a specific tracking ID and sends a pageview event. It also sets custom dimensions for 'sampleRate', 'dimension1', 'dimension2', 'dimension3', and 'dimension4'. ```javascript (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-33779068-1', 'auto', { 'sampleRate': 0.4 }); ga('set', 'dimension1', true ); ga('set', 'dimension2', 'Steam Mobile App' ); ga('set', 'dimension3', 'mobileconf' ); ga('set', 'dimension4', "mobileconf\/conf" ); ga('send', 'pageview' ); ``` -------------------------------- ### Load SteamGuard Account from File or Reader (Rust) Source: https://context7.com/dyc3/steamguard-cli/llms.txt Loads SteamGuard account information from a file path or a buffered reader. This functionality is useful for integrating existing authenticator data into a Rust application. It expects the maFile to be in a compatible format. ```rust use steamguard::SteamGuardAccount; use std::fs::File; use std::io::BufReader; // Load from file path let account = SteamGuardAccount::from_file("gaben.maFile") .expect("Failed to load account"); // Or from reader let file = File::open("account.maFile").expect("File not found"); let reader = BufReader::new(file); let account = SteamGuardAccount::from_reader(reader) .expect("Failed to parse account"); println!("Account: {}", account.account_name); println!("Steam ID: {}", account.steam_id); ``` -------------------------------- ### JSON Handling and Fallback Script Source: https://github.com/dyc3/steamguard-cli/blob/master/steamguard/src/fixtures/confirmations/phone-number-change.html This code checks if the browser's JSON object is available and has stringify/parse methods. If not, it dynamically writes a script tag to load 'json2.js' for JSON support. ```javascript if ( typeof JSON != 'object' || !JSON.stringify || !JSON.parse ) { document.write( "<\/script>\n" ); }; ``` -------------------------------- ### Authenticate User with Steam and Manage JWT Tokens Source: https://context7.com/dyc3/steamguard-cli/llms.txt Authenticate with Steam API using credentials and manage JWT access/refresh tokens. Handles device details, guard codes, and session polling. Requires 2FA code if account has Steam Guard enabled. Dependencies include steamguard, transport, and secrecy crates. The authentication process involves credential submission, optional 2FA code, and polling until completion. ```rust use steamguard::{UserLogin, DeviceDetails, Tokens}; use steamguard::transport::WebApiTransport; use secrecy::SecretString; let transport = WebApiTransport::new(reqwest::blocking::Client::new()); // Create login session let device_details = DeviceDetails { device_friendly_name: "My Device".to_string(), platform_type: steamguard::userlogin::EAuthTokenPlatformType::MobileApp, ..Default::default() }; let mut login = UserLogin::new( transport, device_details, "username".to_string(), SecretString::new("password".to_string()) ); // Begin authentication login.begin_auth_via_credentials() .expect("Failed to begin auth"); // Submit 2FA code if required if login.needs_two_factor() { login.submit_steam_guard_code("ABCD5".to_string()) .expect("Failed to submit code"); } // Poll until login completes loop { match login.poll() { Ok(tokens) => { println!("Login successful!"); // Use tokens for API calls break; }, Err(e) if e.to_string().contains("pending") => { std::thread::sleep(std::time::Duration::from_secs(1)); continue; }, Err(e) => { eprintln!("Login failed: {}", e); break; } } } ``` -------------------------------- ### JSON Polyfill for Older Browsers Source: https://github.com/dyc3/steamguard-cli/blob/master/steamguard/src/fixtures/confirmations/email-change.html Checks if the browser supports native JSON parsing and stringification. If not, it dynamically loads a 'json2.js' script to provide this functionality, ensuring compatibility with older browsers. ```javascript if (typeof JSON != 'object' || !JSON.stringify || !JSON.parse) { document.write("<\/script>\n"); }; ``` -------------------------------- ### Generate Steam 2FA Codes (Rust) Source: https://context7.com/dyc3/steamguard-cli/llms.txt Generates a 5-character time-based one-time password (TOTP) for Steam authentication using an account's shared secret. Requires loading an account from a maFile and using the current server time for accuracy. Output is a string. ```rust use steamguard::{SteamGuardAccount, steamapi}; use std::time::{SystemTime, UNIX_EPOCH}; // Load account from maFile let account = SteamGuardAccount::from_file("path/to/account.maFile") .expect("Failed to load account"); // Get current server time (recommended) or use local time let server_time = SystemTime::now() .duration_since(UNIX_EPOCH) .expect("Time error") .as_secs(); // Generate 5-character 2FA code let code = account.generate_code(server_time); println!("2FA Code: {}", code); // Output: "2F9J5" ``` -------------------------------- ### Preserve and Restore Array/Function Methods Source: https://github.com/dyc3/steamguard-cli/blob/master/steamguard/src/fixtures/confirmations/email-change.html This script preserves and then restores specific built-in JavaScript Array and Function prototype methods. This is often done to prevent other scripts from modifying these core methods, ensuring consistent behavior. ```javascript var __PrototypePreserve = []; __PrototypePreserve[0] = Array.from; __PrototypePreserve[1] = Array.prototype.filter; __PrototypePreserve[2] = Array.prototype.flatMap; __PrototypePreserve[3] = Array.prototype.find; __PrototypePreserve[4] = Array.prototype.some; __PrototypePreserve[5] = Function.prototype.bind; __PrototypePreserve[6] = HTMLElement.prototype.scrollTo; Array.from = __PrototypePreserve[0] || Array.from; Array.prototype.filter = __PrototypePreserve[1] || Array.prototype.filter; Array.prototype.flatMap = __PrototypePreserve[2] || Array.prototype.flatMap; Array.prototype.find = __PrototypePreserve[3] || Array.prototype.find; Array.prototype.some = __PrototypePreserve[4] || Array.prototype.some; Function.prototype.bind = __PrototypePreserve[5] || Function.prototype.bind; HTMLElement.prototype.scrollTo = __PrototypePreserve[6] || HTMLElement.prototype.scrollTo; ``` -------------------------------- ### Redirect to Mobile App Title View Source: https://github.com/dyc3/steamguard-cli/blob/master/steamguard/src/fixtures/confirmations/email-change.html When the DOM is ready, this script redirects the window to a specific Steam mobile app URI. This is used to set the title of the mobile application's view to 'Confirmations'. ```javascript $J(function () { window.location = "steammobile:\/\/settitle?title=Confirmations"; }); ``` -------------------------------- ### Perform Two-Factor Secret Operations (Rust) Source: https://context7.com/dyc3/steamguard-cli/llms.txt Handles core cryptographic operations for generating time-based one-time passwords (TOTP) using HMAC-SHA1. It supports parsing base64-encoded shared secrets and generating codes for specific timestamps or the current time. Secure memory handling with zeroization is implemented. ```rust use steamguard::token::TwoFactorSecret; // Parse base64-encoded shared secret let secret = TwoFactorSecret::parse_shared_secret( "zvIayp3JPvtvX/QGHqsqKBk/44s=".to_string() ).expect("Invalid secret"); // Generate code for specific timestamp (Unix time) let timestamp: u64 = 1616374841; let code = secret.generate_code(timestamp); assert_eq!(code, "2F9J5"); // Generate current code use std::time::{SystemTime, UNIX_EPOCH}; let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs(); let current_code = secret.generate_code(now); println!("Current code: {}", current_code); // Access raw bytes (use with caution) use secrecy::ExposeSecret; let bytes: &[u8; 20] = secret.expose_secret(); ``` -------------------------------- ### Remove Steam Guard Authenticator from Account Source: https://context7.com/dyc3/steamguard-cli/llms.txt Remove Steam Guard authenticator using revocation code with option to specify code explicitly. Imposes 15-day trade restriction but allows re-linking. Requires valid account.maFile and successful transport connection. The operation removes authenticator and provides confirmation, with the revocation code stored in the account file. ```rust use steamguard::{SteamGuardAccount, AccountLinker}; use steamguard::transport::WebApiTransport; use secrecy::ExposeSecret; let account = SteamGuardAccount::from_file("account.maFile") .expect("Failed to load account"); let transport = WebApiTransport::new(reqwest::blocking::Client::new()); // Remove authenticator using revocation code stored in account match account.remove_authenticator(transport, None) { Ok(_) => println!("Authenticator removed successfully"), Err(e) => eprintln!("Failed to remove authenticator: {}", e), } // Or specify revocation code explicitly let revocation_code = "R12345".to_string(); match account.remove_authenticator(transport, Some(&revocation_code)) { Ok(_) => println!("Authenticator removed"), Err(e) => eprintln!("Error: {}", e), } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.