secret

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const GeneratePassword = StorePasswordGeneration(true)

GeneratePassword sets the CreateOption to generate a StorePassword

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessEntry

type AccessEntry struct {
	// TeamID is the unique ID of the team being granted permission
	TeamID string
	// TeamName is the name of the team being granted permissions.
	// If this is provided, OrgName must also be provided.
	// If TeamID is set, this does nothing.
	TeamName string
	// OrgName is the name of the org containing the TeamName to be granted access
	// Does nothing if TeamID is set
	OrgName string
	// Lavel is the level of access being granted. See AccessLevel for the types of access.
	Level AccessLevel
}

AccessEntry is an entry in the secret's ACL table

type AccessLevel

type AccessLevel int
const (
	Reader AccessLevel = iota
	Writer
	Owner
)

func (AccessLevel) String

func (o AccessLevel) String() string

type CreateOption

type CreateOption interface {
	ApplyCreateOption(opts *CreateOptions)
}

type CreateOptions

type CreateOptions struct {
	OrgName          string
	StorePassword    string
	Project          string
	Visibility       Visibility
	GeneratePassword bool
}

type CreateResponse

type CreateResponse struct {
	// ID is the unique ID of the new secret
	ID string
	// StorePassword is the StorePassword of the new secret, if one was generated by Concord
	StorePassword string
}

CreateResponse is the response of a secret creation request

type EncryptOption

type EncryptOption interface {
	ApplyEncryptOption(opts *EncryptOptions)
	// contains filtered or unexported methods
}

type EncryptOptions

type EncryptOptions struct {
	OrgName string
	Project string
}

type ExportOption

type ExportOption interface {
	ApplyExportOption(opts *ExportOptions)
	// contains filtered or unexported methods
}

type ExportOptions

type ExportOptions struct {
	OrgName       string
	StorePassword string
}

ExportOptions are optional parameters for export requests

type KeyPair

type KeyPair struct {
	// PublicKey is the public key data
	// Usually this is an OpenSSH public key: ssh-<alg> KEY-DATA COMMENT
	PublicKey []byte
	// PrivateKey is the private key data.
	// Usually this is a PEM encoded OPENSSH PRIVATE KEY
	PrivateKey []byte
}

KeyPair contains key pair data

type KeyPairFiles

type KeyPairFiles struct {
	// PublicKeyFile is the path to the public key
	PublicKeyFile string
	// PrivateKeyFile is the path to the private key
	PrivateKeyFile string
}

KeyPairFiles are a pair a file names for a keypair

type KeyPairResponse

type KeyPairResponse struct {
	// ID is the unique ID of the new secret
	ID string
	// StorePassword is the StorePassword of the new secret, if one was generated by Concord
	StorePassword string
	// PublicKey is the public key data
	// Usually this is an OpenSSH public key: ssh-<alg> KEY-DATA COMMENT
	PublicKey string
}

KeyPairResponse is the response of key-pair generation request

type Option

type Option interface {
	ApplyOption(opts *Options)
	// contains filtered or unexported methods
}

type Options

type Options struct {
	OrgName string
}

Options are optional values for a secret request

func (Options) ApplyOption

func (o Options) ApplyOption(t *Options)

type OrgName

type OrgName string

OrgName is the name of the org containing the secret

func (OrgName) ApplyCreateOption

func (o OrgName) ApplyCreateOption(opts *CreateOptions)

func (OrgName) ApplyExportOption

func (o OrgName) ApplyExportOption(spec *ExportOptions)

func (OrgName) ApplyOption

func (o OrgName) ApplyOption(spec *Options)

type Project

type Project string

Project is an option to set the project name

func (Project) ApplyCreateOption

func (o Project) ApplyCreateOption(opts *CreateOptions)

func (Project) ApplyEncryptOption

func (o Project) ApplyEncryptOption(opts *EncryptOptions)

type Service

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

Service that manages concord secrets

