internal

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	VersionFormat = "%019d"
)

Variables

View Source
var (
	ErrItemNotFound   = errors.New("item couldn't be found")
	ErrNeedContext    = errors.New("could not decrypt HMAC key with KMS: the credential may require that an encryption context be provided to decrypt it")
	ErrCredNotMatched = errors.New("could not decrypt HMAC key with KMS: the encryption context provided may not match the one used when the credential was stored")
	ErrBadHMAC        = errors.New("computed HMAC does not match stored HMAC")
	ErrVersionExists  = errors.New("version already in the credential store - use the -v flag to specify a new version")
)
View Source
var (
	ErrAttemptsExceeded = errors.New("timeout while creating table")
	ErrTableExists      = errors.New("credential store table already exists")
)
View Source
var (
	ErrInvalidContext = errors.New("invalid context")
	ErrBadVersion     = errors.New("malformed version")
)
View Source
var Version = "unknown"

Functions

func Atoi

func Atoi(str string) int

func B64Decode

func B64Decode(encoded string) []byte

func B64DecodeStr

func B64DecodeStr(encoded string) string

func B64Encode

func B64Encode(decoded []byte) string

func B64EncodeStr

func B64EncodeStr(decoded string) string

func CheckVersion

func CheckVersion(version *string) error

func Crypt

func Crypt(contents, key []byte) []byte

func Digest

func Digest(message, key []byte) []byte

func HexDecode

func HexDecode(encoded string) []byte

func HexDecodeStr

func HexDecodeStr(encoded string) string

func HexEncode

func HexEncode(decoded []byte) string

func HexEncodeStr

func HexEncodeStr(decoded string) string

func JSONMarshal

func JSONMarshal(t interface{}) ([]byte, error)

func KmsDecrypt

func KmsDecrypt(svc kmsiface.KMSAPI, blob []byte, context map[string]string) ([]byte, []byte, error)

func KmsGenerateDataKey

func KmsGenerateDataKey(svc kmsiface.KMSAPI, keyID string, context map[string]string) ([]byte, []byte, []byte, error)

func LookupEnvDefault

func LookupEnvDefault(defaultVal string, envVars ...string) string

func MaxKeyLen

func MaxKeyLen(items map[*string]*string) int

func ParseContext

func ParseContext(strs []string) (map[string]string, error)

func ReadFile

func ReadFile(filename string) (string, error)

func ReadStdin

func ReadStdin() string

func ValidateHMAC

func ValidateHMAC(message, digest, key []byte) bool

func VersionNumToStr

func VersionNumToStr(version int) string

Types

type Driver

type Driver struct {
	Ddb dynamodbiface.DynamoDBAPI
	Kms kmsiface.KMSAPI
}

func NewDriver

func NewDriver() (*Driver, error)

func (*Driver) CreateDdbTable

func (driver *Driver) CreateDdbTable(table string) error

func (*Driver) CreateTable

func (driver *Driver) CreateTable(table string) error

func (*Driver) DecryptMaterial

func (driver *Driver) DecryptMaterial(name string, material map[string]*dynamodb.AttributeValue, context map[string]string) (string, error)

func (*Driver) DeleteItem

func (driver *Driver) DeleteItem(name, version, table string) error

func (*Driver) DeleteSecrets

func (driver *Driver) DeleteSecrets(name, version, table string) error

func (*Driver) GetDeleteTargetWithVersion

func (driver *Driver) GetDeleteTargetWithVersion(name, version, table string) (map[*string]*string, error)

func (*Driver) GetDeleteTargetWithoutVersion

func (driver *Driver) GetDeleteTargetWithoutVersion(name, table string) (map[*string]*string, error)

func (*Driver) GetHighestVersion

func (driver *Driver) GetHighestVersion(name, table string) (int, error)

func (*Driver) GetMaterialWithVersion

func (driver *Driver) GetMaterialWithVersion(name, version, table string) (map[string]*dynamodb.AttributeValue, error)

func (*Driver) GetMaterialWithoutVersion

func (driver *Driver) GetMaterialWithoutVersion(name, table string) (map[string]*dynamodb.AttributeValue, error)

func (*Driver) GetSecret

func (driver *Driver) GetSecret(name, version, table string, context map[string]string) (string, error)

func (*Driver) IsTableExists

func (driver *Driver) IsTableExists(table string) (bool, error)

func (*Driver) ListSecrets

func (driver *Driver) ListSecrets(table string) (map[*string]*string, error)

func (*Driver) PutItem

func (driver *Driver) PutItem(name, version string, key, contents, hmac []byte, table string) error

func (*Driver) PutSecret

func (driver *Driver) PutSecret(name, secret, version, kmsKey, table string, context map[string]string) error

func (*Driver) WaitUntilTableExists

func (driver *Driver) WaitUntilTableExists(table string) error

Directories

Path Synopsis
Package mockaws is a generated GoMock package.
Package mockaws is a generated GoMock package.

Jump to

Keyboard shortcuts

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