cred

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 19 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultKey = []byte{0x24, 0x66, 0xDD, 0x87, 0x8B, 0x96, 0x3C, 0x9D}
View Source
var PasswordCipher = GetDefaultPasswordCipher()

Functions

func IsKeyEncrypted

func IsKeyEncrypted(keyPath string) bool

IsKeyEncrypted checks if supplied key content is encrypyed by password

Types

type Cipher

type Cipher interface {
	Encryptor
	Decryptor
}

func GetDefaultPasswordCipher

func GetDefaultPasswordCipher() Cipher

GetDefaultPasswordCipher return a default password cipher

func NewBlowfishCipher

func NewBlowfishCipher(key []byte) (Cipher, error)

type Config

type Config struct {
	Username          string `json:",omitempty"`
	Email             string `json:",omitempty"`
	Password          string `json:",omitempty"`
	EncryptedPassword string `json:",omitempty"`
	Endpoint          string `json:",omitempty"`

	PrivateKeyPath              string `json:",omitempty"`
	PrivateKeyPassword          string `json:",omitempty"`
	PrivateKeyEncryptedPassword string `json:",omitempty"`

	//amazon cloud credential
	Key       string `json:",omitempty"`
	Secret    string `json:",omitempty"`
	Region    string `json:",omitempty"`
	AccountID string `json:",omitempty"`
	Token     string `json:",omitempty"`
	RoleARN   string `json:",omitempty"` //to asume role

	//google cloud credential
	ClientEmail             string `json:"client_email,omitempty"`
	TokenURL                string `json:"token_url,omitempty"`
	PrivateKey              string `json:"private_key,omitempty"`
	PrivateKeyID            string `json:"private_key_id,omitempty"`
	ProjectID               string `json:"project_id,omitempty"`
	TokenURI                string `json:"token_uri"`
	Type                    string `json:"type"`
	ClientX509CertURL       string `json:"client_x509_cert_url"`
	AuthProviderX509CertURL string `json:"auth_provider_x509_cert_url"`

	//JSON string for this secret
	Data string `json:",omitempty"`
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(filename string) (*Config, error)

NewConfig create a new config for supplied file name

func (*Config) ClientConfig

func (c *Config) ClientConfig() (*ssh.ClientConfig, error)

ClientConfig returns a new instance of sshClientConfig

func (*Config) JWTConfig added in v0.26.3

func (c *Config) JWTConfig(scopes ...string) (config *jwt.Config, projectID string, err error)

JWTConfig returns jwt config and projectID

func (*Config) Load

func (c *Config) Load(filename string) error

func (*Config) LoadFromReader

func (c *Config) LoadFromReader(reader io.Reader, ext string) error

func (*Config) NewJWTConfig

func (c *Config) NewJWTConfig(scopes ...string) (*jwt.Config, error)

NewJWTConfig returns new JWT config for supplied scopes

func (*Config) SSHClientConfig

func (c *Config) SSHClientConfig() (*ssh.ClientConfig, error)

SSHClientConfig returns a new instance of sshClientConfig

func (*Config) Save

func (c *Config) Save(filename string) error

func (*Config) Write

func (c *Config) Write(writer io.Writer) error

type Decryptor

type Decryptor interface {
	Decrypt(src []byte) []byte
}

type Encryptor

type Encryptor interface {
	Encrypt(src []byte) []byte
}

Jump to

Keyboard shortcuts

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