MCPcopy
hub / github.com/ory/kratos / testAllWork

Function testAllWork

cipher/cipher_test.go:86–103  ·  view source on GitHub ↗
(ctx context.Context, t *testing.T, c cipher.Cipher)

Source from the content-addressed store, hash-verified

84}
85
86func testAllWork(ctx context.Context, t *testing.T, c cipher.Cipher) {
87 message := "my secret message!"
88
89 encryptedSecret, err := c.Encrypt(ctx, []byte(message))
90 require.NoError(t, err)
91
92 decryptedSecret, err := c.Decrypt(ctx, encryptedSecret)
93 require.NoError(t, err, "encrypted", encryptedSecret)
94 assert.Equal(t, message, string(decryptedSecret))
95
96 // data to encrypt return blank result
97 _, err = c.Encrypt(ctx, []byte(""))
98 require.NoError(t, err)
99
100 // empty encrypted data return blank
101 _, err = c.Decrypt(ctx, "")
102 require.NoError(t, err)
103}

Callers 1

TestCipherFunction · 0.85

Calls 2

EncryptMethod · 0.65
DecryptMethod · 0.65

Tested by

no test coverage detected