Encryption: De-duplicate encryption code with extensible service (#52472)
* Encryption: De-duplicate encryption code with extensible service * Fix Wire injections * Fix tests * Register reload handler
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package encryption
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func Test_KeyToBytes(t *testing.T) {
|
||||
t.Run("with regular secret", func(t *testing.T) {
|
||||
key, err := KeyToBytes("secret", "salt")
|
||||
require.NoError(t, err)
|
||||
assert.Len(t, key, 32)
|
||||
})
|
||||
|
||||
t.Run("with very long secret", func(t *testing.T) {
|
||||
key, err := KeyToBytes("a very long secret key that is larger then 32bytes", "salt")
|
||||
require.NoError(t, err)
|
||||
assert.Len(t, key, 32)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user