pub struct AppSpecific<S: Source> { /* private fields */ }Expand description
Wrapper source that HMACs the inner source’s probe value with a
caller-supplied app_id, emitting a UUID-shaped probe.
§Example
use host_identity::sources::{AppSpecific, MachineIdFile};
use host_identity::{Resolver, Source};
let wrapped = AppSpecific::new(
MachineIdFile::default(),
b"com.example.telemetry".to_vec(),
);
let id = Resolver::new().push(wrapped).resolve()?;Implementations§
Source§impl<S: Source> AppSpecific<S>
impl<S: Source> AppSpecific<S>
Sourcepub fn new(inner: S, app_id: impl Into<Vec<u8>>) -> Self
pub fn new(inner: S, app_id: impl Into<Vec<u8>>) -> Self
Wrap inner so its probe value is derived with app_id.
app_id is not secret — privacy comes from not leaking the
inner source’s raw value, not from app_id secrecy. Pick a
stable byte string that identifies your application (reverse
DNS, a random UUID, a git SHA — whichever is convenient and
stable across your deployment).
§Label interning
The composed provenance label app-specific:<inner-id> is
interned in a process-global map keyed on the inner source’s
&'static str identifier, so memory consumption is bounded by
the number of distinct inner source kinds ever wrapped —
not the number of AppSpecific::new calls. Interned strings
are leaked for the program’s lifetime to satisfy the
SourceKind::Custom(&'static str) contract.