model

package
v0.0.0-...-8351a3e Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateNewSecretsFile

func GenerateNewSecretsFile(file string, passphrase string) error

GenerateNewSecretsFile creates a new file with a checksum

Types

type Secret

type Secret struct {
	Name   string   `json:"name,omitempty"`
	Secret []byte   `json:"secret,omitempty"`
	Access []string `json:"access,omitempty"`
}

Secret name/encrypted bytes/access list to this secret

type SecretsFile

type SecretsFile struct {
	// TODO change to camel case for json as this is used in an API now.
	Secrets  []*Secret  `json:"secrets,omitempty"`
	Checksum []byte     `json:"checksum,omitempty"`
	Services []*Service `json:"services,omitempty"`
	// contains filtered or unexported fields
}

SecretsFile holder of secrets

func LoadOrCreateSecretsFile

func LoadOrCreateSecretsFile(file string, passphrase string) (*SecretsFile, error)

LoadOrCreateSecretsFile loads secrets from disk and decrypts them returns an error if something goes wrong in the loading process

func (*SecretsFile) HasService

func (s *SecretsFile) HasService(name string) (*Service, bool)

HasService returns true if the service name has access to any secret

func (*SecretsFile) IndexOfSecret

func (s *SecretsFile) IndexOfSecret(name string) int

IndexOfSecret find the indef of a secret in the array that matches name

func (*SecretsFile) Save

func (s *SecretsFile) Save(passphrase string) error

Save save this secrets file to disk, encrypted using the passphrase

type Service

type Service struct {
	Name   string `json:"name,omitempty"`
	Secret []byte `json:"secret,omitempty"`
}

Service encrypted bytes for a service to access a secret

Jump to

Keyboard shortcuts

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