pub struct Ps(/* private fields */);
Expand description
Handle to the PS service.
Implementations§
source§impl Ps
impl Ps
sourcepub fn local_friend_code_seed(&self) -> Result<u64>
pub fn local_friend_code_seed(&self) -> Result<u64>
Returns the console’s local friend code seed.
§Example
use ctru::services::ps::Ps;
let ps = Ps::new()?;
let friend_code_seed = ps.local_friend_code_seed()?;
sourcepub fn device_id(&self) -> Result<u32>
pub fn device_id(&self) -> Result<u32>
Returns the console’s devide ID.
§Example
use ctru::services::ps::Ps;
let ps = Ps::new()?;
let device_id = ps.device_id()?;
sourcepub fn generate_random_bytes(&self, out: &mut [u8]) -> Result<()>
pub fn generate_random_bytes(&self, out: &mut [u8]) -> Result<()>
Generates cryptografically secure random bytes and writes them into the out
buffer.
§Example
use ctru::services::ps::Ps;
let ps = Ps::new()?;
let mut buffer = vec![0; 128];
// The buffer is now randomized!
ps.generate_random_bytes(&mut buffer)?;