MCPcopy Create free account
hub / github.com/github/gh-aw / TestEncryptWithPublicKey

Function TestEncryptWithPublicKey

pkg/cli/secret_set_command_test.go:68–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func TestEncryptWithPublicKey(t *testing.T) {
69 // Valid 32-byte public key in base64
70 validKey := "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUY="
71 plaintext := "my-secret-value"
72
73 encrypted, err := encryptWithPublicKey(validKey, plaintext)
74 if err != nil {
75 t.Fatalf("encryptWithPublicKey() error = %v", err)
76 }
77
78 if encrypted == "" {
79 t.Error("encryptWithPublicKey() returned empty string")
80 }
81
82 // The encrypted value should be different from the plaintext
83 if encrypted == plaintext {
84 t.Error("encrypted value should differ from plaintext")
85 }
86}
87
88func TestEncryptWithPublicKeyInvalidKey(t *testing.T) {
89 tests := []struct {

Callers

nothing calls this directly

Calls 2

encryptWithPublicKeyFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected