Rust implementation of Apple's Hide my email service
- Apple ID
- iCloud+ Subscription
cargo add hide_my_email
- Login to iCloud
- Open the Dot Menu (top right, next to your photo)
- Click "Hide My Email" under iCloud+ Features
- Open your browsers developer tools (F12, or right-click on the page and click "Inspect")
- Navigate to the Network tab on developer tools and ensure it is recording (enabling Preserve Log may help).
- Refresh the website
- In the Network tab, filter the request for "validate", should only be 1, if multiple, use the last request (most recent)
- Scroll/Navigate to Request Headers section/tab
- Copy the value for the Cookie header
use std::env;
use hide_my_email::{Cookie, HideMyEmailManager, ICloudClient};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// eg, key1=value1; key2=\"value2\";
let cookies = env::var("COOKIE").unwrap();
let cookies = Cookie::from_str(&cookies).unwrap();
let mut icloud = ICloudClient::new(&cookies);
let _ = icloud.validate().await?;
let manager = HideMyEmailManager::from(icloud);
let email = manager.generate().await?;
let _ = manager.claim(&email, "RustLang", "").await?;
// OR
let email = manager.generate_and_claim("RustLang", "").await?;
Ok(())
}
Add authentication support via Username/Password + 2FA instead of cookies