state

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const BlankAgeKeyValue = "{}"
View Source
const InitialSecretValue = `{"empty":true}`

Variables

This section is empty.

Functions

func AllSecrets

func AllSecrets(cid string) []entity.Secret

AllSecrets returns a slice of entity.Secret containing all secrets currently stored. If no secrets are found, an empty slice is returned.

func DecryptValue added in v0.15.7

func DecryptValue(value string) (string, error)

DecryptValue takes a base64-encoded and encrypted string value and returns the original, decrypted string. If the decryption process encounters any error, it will return an empty string and the corresponding error.

func DeleteSecret added in v0.15.7

func DeleteSecret(secret entity.SecretStored)

func EncryptValue added in v0.15.7

func EncryptValue(value string) (string, error)

EncryptValue takes a string value and returns an encrypted and base64-encoded representation of the input value. If the encryption process encounters any error, it will return an empty string and the corresponding error.

func Initialize added in v0.15.7

func Initialize()

Initialize starts two goroutines: one to process the secret queue and another to process the Kubernetes secret queue. These goroutines are responsible for handling queued secrets and persisting them to disk.

func ReadSecret

func ReadSecret(cid string, key string) (*entity.SecretStored, error)

ReadSecret takes a key string and returns a pointer to an entity.SecretStored object if the secret exists in the in-memory store. If the secret is not found in memory, it attempts to read it from disk, store it in memory, and return it. If the secret is not found on disk, it returns nil.

func SetAgeKey

func SetAgeKey(k string)

SetAgeKey sets the age key to be used for encryption and decryption.

func UpsertSecret

func UpsertSecret(secret entity.SecretStored, appendValue bool)

UpsertSecret takes an entity.SecretStored object and inserts it into the in-memory store if it doesn't exist, or updates it if it does. It also handles updating the backing store and Kubernetes secrets if necessary. If appendValue is true, the new value will be appended to the existing values, otherwise it will replace the existing values.

Types

type AegisInternalCommand

type AegisInternalCommand struct {
	LogLevel int `json:"logLevel"`
}

type Status added in v0.15.7

type Status struct {
	SecretQueueLen int
	SecretQueueCap int
	K8sQueueLen    int
	K8sQueueCap    int
	NumSecrets     int
	// contains filtered or unexported fields
}

Status is a struct representing the current state of the secret manager, including the lengths and capacities of the secret queues and the total number of secrets stored.

func Stats

func Stats() Status

Stats returns a copy of the currentState Status object, providing a snapshot of the current status of the secret manager.

func (*Status) Decrement added in v0.15.7

func (s *Status) Decrement(name string)

Decrement is a method for the Status struct that decrements the NumSecrets field by 1 if the provided secret name is found in the in-memory store.

func (*Status) Increment added in v0.15.7

func (s *Status) Increment(name string)

Increment is a method for the Status struct that increments the NumSecrets field by 1 if the provided secret name is not found in the in-memory store.

Jump to

Keyboard shortcuts

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