vault

package
v0.4.113 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: AGPL-3.0 Imports: 15 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuditEntry

type AuditEntry struct {
	ID           int64     `json:"id"`
	CredentialID int64     `json:"credential_id"`
	TaskID       int64     `json:"task_id,omitempty"`
	IntentID     int64     `json:"intent_id,omitempty"`
	Actor        string    `json:"actor"`
	Action       string    `json:"action"`
	At           time.Time `json:"at"`
}

type Item

type Item struct {
	ID         int64           `json:"id"`
	TaskID     int64           `json:"task_id,omitempty"`
	AssetID    int64           `json:"asset_id,omitempty"`
	Kind       string          `json:"kind"`
	Username   string          `json:"username,omitempty"`
	Secret     string          `json:"secret,omitempty"`
	SecretHint string          `json:"secret_hint,omitempty"`
	Privilege  string          `json:"privilege,omitempty"`
	Meta       json.RawMessage `json:"meta,omitempty"`
	ExpiresAt  *time.Time      `json:"expires_at,omitempty"`
	CreatedAt  time.Time       `json:"created_at"`
	LastUsedAt *time.Time      `json:"last_used_at,omitempty"`
}

Item 是凭据的元数据;Secret 只在 Get/Reveal 时填充。

type SaveInput

type SaveInput struct {
	TaskID    int64
	AssetID   int64
	Kind      string
	Username  string
	Secret    string
	Privilege string
	Note      string
	Meta      json.RawMessage
	ExpiresAt *time.Time
}

type Store

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

func Open

func Open(keyDir, dataDir string, pg *db.DB) (*Store, error)

func (*Store) Audit

func (s *Store) Audit(ctx context.Context, credentialID int64, limit int) ([]AuditEntry, error)

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, id int64, actor string) error

func (*Store) Get

func (s *Store) Get(ctx context.Context, id int64, taskID int64) (*Item, error)

func (*Store) List

func (s *Store) List(ctx context.Context, taskID, assetID int64, kind string) ([]Item, error)

List 返回掩码元数据;taskID>0 时看本任务与全局,taskID=0 只看全局, taskID<0 表示管理端全量(不按任务过滤)。

func (*Store) ListByHost

func (s *Store) ListByHost(ctx context.Context, taskID int64, host, kind string) ([]Item, error)

ListByHost 按站点(域名/IP)查询凭据:匹配资产的 domain / root_domain / ip / bound_domains,以及凭据 meta 里显式记录的 host。返回掩码元数据,不含明文。

任务语义与 List 一致:taskID>0 看本任务与全局,taskID=0 只看全局, taskID<0 为管理端全量。

func (*Store) Reveal

func (s *Store) Reveal(ctx context.Context, id, taskID int64, actor string) (*Item, error)

func (*Store) Save

func (s *Store) Save(ctx context.Context, in SaveInput, actor string) (int64, error)

func (*Store) Touch

func (s *Store) Touch(ctx context.Context, id, taskID, intentID int64, actor string)

Jump to

Keyboard shortcuts

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