pub struct InvitePayload {
pub version: u64,
pub repo_id: RepoId,
pub peer_actor: ActorId,
pub invite_code: [u8; 16],
pub direct_addr: Option<String>,
pub hub_url: Option<String>,
pub repo_name: Option<String>,
pub capability: Option<String>,
}Expand description
Compact magic-link payload carried inside URL #fragments and never sent to HTTP servers.
Fields§
§version: u64§repo_id: RepoId§peer_actor: ActorId§invite_code: [u8; 16]§direct_addr: Option<String>§hub_url: Option<String>§repo_name: Option<String>§capability: Option<String>Implementations§
Source§impl InvitePayload
impl InvitePayload
Sourcepub fn new(
repo_id: RepoId,
peer_actor: ActorId,
invite_code: [u8; 16],
direct_addr: Option<String>,
hub_url: Option<String>,
repo_name: Option<String>,
capability: Option<String>,
) -> Self
pub fn new( repo_id: RepoId, peer_actor: ActorId, invite_code: [u8; 16], direct_addr: Option<String>, hub_url: Option<String>, repo_name: Option<String>, capability: Option<String>, ) -> Self
Constructs a v1 InvitePayload targeting repo_id hosted by peer_actor.
Sourcepub fn invite_code_hash(code: &[u8; 16]) -> [u8; 32]
pub fn invite_code_hash(code: &[u8; 16]) -> [u8; 32]
Computes SHA-256 of the raw 128-bit invite secret for durable storage.
Sourcepub fn invite_id_hex_for_code(code: &[u8; 16]) -> String
pub fn invite_id_hex_for_code(code: &[u8; 16]) -> String
Derives the non-secret 32-hex invite identifier (hex(sha256(code)[..16])).
Sourcepub fn invite_id_hex(&self) -> String
pub fn invite_id_hex(&self) -> String
Returns this payload’s non-secret invite identifier.
Sourcepub fn encode_cbor(&self) -> Vec<u8> ⓘ
pub fn encode_cbor(&self) -> Vec<u8> ⓘ
Encodes the payload into canonical CDE CBOR bytes.
Sourcepub fn decode_cbor(bytes: &[u8]) -> Result<Self, InviteError>
pub fn decode_cbor(bytes: &[u8]) -> Result<Self, InviteError>
Decodes strict canonical CBOR bytes into InvitePayload.
Sourcepub fn encode_fragment(&self) -> String
pub fn encode_fragment(&self) -> String
Encodes the payload as unpadded RFC 4648 base64url suitable for URL fragments.
Sourcepub fn decode_fragment(fragment: &str) -> Result<Self, InviteError>
pub fn decode_fragment(fragment: &str) -> Result<Self, InviteError>
Decodes a base64url fragment produced by Self::encode_fragment.
Sourcepub fn to_uri(&self) -> String
pub fn to_uri(&self) -> String
Renders a native custom-scheme URI (gitiverse://invite#<fragment>).
Sourcepub fn to_local_web_url(&self, base: &str) -> String
pub fn to_local_web_url(&self, base: &str) -> String
Renders a loopback Web UI URL (<base>/#invite=<fragment>).
Sourcepub fn to_https_launcher_url(&self, base: &str) -> String
pub fn to_https_launcher_url(&self, base: &str) -> String
Renders an HTTPS launcher URL (<base>#<fragment>).
Sourcepub fn parse_any_link(input: &str) -> Result<Self, InviteError>
pub fn parse_any_link(input: &str) -> Result<Self, InviteError>
Parses any supported magic link form (gitiverse://invite#..., local Web UI #invite=..., HTTPS launcher #..., or bare fragment).