keyring

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package keyring handles secure storage of cryptographic keys and secrets.

Secret reads and writes are performed directly via the OS keychain (go-keyring). On Linux/WSL (where D-Bus Secret Service is typically unavailable), storage falls back to file-based storage in ~/.agentsecrets/keyring.json.

On Linux/WSL (where D-Bus Secret Service is typically unavailable), keypair storage falls back to file-based storage in ~/.agentsecrets/keyring.json.

Service name: "AgentSecrets" Keypair naming: "{email}_private_key", "{email}_public_key" Secret naming: "{projectID}:{environment}:{key}"

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteKeypair

func DeleteKeypair(email string) error

DeleteKeypair removes both keys (used during logout).

func DeleteSecret

func DeleteSecret(projectID, environment, key string) error

DeleteSecret removes a secret from the keyring and its index.

func GetAllProjectSecrets

func GetAllProjectSecrets(projectID, environment string) (map[string]string, error)

GetAllProjectSecrets returns all secrets mapped for a specific project and environment from the keyring.

func GetPrivateKey

func GetPrivateKey(email string) ([]byte, error)

GetPrivateKey retrieves the user's private key.

func GetPublicKey

func GetPublicKey(email string) ([]byte, error)

GetPublicKey retrieves the user's public key.

func GetSecret

func GetSecret(projectID, environment, key string) (string, error)

GetSecret retrieves a secret value directly from the OS keychain. It handles legacy key format fallback for the development environment.

func GetWorkspaceAllowlist added in v1.1.0

func GetWorkspaceAllowlist(workspaceID string) ([]string, error)

GetWorkspaceAllowlist retrieves the allowlist for a workspace from the OS keychain.

func ListProjectKeyNames added in v1.2.0

func ListProjectKeyNames(projectID, environment string) []string

ListProjectKeyNames returns the key names cached in the local index for a given project and environment. This reads the key index only (no secret values are accessed, no keychain-auth session required). Useful for listing, .env.example generation, and count display without API calls.

func SetSecret

func SetSecret(projectID, environment, key, value string) error

SetSecret stores a decrypted secret in the keyring and updates the project environment's key index.

func SetWorkspaceAllowlist added in v1.1.0

func SetWorkspaceAllowlist(workspaceID string, domains []string) error

SetWorkspaceAllowlist stores the allowlist for a workspace in the OS keychain.

func StoreKeypair

func StoreKeypair(email string, privateKey, publicKey []byte) error

StoreKeypair saves both private and public keys. Uses OS keychain when available, falls back to file on Linux/WSL.

Types

This section is empty.

Jump to

Keyboard shortcuts

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