Skip to main content

ActorTicket

Struct ActorTicket 

Source
pub struct ActorTicket {
    pub v: u32,
    pub issuer: String,
    pub product: String,
    pub tenant: String,
    pub purpose: String,
    pub caps: BTreeMap<String, u64>,
    pub nonce: String,
    pub issued_unix_ms: i64,
    pub expires_unix_ms: i64,
    pub signature: String,
}
Expand description

The appliance’s word that one principal may act for one tenant.

Fields§

§v: u32

Format version. 1, and a verifier refuses anything else rather than guessing at a field it does not know.

§issuer: String

Which appliance minted it, as a product id (gunnar). Decorative for a verifier that holds one key — the key IS the issuer — and load-bearing the day a monetize holds two.

§product: String

The product this ticket may be spent on, as ProductInfo.id. Checked against the order, so a ticket from one product’s appliance cannot buy another product’s period.

§tenant: String

The tenant the bearer may act for. On gunnar this is the namespace, which is the principal’s own id.

§purpose: String

The one verb this ticket authorises: PURPOSE_RENEW or PURPOSE_ORDER.

§caps: BTreeMap<String, u64>

The caps this ticket covers, for PURPOSE_ORDER — the target caps the order will name, meter by meter.

Empty for PURPOSE_RENEW, and required to be: a renewal names no caps at all (they come off the tenant’s stored fact), so a renewal ticket carrying any is either a client that has confused the two paths or an order wearing a renewal’s word. verify_ticket refuses both.

A BTreeMap because it is serialised into the signed message and the canonical form sorts keys anyway; the ordered map makes the Rust value and the signed bytes agree by construction rather than by the serialiser’s mood.

§nonce: String

Single-use, chosen by the issuer. The verifier keeps a ring and refuses a repeat — see SeenNonces.

§issued_unix_ms: i64§expires_unix_ms: i64§signature: String

Base64, standard alphabet, padded. Not part of ticket_message.

Implementations§

Source§

impl ActorTicket

Source

pub fn unsigned( issuer: impl Into<String>, product: impl Into<String>, tenant: impl Into<String>, purpose: impl Into<String>, nonce: impl Into<String>, issued_unix_ms: i64, life_ms: i64, ) -> ActorTicket

Build an unsigned ticket. The issuer signs ticket_message of it and fills in ActorTicket::signature.

Not a constructor that signs, because this crate holds no key: it is compiled into products, and a product must be able to CHECK a ticket without being able to MINT one. That asymmetry is the same one crate::signing has for facts, and it is deliberate.

Source

pub fn covering(self, caps: BTreeMap<String, u64>) -> ActorTicket

The caps this order ticket covers. Builder rather than an eighth positional argument, because every renewal would otherwise pass an empty map at a call site where the emptiness is the whole point and reads as noise.

Trait Implementations§

Source§

impl Clone for ActorTicket

Source§

fn clone(&self) -> ActorTicket

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 ActorTicket

Source§

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

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

impl<'de> Deserialize<'de> for ActorTicket

Source§

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

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

impl Eq for ActorTicket

Source§

impl PartialEq for ActorTicket

Source§

fn eq(&self, other: &ActorTicket) -> 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 ActorTicket

Source§

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

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

impl StructuralPartialEq for ActorTicket

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.