Documentation
¶
Index ¶
- func Base64String(size int) (string, error)
- func EncryptedDataKeyID(value []byte) (uuid.UUID, bool, error)
- func HashPassword(password string) (string, error)
- func HashToken(token string) string
- func NewRandomKey(ctx context.Context, encryptor Encryptor, name string) (string, []byte, error)
- func SHA256ForMap(m map[string]string) (string, error)
- func SetProcessEncryptor(encryptor Encryptor)
- func Sign(key []byte, data []byte) string
- func VerifyPassword(hash, password string) bool
- func VerifySignature(key []byte, data []byte, signature string) error
- type ConfiguredMasterKeys
- func (k *ConfiguredMasterKeys) Has(reference string) bool
- func (k *ConfiguredMasterKeys) Unwrap(ctx context.Context, reference string, wrapped, associatedData []byte) ([]byte, error)
- func (k *ConfiguredMasterKeys) Wrap(ctx context.Context, reference string, plain, associatedData []byte) ([]byte, error)
- type DataKey
- type DataKeys
- type Encryptor
- type GCPMasterKeys
- type LocalMasterKeys
- type MasterKeys
- type NoOpEncryptor
- type VersionedEncryptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64String ¶
func HashPassword ¶ added in v0.0.18
HashPassword hashes a plaintext password using bcrypt
func NewRandomKey ¶
func SetProcessEncryptor ¶
func SetProcessEncryptor(encryptor Encryptor)
SetProcessEncryptor makes the server's initialized encryptor available to code paths that run outside dependency-injected request and worker contexts.
func VerifyPassword ¶ added in v0.0.18
VerifyPassword verifies a plaintext password against a bcrypt hash
Types ¶
type ConfiguredMasterKeys ¶
type ConfiguredMasterKeys struct {
// contains filtered or unexported fields
}
func (*ConfiguredMasterKeys) Has ¶
func (k *ConfiguredMasterKeys) Has(reference string) bool
type Encryptor ¶
type Encryptor interface {
Encrypt(context.Context, []byte, []byte) ([]byte, error)
Decrypt(context.Context, []byte, []byte) ([]byte, error)
}
func NewNoOpEncryptor ¶
func NewNoOpEncryptor() Encryptor
func ProcessEncryptor ¶
type GCPMasterKeys ¶
type GCPMasterKeys struct {
// contains filtered or unexported fields
}
GCPMasterKeys wraps data keys with the configured Cloud KMS CryptoKeys.
func NewGCPMasterKeys ¶
func NewGCPMasterKeys(ctx context.Context, configured string) (*GCPMasterKeys, error)
func (*GCPMasterKeys) Has ¶
func (k *GCPMasterKeys) Has(reference string) bool
type LocalMasterKeys ¶
type LocalMasterKeys struct {
// contains filtered or unexported fields
}
func ParseLocalMasterKeys ¶
func ParseLocalMasterKeys(configured string) (*LocalMasterKeys, error)
func (*LocalMasterKeys) Has ¶
func (k *LocalMasterKeys) Has(reference string) bool
type MasterKeys ¶
type MasterKeys interface {
Wrap(context.Context, string, []byte, []byte) ([]byte, error)
Unwrap(context.Context, string, []byte, []byte) ([]byte, error)
Has(string) bool
}
MasterKeys protects data encryption keys. A reference identifies the configured master key; it never contains secret key material.
func MasterKeysFromEnv ¶
func MasterKeysFromEnv(ctx context.Context) (MasterKeys, string, error)
type VersionedEncryptor ¶
type VersionedEncryptor struct {
// contains filtered or unexported fields
}
func NewVersionedEncryptor ¶
func NewVersionedEncryptor(keys DataKeys) *VersionedEncryptor
func (*VersionedEncryptor) WithKeys ¶
func (e *VersionedEncryptor) WithKeys(keys DataKeys) *VersionedEncryptor
Click to show internal directories.
Click to hide internal directories.