mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-22 19:24:37 -05:00
Signed-off-by: AbstractionFactory <179820029+abstractionfactory@users.noreply.github.com>
28 lines
690 B
Go
28 lines
690 B
Go
// Copyright (c) The OpenTofu Authors
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Package xor contains a key provider that combines two other keys.
|
|
package xor
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/opentofu/opentofu/internal/encryption/keyprovider"
|
|
)
|
|
|
|
type xorKeyProvider struct {
|
|
key keyprovider.Output
|
|
}
|
|
|
|
func (p xorKeyProvider) Provide(meta keyprovider.KeyMeta) (keyprovider.Output, keyprovider.KeyMeta, error) {
|
|
if meta != nil {
|
|
return keyprovider.Output{}, nil, &keyprovider.ErrInvalidMetadata{
|
|
Message: fmt.Sprintf("bug: metadata provider despite none being required: %T", meta),
|
|
}
|
|
}
|
|
|
|
return p.key, nil, nil
|
|
}
|