secrets

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Secret

type Secret struct {
	Key      string            `json:"key"`      // 密钥名称
	Provider string            `json:"provider"` // 提供商 (openai, anthropic, etc.)
	Value    string            `json:"value"`    // 加密后的值
	Metadata map[string]string `json:"metadata"` // 额外元数据
}

Secret 密钥条目

type Store

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

Store 密钥存储

func NewStore

func NewStore(dataDir string) (*Store, error)

NewStore 创建新的密钥存储

func (*Store) Delete

func (s *Store) Delete(key string) error

Delete 删除密钥

func (*Store) ExportKeys

func (s *Store) ExportKeys() []Secret

ExportKeys 导出密钥列表(不含值)

func (*Store) Get

func (s *Store) Get(key string) (string, error)

Get 获取密钥(解密)

func (*Store) GetByProvider

func (s *Store) GetByProvider(provider string) (map[string]string, error)

GetByProvider 根据提供商获取所有密钥

func (*Store) GetMetadata

func (s *Store) GetMetadata(key string) (map[string]string, error)

GetMetadata 获取密钥元数据

func (*Store) Has

func (s *Store) Has(key string) bool

Has 检查密钥是否存在

func (*Store) ImportFromEnv

func (s *Store) ImportFromEnv() error

ImportFromEnv 从环境变量导入

func (*Store) List

func (s *Store) List() []string

List 列出所有密钥名称

func (*Store) ListByProvider

func (s *Store) ListByProvider(provider string) []string

ListByProvider 列出提供商下的密钥

func (*Store) Rename

func (s *Store) Rename(oldKey, newKey string) error

Rename 重命名密钥

func (*Store) Set

func (s *Store) Set(key, provider, value string, metadata map[string]string) error

Set 设置密钥

func (*Store) UpdateMetadata

func (s *Store) UpdateMetadata(key string, metadata map[string]string) error

UpdateMetadata 更新密钥元数据

Jump to

Keyboard shortcuts

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