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 moreSource§impl Debug for InstallPresence
impl Debug for InstallPresence
Source§impl<'de> Deserialize<'de> for InstallPresence
impl<'de> Deserialize<'de> for InstallPresence
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for InstallPresence
Source§impl PartialEq for InstallPresence
impl PartialEq for InstallPresence
Source§impl Serialize for InstallPresence
impl Serialize for InstallPresence
impl StructuralPartialEq for InstallPresence
Auto Trait Implementations§
impl Freeze for InstallPresence
impl RefUnwindSafe for InstallPresence
impl Send for InstallPresence
impl Sync for InstallPresence
impl Unpin for InstallPresence
impl UnsafeUnpin for InstallPresence
impl UnwindSafe for InstallPresence
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more