vault

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrVaultAlreadyConfigured     = errors.New("vault is already configured")
	ErrVaultNotConfigured         = errors.New("vault is not configured")
	ErrVaultNotConfiguredOrSealed = errors.New("vault is not configured or sealed")
)
View Source
var DefaultParameters = &ArgonParameters{
	Aargon2Version: argon2.Version,
	Variant:        "argon2id",
	Memory:         64 * 1024,
	Iterations:     3,
	Parallelism:    2,
	SaltLength:     16,
	KeyLength:      32,
}
View Source
var (
	VaultEventSource = eventing.EventSource("Vault")
)

Functions

This section is empty.

Types

type ArgonParameters

type ArgonParameters struct {
	Aargon2Version uint32
	Variant        string
	Memory         uint32
	Iterations     uint32
	Parallelism    uint8
	SaltLength     uint32
	KeyLength      uint32
}

type Vault

type Vault interface {
	// IsConfigured returns true if the vault is configured with a key, false otherwise.
	IsConfigured(ctx app.Context) (bool, error)

	// Configure configures the vault with a key derived from the given plainPassword.
	Configure(ctx app.Context, plainPassword string) error

	// Open opens the vault with the given plainPassword.
	// Allows the vault to be used for encryption and decryption.
	Open(ctx app.Context, plainPassword string) (bool, error)

	// Seal closes the vault and purges the key from memory.
	Seal()

	// Vault can be used as an encryption service.
	encryption.EncryptionService
}

func NewVault

func NewVault(db *sql.DB, bus *eventing.Eventbus, timeSvc utils.Clock) Vault

type VaultConfiguredEvent

type VaultConfiguredEvent struct {
	KeyId string
}

Jump to

Keyboard shortcuts

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