Documentation
¶
Overview ¶
Package cluster defines the shared-secret membership primitive used by r1s transports.
Index ¶
- Constants
- Variables
- func CredentialToken(credential Credential) (string, error)
- func DefaultDirectory() (string, error)
- func Generate() ([]byte, error)
- func ID(key []byte) ([]byte, error)
- func List(directory string) ([]string, error)
- func Load(path string) ([]byte, error)
- func NormalizeBootstrapDestinations(destinations []string) ([]string, error)
- func OpenRealm(key []byte) (*realm.Realm, error)
- func ParseToken(value string) ([]byte, error)
- func RecordBootstrapDestination(path, destination string) error
- func Resolve(directory, selector string) ([]byte, string, error)
- func RunCommand(arguments []string, directory string, stdout, stderr io.Writer) error
- func SaveCredential(directory string, key []byte) (string, error)
- func SaveMembership(directory string, credential Credential) (string, error)
- func SaveNew(path string, key []byte) error
- func Token(key []byte) (string, error)
- type Credential
- type State
Constants ¶
const ( KeySize = realm.KeySize DestinationSize = 16 MaxBootstrapDestinations = 32 DefaultRelPath = ".config/r1s/realms" )
Variables ¶
var ( ErrInvalidKey = errors.New("invalid cluster key") ErrInvalidToken = errors.New("invalid cluster join token") ErrInvalidState = errors.New("invalid cluster state") ErrStateExists = errors.New("cluster state already exists") ErrNotFound = errors.New("cluster credential not found") ErrAmbiguous = errors.New("ambiguous cluster identifier") )
Functions ¶
func CredentialToken ¶ added in v0.5.1
func CredentialToken(credential Credential) (string, error)
CredentialToken serializes a membership for transfer. Key-only credentials encode directly; credentials with routing hints serialize a versioned payload under the same r1s1 prefix. The hints remain public, non-authoritative data.
func DefaultDirectory ¶ added in v0.4.0
DefaultDirectory returns the per-user credential directory shared by both clients and allocators.
func List ¶ added in v0.4.0
List returns valid credential IDs in lexical order. Unrelated files and the legacy single-file store outside directory are ignored.
func NormalizeBootstrapDestinations ¶ added in v0.5.1
NormalizeBootstrapDestinations validates, lower-cases, deduplicates, sorts, and bounds 16-byte RNS destination hashes.
func OpenRealm ¶ added in v0.5.0
OpenRealm uses the standard meshbus realm profile. r1s keeps cluster as its product-facing name, but no longer maintains separate ID or authentication domains below that API.
func ParseToken ¶
func RecordBootstrapDestination ¶ added in v0.5.1
RecordBootstrapDestination durably adds one public allocator destination to an existing credential without changing its realm key.
func RunCommand ¶
RunCommand implements the shared `cluster init|join|list|token` command surface.
func SaveCredential ¶ added in v0.4.0
SaveCredential atomically stores key under its full derived public ID. An existing credential for the same cluster is an idempotent success.
func SaveMembership ¶ added in v0.5.1
func SaveMembership(directory string, credential Credential) (string, error)
SaveMembership persists a transferred credential and merges its validated public routing hints with any hints already learned locally.
Types ¶
type Credential ¶ added in v0.5.1
Credential keeps the realm membership secret separate from public RNS routing hints. Bootstrap destinations grant no authority; every connection still has to prove possession of Key before an r1s envelope is delivered.
func LoadCredential ¶ added in v0.5.1
func LoadCredential(path string) (Credential, error)
LoadCredential reads the cluster state and its bounded public bootstrap destinations.
func ParseCredentialToken ¶ added in v0.5.1
func ParseCredentialToken(value string) (Credential, error)
ParseCredentialToken parses a membership token carrying a realm key and optional bounded public allocator destinations.
func ResolveCredential ¶ added in v0.5.1
func ResolveCredential(directory, selector string) (Credential, string, error)
ResolveCredential loads the selected membership and its durable public bootstrap hints.