Documentation
¶
Overview ¶
Package invite formats and parses the invite link
https://<host>/peer/i/<channel id>#v1.<token>.<rootpub>.<exp>.<secret>
(design §4). The fragment never reaches a server; it carries the one-time invite token, the inviter's Ed25519 root public key (base64url, no padding), the expiry (unix seconds) and the link secret: 16 random bytes the relay never sees, which the guest proves at accept and which binds the verification code to this invite. A link is valid for 72 h.
Index ¶
Constants ¶
const LinkKeySize = 32
LinkKeySize is a feed link key's length in bytes.
const SecretSize = 16
SecretSize is the link secret's length in bytes.
const Validity = 72 * time.Hour
Validity is how long a new link stays valid.
Variables ¶
var ( ErrMalformed = errors.New("invite: malformed link") ErrExpired = errors.New("invite: link expired") )
Functions ¶
Types ¶
type Feed ¶ added in v0.2.0
type Feed struct {
Relay string // relay base, e.g. https://example.com/peer
Room string // room id
Token string // the read token
Key []byte // LinkKeySize bytes
Owner ed25519.PublicKey // the owner's room signing key
}
Feed is the second form of link (contract § Sealed record, Feed link):
https://<host>/peer/f/<room id>#v1.<readToken>.<linkKey>.<ownerSign>
The fragment carries the feed's multi-use read token, the link key the link stanza's X25519 key derives from, and the owner's room signing key, the key a holder verifies every record under. It does not expire: a new link cuts every old holder off.
func ParseFeed ¶ added in v0.2.0
ParseFeed reads a feed link and refuses anything else: a v1 invite link, a link whose fragment is not v1.<readToken>.<linkKey>.<ownerSign>, a key of the wrong size.
type Link ¶
type Link struct {
Relay string // relay base, e.g. https://example.com/peer
Channel string // channel id
Token string // one-time invite token
Root ed25519.PublicKey // inviter's root key, pinned on accept
Expires time.Time // whole seconds
Secret []byte // SecretSize bytes, known to the two CLIs alone
}
Link is a parsed invite.
func New ¶
func New(relayBase, channel, token string, root ed25519.PublicKey, secret []byte, now time.Time) (Link, error)
New makes a link that expires Validity after now.