func NewService

func NewService(orgName string, conn grpc.ClientConnInterface) *Service

NewService creates a new service to manage secrets

func (*Service) CreateKeyPair

func (c *Service) CreateKeyPair(ctx context.Context, name string, keypair KeyPair, opts ...CreateOption) (*KeyPairResponse, error)

CreateKeyPair creates a new KeyPair secret from the given Public and Private key data

func (*Service) CreateSecretValue

func (c *Service) CreateSecretValue(ctx context.Context, name string, value []byte, opts ...CreateOption) (*CreateResponse, error)

func (*Service) CreateUsernamePassword

func (c *Service) CreateUsernamePassword(ctx context.Context, name string, usernamePassword UsernamePassword, opts ...CreateOption) (*CreateResponse, error)

CreateUsernamePassword creates a new Username/Password secret

func (*Service) DecryptString

func (c *Service) DecryptString(ctx context.Context, value string) (string, error)

DecryptString takes a string previously encrypted by EncryptString and returns the decrypted value

func (*Service) Delete

func (c *Service) Delete(ctx context.Context, name string, opts ...Option) error

Delete deletes a secret

func (*Service) EncryptString

func (c *Service) EncryptString(ctx context.Context, value string, opts ...EncryptOption) (string, error)

EncryptString encrypts a string which can be later decrypted by Concord

func (*Service) GenerateKeyPair

func (c *Service) GenerateKeyPair(ctx context.Context, name string, opts ...CreateOption) (*KeyPairResponse, error)

GenerateKeyPair generates a new SSH Public/Private Key pair, returning the public key

func (*Service) KeyPairFiles

func (c *Service) KeyPairFiles(ctx context.Context, name string, opts ...ExportOption) (*KeyPairFiles, error)

KeyPairFiles exports a KeyPair to the filesystem, returning a KeyPairFiles struct containing the path to each of those files

func (*Service) ListAccess

func (c *Service) ListAccess(ctx context.Context, name string, opts ...Option) ([]AccessEntry, error)

ListAccess returns the list of access rules for a secret

func (*Service) SecretFile

func (c *Service) SecretFile(ctx context.Context, name string, opts ...ExportOption) (string, error)

SecretFile exports a single-value data secret into a file and returns the path to that file

func (*Service) SecretString

func (c *Service) SecretString(ctx context.Context, name string, opts ...ExportOption) (string, error)

SecretString exports a single-value data secret as a regular string

func (*Service) UpdateAccess

func (c *Service) UpdateAccess(ctx context.Context, name string, entries []AccessEntry, opts ...Option) error

UpdateAccess performs a bulk update of a secret's access rules

func (*Service) UsernamePassword

func (c *Service) UsernamePassword(ctx context.Context, name string, opts ...ExportOption) (*UsernamePassword, error)

UsernamePassword exports a Username+Password secret

type StorePassword

type StorePassword string

StorePassword is the password used to encrypt the secret

func (StorePassword) ApplyCreateOption

func (o StorePassword) ApplyCreateOption(opts *CreateOptions)

func (StorePassword) ApplyExportOption

func (o StorePassword) ApplyExportOption(spec *ExportOptions)

type StorePasswordGeneration

type StorePasswordGeneration bool

StorePasswordGeneration is a CreateOption to generate a StorePassword during secret creation

func (StorePasswordGeneration) ApplyCreateOption

func (o StorePasswordGeneration) ApplyCreateOption(opts *CreateOptions)

type UsernamePassword

type UsernamePassword struct {
	// Username is the username
	Username string
	// Password is the password
	Password string
}

UsernamePassword is a username/password pair

type Visibility

type Visibility int

Visibility represents the secrets visibility in Concord

const (
	Private Visibility = iota
	Public
)

func (Visibility) ApplyCreateOption

func (o Visibility) ApplyCreateOption(opts *CreateOptions)

Jump to

Keyboard shortcuts

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