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: u32Format version. 1, and a verifier refuses anything else rather than
guessing at a field it does not know.
issuer: StringWhich 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: StringThe 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: StringThe tenant the bearer may act for. On gunnar this is the namespace, which is the principal’s own id.
purpose: StringThe 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: StringSingle-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: StringBase64, standard alphabet, padded. Not part of ticket_message.
Implementations§
Source§impl ActorTicket
impl ActorTicket
Sourcepub 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
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.
Trait Implementations§
Source§impl Clone for ActorTicket
impl Clone for ActorTicket
Source§fn clone(&self) -> ActorTicket
fn clone(&self) -> ActorTicket
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more