1
0
mirror of https://github.com/sniptt-official/ots.git synced 2025-12-02 22:38:20 +02:00

fix(test): fix test config and add test to ci workflow (#9)

This commit is contained in:
Slavo Vojacek
2021-07-31 19:28:38 +01:00
committed by GitHub
parent a3fa8a7a25
commit 74f3abc73c
6 changed files with 19 additions and 13 deletions

View File

@@ -13,19 +13,25 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package encrypt
package encrypt_test
import (
"crypto/aes"
"crypto/cipher"
"strings"
"testing"
"github.com/sniptt-official/ots/crypto/encrypt"
)
func TestBytes(t *testing.T) {
unencryptedSecret := "nuclear_launch_codes"
encryptedBytes, err := Bytes(nil, []byte(unencryptedSecret))
encryptedBytes, err := encrypt.Bytes([]byte(unencryptedSecret))
if err != nil {
t.Fatalf(err.Error())
}
ciphertext, key, nonce := encryptedBytes.Ciphertext, encryptedBytes.Key, encryptedBytes.Nonce
ciphertext = ciphertext[len(nonce):] // Remove nonce from start of ciphertext.