mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-21 10:47:34 -05:00
Signed-off-by: Christian Mesh <christianmesh1@gmail.com> Signed-off-by: yottta <andrei.ciobanu@opentofu.org> Co-authored-by: yottta <andrei.ciobanu@opentofu.org> Co-authored-by: Martin Atkins <mart@degeneration.co.uk>
49 lines
1.0 KiB
Go
49 lines
1.0 KiB
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package unencrypted
|
|
|
|
import (
|
|
"github.com/opentofu/opentofu/internal/encryption/config"
|
|
"github.com/opentofu/opentofu/internal/encryption/method"
|
|
)
|
|
|
|
func New() method.Descriptor {
|
|
return &descriptor{}
|
|
}
|
|
|
|
type descriptor struct{}
|
|
|
|
func (f *descriptor) ID() method.ID {
|
|
return "unencrypted"
|
|
}
|
|
func (f *descriptor) ConfigStruct() method.Config {
|
|
return new(methodConfig)
|
|
}
|
|
|
|
type methodConfig struct{}
|
|
|
|
func (c *methodConfig) Build() (method.Method, error) {
|
|
return new(unenc), nil
|
|
}
|
|
|
|
type unenc struct{}
|
|
|
|
func (a *unenc) Encrypt(data []byte) ([]byte, error) {
|
|
panic("Placeholder for type check! Should never be called!")
|
|
}
|
|
func (a *unenc) Decrypt(data []byte) ([]byte, error) {
|
|
panic("Placeholder for type check! Should never be called!")
|
|
}
|
|
|
|
func Is(m method.Method) bool {
|
|
_, ok := m.(*unenc)
|
|
return ok
|
|
}
|
|
|
|
func IsConfig(m config.MethodConfig) bool {
|
|
return m.Type == "unencrypted"
|
|
}
|