github.com/trustbloc/kms-go@v1.1.2/secretlock/noop/noop_secret_lock_test.go (about)

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  SPDX-License-Identifier: Apache-2.0
     4  */
     5  
     6  package noop
     7  
     8  import (
     9  	"testing"
    10  
    11  	"github.com/stretchr/testify/require"
    12  
    13  	"github.com/trustbloc/kms-go/spi/secretlock"
    14  )
    15  
    16  func TestNoLock(t *testing.T) {
    17  	noopLock := NoLock{}
    18  
    19  	ct, err := noopLock.Encrypt("", &secretlock.EncryptRequest{
    20  		Plaintext: "testKey",
    21  	})
    22  	require.NoError(t, err)
    23  	require.Equal(t, ct.Ciphertext, "testKey")
    24  
    25  	pt, err := noopLock.Decrypt("", &secretlock.DecryptRequest{
    26  		Ciphertext: "testKey",
    27  	})
    28  	require.NoError(t, err)
    29  	require.Equal(t, pt.Plaintext, "testKey")
    30  }