pub struct NameRecord {
pub name: String,
pub microvm_id: String,
pub endpoint: String,
pub agent_token: String,
pub region: String,
pub at: u64,
pub identity_host_seed: Option<String>,
pub identity_vm_public_key: Option<String>,
pub egress_posture: Option<String>,
}Expand description
One kept VM’s name, and everything an adopt needs to address it.
camelCase on the wire: this is the CLI registry’s on-disk format, read by later
versions, so fields are only ever added, and optional ones default when absent.
Fields§
§name: String§microvm_id: String§endpoint: String§agent_token: StringThe launch’s agent token: a bearer credential for the VM.
region: String§at: u64Seconds since the epoch when the name was registered.
identity_host_seed: Option<String>The launching host’s identity secret, base64, when run --identity generated one.
Persisted for the reason the agent token is: a later tunnel --verify-identity
needs it. It raises what a stolen record can do from “call the VM” to “call the VM
and impersonate the launching host to it”, which is the same trust domain.
identity_vm_public_key: Option<String>The VM’s public key, base64 — the pin --verify-identity checks the far end against.
egress_posture: Option<String>The egress posture label of the launch this name was registered for, when the
registering command launched the VM. None means unknown, never “open”.
Implementations§
Source§impl NameRecord
impl NameRecord
Sourcepub fn new_at(
name: impl Into<String>,
microvm_id: impl Into<String>,
endpoint: impl Into<String>,
agent_token: impl Into<String>,
region: impl Into<String>,
at: u64,
) -> Result<NameRecord, Error>
pub fn new_at( name: impl Into<String>, microvm_id: impl Into<String>, endpoint: impl Into<String>, agent_token: impl Into<String>, region: impl Into<String>, at: u64, ) -> Result<NameRecord, Error>
A record for a VM this process can already address, registered at seconds after the
Unix epoch.
Refuses an illegal name or an empty id, endpoint, or token: a record missing any of
them resolves to a VM nobody can adopt. The time is the caller’s, since this crate
doesn’t read the clock (ARCH-6); microvms_core::prelude::NameRecordExt::new stamps
the current time.
Sourcepub fn to_json(&self) -> Value
pub fn to_json(&self) -> Value
The record as JSON, secrets included — the form to store privately.
Sourcepub fn redacted_json(&self) -> Value
pub fn redacted_json(&self) -> Value
The record as JSON without its two secrets, the agent token and the identity host
seed: the form a listing prints, redacted as Debug redacts.
Built from the fields it keeps rather than by removing the secrets from
NameRecord::to_json, so a field added to the record stays out of every listing until
someone decides it can be shown.
Sourcepub fn from_json(value: Value) -> Result<NameRecord, Error>
pub fn from_json(value: Value) -> Result<NameRecord, Error>
A record from its JSON form, checked the way NameRecord::new_at checks.
Sourcepub fn tunnel_identity(&self) -> Result<Option<TunnelIdentity>, Error>
pub fn tunnel_identity(&self) -> Result<Option<TunnelIdentity>, Error>
The record’s tunnel identity, when it carries one.
Refuses a record holding one half of the pair, or a half that doesn’t decode, rather than reading it as unverifiable: the record claims a verifiable VM, and dropping the claim would hide that it’s broken.
Sourcepub fn set_tunnel_identity(&mut self, identity: Option<&TunnelIdentity>)
pub fn set_tunnel_identity(&mut self, identity: Option<&TunnelIdentity>)
Records identity’s pair, or clears it.
Trait Implementations§
Source§impl Clone for NameRecord
impl Clone for NameRecord
Source§fn clone(&self) -> NameRecord
fn clone(&self) -> NameRecord
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 NameRecord
Redacts the agent token and the identity seed: this type reaches logs through errors
and test output, and both values are credentials.
impl Debug for NameRecord
Redacts the agent token and the identity seed: this type reaches logs through errors and test output, and both values are credentials.