auth

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentIDHash

func AgentIDHash(agentID string) string

AgentIDHash returns the sha256 hex of agentID (for anonymization).

func ResolveDIDKey

func ResolveDIDKey(did string) (ed25519.PublicKey, error)

ResolveDIDKey resolves a did:key:z<base58btc> DID to an Ed25519 public key. Only the Ed25519 multicodec prefix (0xed01) is supported.

Types

type CachedKeyStore

type CachedKeyStore struct {
	// contains filtered or unexported fields
}

CachedKeyStore wraps a KeyStore with a TTL cache.

func NewCachedKeyStore

func NewCachedKeyStore(inner KeyStore, ttl time.Duration) *CachedKeyStore

NewCachedKeyStore wraps inner with a TTL-based cache.

func (*CachedKeyStore) PublicKey

func (c *CachedKeyStore) PublicKey(agentID string) (ed25519.PublicKey, error)

PublicKey returns the public key for agentID, using the cache when valid.

type CompositeKeyStore added in v1.0.0

type CompositeKeyStore struct {
	// contains filtered or unexported fields
}

CompositeKeyStore tries multiple KeyStores in order, returning the first successful result. This allows combining FileKeyStore and DBKeyStore so that keys registered via either mechanism are found.

func NewCompositeKeyStore added in v1.0.0

func NewCompositeKeyStore(stores ...KeyStore) *CompositeKeyStore

NewCompositeKeyStore creates a store that queries each inner store in order.

func (*CompositeKeyStore) PublicKey added in v1.0.0

func (c *CompositeKeyStore) PublicKey(agentID string) (ed25519.PublicKey, error)

PublicKey returns the public key from the first store that has it.

type DBKeyStore added in v1.0.0

type DBKeyStore struct {
	// contains filtered or unexported fields
}

DBKeyStore resolves Ed25519 public keys from the SQLite agent_keys table.

func NewDBKeyStore added in v1.0.0

func NewDBKeyStore(db *storage.DB) *DBKeyStore

NewDBKeyStore creates a DBKeyStore backed by db.

func (*DBKeyStore) PublicKey added in v1.0.0

func (s *DBKeyStore) PublicKey(agentID string) (ed25519.PublicKey, error)

PublicKey returns the Ed25519 public key for agentID from the database.

type FileKeyStore

type FileKeyStore struct {
	// contains filtered or unexported fields
}

FileKeyStore loads Ed25519 public keys from a YAML file.

func NewFileKeyStore

func NewFileKeyStore(path string) (*FileKeyStore, error)

NewFileKeyStore loads keys from path. A missing file is treated as an empty store and is not an error.

func (*FileKeyStore) PublicKey

func (fs *FileKeyStore) PublicKey(agentID string) (ed25519.PublicKey, error)

PublicKey returns the public key for agentID, or an error if not found.

type KeyStore

type KeyStore interface {
	PublicKey(agentID string) (ed25519.PublicKey, error)
}

KeyStore resolves Ed25519 public keys by agent ID.

Jump to

Keyboard shortcuts

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