diff --git a/src/accountmanager.rs b/src/accountmanager.rs index 3f644b1..278f0fd 100644 --- a/src/accountmanager.rs +++ b/src/accountmanager.rs @@ -641,4 +641,31 @@ mod tests { ); Ok(()) } + + #[test] + fn test_sda_compatibility_2() -> anyhow::Result<()> { + let path = Path::new("src/fixtures/maFiles/compat/2-account/manifest.json"); + assert!(path.is_file()); + let mut manifest = Manifest::load(path)?; + assert!(matches!(manifest.entries.last().unwrap().encryption, None)); + manifest.load_accounts()?; + let account_name = manifest.entries[0].account_name.clone(); + let account = manifest.get_account(&account_name)?; + assert_eq!(account_name, account.lock().unwrap().account_name); + assert_eq!(account.lock().unwrap().revocation_code, "R12345"); + assert_eq!( + account.lock().unwrap().session.as_ref().unwrap().steam_id, + 1234 + ); + + let account_name = manifest.entries[1].account_name.clone(); + let account = manifest.get_account(&account_name)?; + assert_eq!(account_name, account.lock().unwrap().account_name); + assert_eq!(account.lock().unwrap().revocation_code, "R56789"); + assert_eq!( + account.lock().unwrap().session.as_ref().unwrap().steam_id, + 5678 + ); + Ok(()) + } } diff --git a/src/fixtures/maFiles/compat/2-account/1234.maFile b/src/fixtures/maFiles/compat/2-account/1234.maFile new file mode 100644 index 0000000..344ac66 --- /dev/null +++ b/src/fixtures/maFiles/compat/2-account/1234.maFile @@ -0,0 +1 @@ +{"shared_secret":"zvIayp3JPvtvX/QGHqsqKBk/44s=","serial_number":"kljasfhds","revocation_code":"R12345","uri":"otpauth://totp/Steam:example?secret=ASDF&issuer=Steam","server_time":1602522478,"account_name":"example","token_gid":"jkkjlhkhjgf","identity_secret":"kjsdlwowiqe=","secret_1":"sklduhfgsdlkjhf=","status":1,"device_id":"android:99d2ad0e-4bad-4247-b111-26393aae0be3","fully_enrolled":true,"Session":{"SessionID":"a;lskdjf","SteamLogin":"983498437543","SteamLoginSecure":"dlkjdsl;j%7C%32984730298","WebCookie":";lkjsed;klfjas98093","OAuthToken":"asdk;lf;dsjlkfd","SteamID":1234}} \ No newline at end of file diff --git a/src/fixtures/maFiles/compat/2-account/5678.maFile b/src/fixtures/maFiles/compat/2-account/5678.maFile new file mode 100644 index 0000000..8ffc4c8 --- /dev/null +++ b/src/fixtures/maFiles/compat/2-account/5678.maFile @@ -0,0 +1 @@ +{"shared_secret":"zvIayp3JPvtvX/QGHqsqKBk/44s=","serial_number":"kljasfhds","revocation_code":"R56789","uri":"otpauth://totp/Steam:example?secret=ASDF&issuer=Steam","server_time":1602522478,"account_name":"example2","token_gid":"jkkjlhkhjgf","identity_secret":"kjsdlwowiqe=","secret_1":"sklduhfgsdlkjhf=","status":1,"device_id":"android:99d2ad0e-4bad-4247-b111-26393aae0be3","fully_enrolled":true,"Session":{"SessionID":"a;lskdjf","SteamLogin":"983498437543","SteamLoginSecure":"dlkjdsl;j%7C%32984730298","WebCookie":";lkjsed;klfjas98093","OAuthToken":"asdk;lf;dsjlkfd","SteamID":5678}} \ No newline at end of file diff --git a/src/fixtures/maFiles/compat/2-account/manifest.json b/src/fixtures/maFiles/compat/2-account/manifest.json new file mode 100644 index 0000000..7aba942 --- /dev/null +++ b/src/fixtures/maFiles/compat/2-account/manifest.json @@ -0,0 +1 @@ +{"encrypted":false,"first_run":true,"entries":[{"encryption_iv":null,"encryption_salt":null,"filename":"1234.maFile","steamid":1234}, {"encryption_iv":null,"encryption_salt":null,"filename":"5678.maFile","steamid":5678}],"periodic_checking":false,"periodic_checking_interval":5,"periodic_checking_checkall":false,"auto_confirm_market_transactions":false,"auto_confirm_trades":false} \ No newline at end of file