pub struct InstallPresence {
pub v: u32,
pub instance_id: String,
pub instance_public_key: String,
pub hostname: String,
pub channel: String,
pub os: String,
pub version: String,
pub channels_running: u32,
pub agents: Vec<PresenceAgent>,
pub published_at_ms: u64,
pub gone: bool,
pub sig: String,
}Expand description
The record, in the contract’s field order. Public keys and the signature are standard base64.
Fields§
§v: u32§instance_id: String§instance_public_key: String§hostname: String§channel: String§os: String§version: String§channels_running: u32§agents: Vec<PresenceAgent>§published_at_ms: u64§gone: boolv3 only: the install has gone offline. The desktop sends v3 only as a goodbye, so always with this set; the relay also takes a v3 record without it.
sig: StringImplementations§
Source§impl InstallPresence
impl InstallPresence
Sourcepub fn sign(
instance_private_key: &[u8],
hostname: &str,
channel: &str,
os: &str,
version: &str,
channels_running: u32,
agents: impl IntoIterator<Item = PresenceAgent>,
published_at_ms: u64,
) -> Option<Self>
pub fn sign( instance_private_key: &[u8], hostname: &str, channel: &str, os: &str, version: &str, channels_running: u32, agents: impl IntoIterator<Item = PresenceAgent>, published_at_ms: u64, ) -> Option<Self>
Build and sign a PRESENCE_VERSION record with the instance key.
agents may come in any order and is passed through
canonical_agents; channels_running is clamped to
1..=MAX_CHANNELS_RUNNING. None for a malformed key or a
top-level field out of bounds.
Sourcepub fn sign_version(
v: u32,
instance_private_key: &[u8],
hostname: &str,
channel: &str,
os: &str,
version: &str,
channels_running: u32,
agents: impl IntoIterator<Item = PresenceAgent>,
published_at_ms: u64,
) -> Option<Self>
pub fn sign_version( v: u32, instance_private_key: &[u8], hostname: &str, channel: &str, os: &str, version: &str, channels_running: u32, agents: impl IntoIterator<Item = PresenceAgent>, published_at_ms: u64, ) -> Option<Self>
Self::sign for record version v (1 to 4). A v1 record carries
no states: any given are dropped. A v3 record is the goodbye: gone
is set and the states are dropped too. Lines are dropped below v4,
and in v4 any that don’t fit MAX_PRESENCE_LINE_BYTES, in order.
Sourcepub fn signed_material(&self) -> String
pub fn signed_material(&self) -> String
The UTF-8 string the signature covers: the fields joined by U+0001,
numbers in decimal, the agents joined by U+0003 (empty when there are
none), in the record’s order. In v1 an agent is name U+0002 kind;
in v2 and v3 name U+0002 kind U+0002 state, state empty when
absent; v4 adds U+0002 line, empty when absent. v3 and v4 add one
more field at the end: U+0001 then 1 when gone, nothing otherwise.
Sourcepub fn in_bounds(&self) -> bool
pub fn in_bounds(&self) -> bool
The contract’s bounds, on every field the signature covers. The
agents must already be in canonical order: the order is signed. A v1
record may not carry a state, nor one below v4 a line, which their
signatures would not cover. Only v3 and v4 may be gone, and a gone
record carries no state or line.
Trait Implementations§
Source§impl Clone for InstallPresence
impl Clone for InstallPresence
Source§fn clone(&self) -> InstallPresence
fn clone(&self) -> InstallPresence
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more