protocol

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: AGPL-3.0 Imports: 2 Imported by: ? 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 protocol defines credential wire versions and feature negotiation. It does not register a service or install a gRPC codec.

Index

Constants

View Source
const Version uint32 = cw.Version

Version is the exact credential transport cohort, independent of type versions.

Variables

This section is empty.

Functions

This section is empty.

Types

type Feature

type Feature string

Feature is a credential transport trait, not a grant to use an operation. A valid name has the form credential.<name>.vN: name starts with a lowercase ASCII letter and uses lowercase letters, digits, and single interior hyphens; N is positive decimal without a leading zero. Only the constants below are known to this cohort. A well-formed future name can never enable behavior here.

const (
	// FeatureMaterial is required on both peers before any credential operation.
	FeatureMaterial Feature = "credential.material.v1"
	// FeatureTypes advertises credential type operations.
	FeatureTypes Feature = "credential.types.v1"
	// FeatureIssuers advertises issuer operations.
	FeatureIssuers Feature = "credential.issuers.v1"
	// FeatureSlots advertises named consumer slots.
	FeatureSlots Feature = "credential.slots.v1"
	// FeatureHostCallback advertises the separate host callback protocol.
	FeatureHostCallback Feature = "credential.host-callback.v1"
	// FeaturePrompt advertises host-mediated interaction.
	FeaturePrompt Feature = "credential.prompt.v1"
)

func Negotiate

func Negotiate(localVersion, remoteVersion uint32, local, remote, required []Feature) ([]Feature, error)

Negotiate returns the mutually advertised known features in lexical order. Both versions must equal Version. FeatureMaterial is always required; every other required feature must also be known and advertised by both peers. Unknown, well-formed optional names add nothing. Lists have set semantics: repetitions add no support, but count toward the input limit. Negotiation neither replaces byte-level admission nor authorizes a bind or material use. A refusal returns a nil set and a NegotiationError, never a partial result.

type NegotiationError

type NegotiationError uint8

NegotiationError classifies a failed handshake without retaining peer input.

const (
	// ErrUnsupportedVersion means at least one peer did not offer this SDK's Version.
	ErrUnsupportedVersion NegotiationError = iota + 1
	// ErrInvalidFeatures means a feature list exceeded the wire limit or a name was malformed.
	ErrInvalidFeatures
	// ErrRequiredFeature means a required trait, including material, was not mutually supported.
	ErrRequiredFeature
)

func (NegotiationError) Error

func (r NegotiationError) Error() string

Error returns a fixed diagnostic, never an advertised name or other peer data.

Jump to

Keyboard shortcuts

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