Skip to main content

NameRecord

Struct NameRecord 

Source
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: String

The launch’s agent token: a bearer credential for the VM.

§region: String§at: u64

Seconds 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

Source

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.

Source

pub fn to_json(&self) -> Value

The record as JSON, secrets included — the form to store privately.

Source

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.

Source

pub fn from_json(value: Value) -> Result<NameRecord, Error>

A record from its JSON form, checked the way NameRecord::new_at checks.

Source

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.

Source

pub fn set_tunnel_identity(&mut self, identity: Option<&TunnelIdentity>)

Records identity’s pair, or clears it.

Source

pub fn region(&self) -> Region

The region the VM runs in, as this client wrote it into the record.

Trait Implementations§

Source§

impl Clone for NameRecord

Source§

fn clone(&self) -> NameRecord

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for NameRecord

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<NameRecord, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl NameRecordExt for NameRecord

Source§

fn new( name: impl Into<String>, microvm_id: impl Into<String>, endpoint: impl Into<String>, agent_token: impl Into<String>, region: impl Into<String>, ) -> Result<Self, Error>

A record for a VM this process can already address, stamped with the current time. Read more
Source§

impl PartialEq for NameRecord

Source§

fn eq(&self, other: &NameRecord) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for NameRecord

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for NameRecord

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more