agentkey

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package agentkey handles the agent's Ed25519 identity key: generation, PEM persistence, JWKS publication, and JWT-Bearer assertion signing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JWK

type JWK struct {
	Kty string `json:"kty"`
	Crv string `json:"crv"`
	X   string `json:"x"`
	Kid string `json:"kid"`
	Use string `json:"use"`
	Alg string `json:"alg"`
}

JWK is a single JSON Web Key for an Ed25519 public key (OKP).

type JWKS

type JWKS struct {
	Keys []JWK `json:"keys"`
}

JWKS is a JSON Web Key Set.

type Key

type Key struct {
	Priv ed25519.PrivateKey
	KID  string
}

Key wraps an Ed25519 private key plus its key id.

func Generate

func Generate(kid string) (*Key, error)

Generate creates a new Ed25519 key with the given key id.

func LoadOrGenerate

func LoadOrGenerate(path, kid string) (key *Key, created bool, err error)

LoadOrGenerate loads the key from path, or generates and persists a new one (PEM, 0600) using kid when the file does not exist. It reports whether a new key was created.

func (*Key) JWKS

func (k *Key) JWKS() JWKS

JWKS returns the public JWKS for this key.

func (*Key) Save

func (k *Key) Save(path string) error

Save writes the private key as PKCS#8 PEM with 0600 perms.

func (*Key) SignAssertion

func (k *Key) SignAssertion(agentID, audience string, ttl time.Duration) (string, error)

SignAssertion produces a short-lived JWT-Bearer assertion (alg=EdDSA) for the given agent id and audience, as expected by the token endpoint.

Jump to

Keyboard shortcuts

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