vault

package
v0.0.0-...-5c159d4 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: 0BSD Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoToken = errors.New("no token")

Functions

This section is empty.

Types

type Encryption

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

func NewEnc

func NewEnc(fs filesys.FileSystem) *Encryption

func (*Encryption) DecryptAtRest

func (enc *Encryption) DecryptAtRest(path string, keyString string) ([]byte, error)

func (*Encryption) EncryptAtRest

func (enc *Encryption) EncryptAtRest(path string, data []byte, keyString string) error

type EnvTokenReader

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

func NewEnvTokenReader

func NewEnvTokenReader() EnvTokenReader

func (EnvTokenReader) AccessToken

func (e EnvTokenReader) AccessToken() (string, error)

func (EnvTokenReader) Salt

func (e EnvTokenReader) Salt() (string, error)

type SecretFetchOptions

type SecretFetchOptions struct {
	VaultUri      string
	SecretName    string
	SecretVersion string
}

type ServicePrincipal

type ServicePrincipal struct {
	TenantId     string
	ClientId     string
	ClientSecret string
	// contains filtered or unexported fields
}

func NewServicePrincipalFromEnv

func NewServicePrincipalFromEnv(configDir string, opts ...SpOption) (ServicePrincipal, error)

func (ServicePrincipal) AccessToken

func (sp ServicePrincipal) AccessToken() (string, error)

func (ServicePrincipal) Salt

func (sp ServicePrincipal) Salt() (string, error)

type Source

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

func NewSourceOrDie

func NewSourceOrDie(cnfDir string, tokenSrc TokenSource, enc *Encryption) Source

func (Source) RetrieveSecret

func (src Source) RetrieveSecret(uri, name, version string) (string, error)

type SpOption

type SpOption func(sp *ServicePrincipal)

func WithEncryption

func WithEncryption(enc *Encryption) SpOption

type Token

type Token struct {
	AccessToken string `json:"access_token"`
	Expires     int64  `json:"expires"`
}

type TokenResponse

type TokenResponse struct {
	TokenType    string `json:"token_type"`
	ExpiresIn    string `json:"expires_in"`
	ExtExpiresIn string `json:"ext_expires_in"`
	ExpiresOn    string `json:"expires_on"`
	NotBefore    string `json:"not_before"`
	Resource     string `json:"resource"`
	Scope        string `json:"scope"`
	AccessToken  string `json:"access_token"`
}

type TokenSource

type TokenSource interface {
	AccessToken() (string, error)
	Salt() (string, error)
}

type VaultSecret

type VaultSecret struct {
	Value      string                `json:"value"`
	ID         string                `json:"id"`
	Attributes VaultSecretAttributes `json:"attributes"`
	Tags       map[string]string     `json:"tags"`
}

type VaultSecretAttributes

type VaultSecretAttributes struct {
	Enabled         bool   `json:"enabled"`
	Created         int    `json:"created"`
	Updated         int    `json:"updated"`
	RecoveryLevel   string `json:"recoveryLevel"`
	RecoverableDays int    `json:"recoverableDays"`
}

Jump to

Keyboard shortcuts

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