vault

package
v0.0.0-...-8df6f55 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	AppRoleAuth string // TODO
	JWTAuth     string // TODO
	// contains filtered or unexported fields
}

func NewClient

func NewClient(addr string, options ...Option) (*Client, error)

func (Client) AsProvider

func (c Client) AsProvider() SecretsProvider

func (Client) CreateAppRole

func (c Client) CreateAppRole(roleName, ttl, maxTTL string, policies ...string) (string, string, error)

func (Client) DeleteSecret

func (c Client) DeleteSecret(path string) error

func (Client) ListPolicies

func (c Client) ListPolicies() ([]string, error)

func (Client) ListSecret

func (c Client) ListSecret(path string) ([]string, error)

func (Client) LoadSecret

func (c Client) LoadSecret(path string) (*Secret, error)

func (Client) ReadJWTRoleClaims

func (c Client) ReadJWTRoleClaims(roleName string) (JWTBoundClaims, error)

func (Client) ReadValue

func (c Client) ReadValue(path, field string) (interface{}, bool, error)

func (Client) SwitchVault

func (c Client) SwitchVault(newAddr string) (*Client, error)

func (Client) WriteJWTRole

func (c Client) WriteJWTRole(roleName string, roleConfig JWTRoleConfig) error

func (Client) WriteSecret

func (c Client) WriteSecret(path string, data map[string]interface{}) error

type JWTBoundClaims

type JWTBoundClaims struct {
	UserEmail    []string `json:"user_email"`
	UserId       []string `json:"user_id,omitempty"`
	RefProtected string   `json:"ref_protected"`
	RefType      string   `json:"ref_type"`
	Ref          []string `json:"ref"`
	NamespaceID  string   `json:"namespace_id,omitempty"`
}

type JWTRoleConfig

type JWTRoleConfig struct {
	RoleType            string         `json:"role_type"`
	Policies            []string       `json:"policies"`
	TokenTTL            string         `json:"token_ttl"`
	TokenExplicitMaxTTL string         `json:"token_explicit_max_ttl"`
	UserClaim           string         `json:"user_claim"`
	BoundClaims         JWTBoundClaims `json:"bound_claims"`
}

type Option

type Option func(c *Client)

func WithAppRole

func WithAppRole(roleID string, secretID string) Option

func WithJWT

func WithJWT(authPath, role, jwt string) Option

func WithToken

func WithToken(token string) Option

func WithTokenPrompt

func WithTokenPrompt(token string, prompter Prompter) Option

type Prompter

type Prompter func() (string, error)

type Secret

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

func (Secret) GetItem

func (s Secret) GetItem(key string) (string, bool)

func (Secret) GetItemFuzzy

func (s Secret) GetItemFuzzy(exp string) (string, string, bool)

type SecretsProvider

type SecretsProvider Client

func (SecretsProvider) LoadSecret

func (p SecretsProvider) LoadSecret(uri string) (string, error)

Jump to

Keyboard shortcuts

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