Download crates/forge_tracker/src/client_id/generic.rs from SaylorTwift/forgecode: direct link, hf CLI and curl.
- Browser
- Download file 513 Bytes
-
https://huggingface.co/SaylorTwift/forgecode/resolve/main/crates/forge_tracker/src/client_id/generic.rs
- Command line
-
hf download hf://SaylorTwift/forgecode/crates/forge_tracker/src/client_id/generic.rs
-
curl -L -o generic.rs https://huggingface.co/SaylorTwift/forgecode/resolve/main/crates/forge_tracker/src/client_id/generic.rs
513 Bytes
| use machineid_rs::{Encryption, HWIDComponent, IdBuilder}; | |
| const PARAPHRASE: &str = "forge_key"; | |
| /// Gets or creates a persistent client ID for non-Android platforms | |
| pub fn get_or_create_client_id() -> anyhow::Result<String> { | |
| let mut builder = IdBuilder::new(Encryption::SHA256); | |
| builder | |
| .add_component(HWIDComponent::SystemID) | |
| .add_component(HWIDComponent::CPUCores); | |
| builder | |
| .build(PARAPHRASE) | |
| .map_err(|e| anyhow::anyhow!("Failed to generate machine ID: {e}")) | |
| } | |