Skip to main content

Crate iroh_tickets

Crate iroh_tickets 

Source
Expand description

§iroh-tickets

Documentation Crates.io downloads Chat License: MIT License: Apache 2.0 CI

Simple ticket system used for signaling with iroh.

A ticket bundles the information needed to reach an iroh endpoint into a single serializable value. Tickets are expected to round-trip to and from their canonical string form (lowercase kind prefix + base32) as well as to and from their byte form, via the Ticket trait.

§Example

use std::str::FromStr;

use iroh_base::{EndpointAddr, PublicKey, TransportAddr};
use iroh_tickets::{Ticket, endpoint::EndpointTicket};

let pk = PublicKey::from_str(
    "ae58ff8833241ac82d6ff7611046ed67b5072d142c588d0063e942d9a75502b6",
)
.unwrap();
let addr = EndpointAddr::from_parts(
    pk,
    [TransportAddr::Ip("127.0.0.1:1234".parse().unwrap())],
);
let ticket = EndpointTicket::new(addr);

// Encode to the canonical string form (lowercase KIND prefix + base32).
let encoded = ticket.encode_string();
assert!(encoded.starts_with("endpoint"));

// Decode back via `FromStr` (which delegates to `Ticket::decode_string`).
let decoded: EndpointTicket = encoded.parse().unwrap();
assert_eq!(ticket, decoded);

§License

Copyright 2026 N0, INC.

This project is licensed under either of

at your option.

§Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Modules§

endpoint
Tickets for endpoints.

Enums§

ParseError
An error deserializing an iroh ticket.

Traits§

Ticket
A ticket is a serializable object combining information required for an operation.