invite

package
v0.8.78 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package invite encodes and decodes Dejima team invites — a single paste-safe blob that carries everything a teammate needs to connect to a daemon (host:port + bearer secret + role/scope). The owner issues one in the TUI Team view at token-mint time; the teammate pastes it on the join side and is connected with no env vars or manual flags.

Wire format: "dejima-invite:" + base64url(no-pad) of the JSON Payload. The base64url alphabet (RFC 4648 §5) is URL/filename-safe, so the blob survives copy/paste, chat, QR, and shell args without "+", "/", or "=" being mangled.

The blob is ENCODED, not encrypted: it contains the bearer secret in the clear (post-base64). It is therefore a credential — treat it like a password, send it over a trusted channel, and revoke the underlying token to kill a leaked invite (DELETE /v1/tokens/{id}).

Index

Constants

View Source
const Scheme = "dejima-invite:"

Scheme prefixes every invite blob; it makes an invite recognisable to a paste handler and greppable in logs/chat.

View Source
const Version = 1

Version is the current payload schema version. Decode rejects anything else, so an older client fails loudly on a newer invite instead of misreading it.

Variables

This section is empty.

Functions

func Encode

func Encode(p Payload) (string, error)

Encode validates p, stamps the current Version, and returns the paste-safe blob. Run it at token-mint time — the bearer secret is only available once.

Types

type Payload

type Payload struct {
	V       int      `json:"v"`
	Host    string   `json:"host"`              // daemon host:port the teammate dials (operator-supplied)
	Token   string   `json:"token"`             // bearer secret (the credential)
	Role    string   `json:"role"`              // owner|operator|viewer (echo; daemon enforces real scope)
	Islands []string `json:"islands,omitempty"` // scope echo; empty = all islands
	Name    string   `json:"name,omitempty"`    // suggested profile name
	Label   string   `json:"label,omitempty"`   // token label / who it's for (display)
}

Payload is the decoded invite. Keys are short to keep the blob compact (a typical invite is ~120–180 chars). Host/Token/Role are required; the rest are display/UX hints.

func Decode

func Decode(s string) (Payload, error)

Decode is the strict, total inverse of Encode: every malformed input yields a clear error (never a panic or a partial Payload), so the join side can render the message verbatim. Surrounding whitespace (from a sloppy paste) is trimmed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL