binding

package
v0.70.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 1 Imported by: 1 module, 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 binding preserves the vMCP binding API, delegating the canonical format to pkg/auth/sessionbinding. An identity binding encodes the principal that created a session as a single opaque string suitable for storage in a key/value store such as Redis or Valkey.

Format

Standard bindings have two NUL-separated fields: iss and sub. Delegated bindings add the route tag "delegated" and client_id, followed by act.iss and act.sub when an actor is present. Every encoded field is nonempty and contains no NUL.

Sessions created before any auth middleware ran use the literal "unauthenticated" sentinel. The sentinel must not contain '\x00' so it cannot collide with any bound form; any future format change must keep the sentinel and the bound-form value sets non-overlapping.

Trust boundary

Bindings are stored plaintext at rest. They are PII but not credentials — they identify but do not authenticate. They carry no freshness signal (no exp, no nonce) and are NOT a substitute for token validation: callers must only compare a stored binding against the full binding from the current request's freshly validated identity.

Index

Constants

View Source
const UnauthenticatedSentinel = sessionbinding.UnauthenticatedSentinel

UnauthenticatedSentinel is the binding value stored for sessions that were created without an authenticated identity (auth middleware not present or identity nil).

Variables

View Source
var ErrInvalidBinding = sessionbinding.ErrInvalidBinding

ErrInvalidBinding is returned by Format when either input is empty or contains a NUL byte.

Functions

func Format

func Format(iss, sub string) (string, error)

Format returns the canonical on-the-wire form of an identity binding: iss + "\x00" + sub. Returns ErrInvalidBinding when either input is empty or contains a NUL byte.

func IsUnauthenticated

func IsUnauthenticated(s string) bool

IsUnauthenticated reports whether s is the literal unauthenticated sentinel.

func Parse

func Parse(s string) (iss, sub string, ok bool)

Parse validates a standard or delegated binding and returns its (iss, sub) prefix. It rejects malformed values and the unauthenticated sentinel. For delegated bindings, passing these fields to Format loses ownership data; use sessionbinding.Validate to compare full bindings instead.

Types

This section is empty.

Jump to

Keyboard shortcuts

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