vault

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverOrCreateVault

func DiscoverOrCreateVault(store storage.Provider, namespace string) (string, error)

DiscoverOrCreateVault finds an existing vault repo or creates one. Returns the repo name (not the full owner/name path).

func EncodeDeployKey

func EncodeDeployKey(dk *DeployKeyToken) (string, error)

EncodeDeployKey encodes a deploy key token to an opaque string.

func MarshalEnvelopes

func MarshalEnvelopes(envelopes map[string]Envelope) ([]byte, error)

MarshalEnvelopes serializes envelopes to JSON.

func Now

func Now() string

Now returns the current time as an RFC3339 string.

func UnmarshalEnvelopes

func UnmarshalEnvelopes(data []byte) (map[string]Envelope, error)

UnmarshalEnvelopes deserializes envelopes from JSON.

func WriteVaultConfig

func WriteVaultConfig(store storage.Provider, vaultRepo, repoName string, vc *VaultConfig) error

WriteVaultConfig writes vault config to the storage backend.

Types

type ApprovedUser

type ApprovedUser struct {
	PublicKey  string `json:"public_key"`
	ApprovedAt string `json:"approved_at"`
}

ApprovedUser is a user who has been granted access.

type DeployKey

type DeployKey struct {
	PublicKey    string   `json:"public_key"`
	Environments []string `json:"environments"`
	CreatedBy    string   `json:"created_by"`
	CreatedAt    string   `json:"created_at"`
}

DeployKey is a CI/CD deployment key entry.

type DeployKeyToken

type DeployKeyToken struct {
	VaultRepo     string   `json:"vault_repo"`
	SourceRepo    string   `json:"source_repo"`
	KeyName       string   `json:"key_name"`
	PrivateKey    [32]byte `json:"-"`
	PrivateKeyB64 string   `json:"private_key"`
	Environments  []string `json:"environments"`
}

DeployKeyToken is the decoded form of a deployment key token.

func DecodeDeployKey

func DecodeDeployKey(token string) (*DeployKeyToken, error)

DecodeDeployKey decodes a deploy key token string.

type Envelope

type Envelope struct {
	EncryptedKey    string `json:"encrypted_key"`
	Nonce           string `json:"nonce"`
	EphemeralPublic string `json:"ephemeral_public"`
}

Envelope holds the encrypted symmetric key for one recipient.

type PendingRequest

type PendingRequest struct {
	PublicKey   string `json:"public_key"`
	RequestedAt string `json:"requested_at"`
}

PendingRequest is an unapproved access request.

type RepoMarker

type RepoMarker struct {
	Version   int    `json:"version"`
	Type      string `json:"type"`
	Namespace string `json:"namespace"`
	CreatedAt string `json:"created_at"`
	CreatedBy string `json:"created_by"`
}

RepoMarker identifies a repo as a vaultenv vault.

type VaultConfig

type VaultConfig struct {
	Version         int                       `json:"version"`
	Repo            string                    `json:"repo"`
	Owner           string                    `json:"owner"`
	ApprovedUsers   map[string]ApprovedUser   `json:"approved_users"`
	PendingRequests map[string]PendingRequest `json:"pending_requests"`
	DeployKeys      map[string]DeployKey      `json:"deploy_keys,omitempty"`
	Environments    []string                  `json:"environments"`
}

VaultConfig represents the vault.json for a linked repo.

func LoadVaultConfig

func LoadVaultConfig(store storage.Provider, vaultRepo, repoName string) (*VaultConfig, error)

LoadVaultConfig loads a vault config from the storage backend.

func NewVaultConfig

func NewVaultConfig(repo, owner, ownerPubKey string) *VaultConfig

NewVaultConfig creates a new vault config with the given owner.

func ParseVaultConfig

func ParseVaultConfig(data []byte) (*VaultConfig, error)

ParseVaultConfig parses vault.json bytes.

Jump to

Keyboard shortcuts

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