pub struct ConnectionToken(String);Expand description
A 128-bit connection token, rendered as 32 lowercase hex chars.
Tuple Fields§
§0: StringImplementations§
Source§impl ConnectionToken
impl ConnectionToken
Sourcepub fn generate() -> Self
pub fn generate() -> Self
Generate a fresh random 128-bit token (UUID v4 supplies 122 bits of randomness — ample for a transient boot gate; rendered as its 32 hex digits without dashes).
pub fn as_str(&self) -> &str
Sourcepub fn verify(&self, candidate: &str) -> bool
pub fn verify(&self, candidate: &str) -> bool
Constant-time comparison against a candidate. Length mismatch fails immediately (lengths are not secret); equal-length inputs are compared with no early exit so timing does not leak how many leading chars matched.
Sourcepub fn write_to_file(&self, path: &Path) -> Result<()>
pub fn write_to_file(&self, path: &Path) -> Result<()>
Write the token to path as its raw hex string (no trailing newline), restricting the file
to the current user. On Unix this is a real 0600; on Windows set_permissions cannot
express 0600, so the caller (boot.rs) owner-locks the per-boot dir via
ghidra_ipc::owner_only::restrict_to_owner before writing, and deletes the dir immediately
after the handshake.
Trait Implementations§
Source§impl Clone for ConnectionToken
impl Clone for ConnectionToken
Source§fn clone(&self) -> ConnectionToken
fn clone(&self) -> ConnectionToken
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more