(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func TestEncryptDecryptEmpty(t *testing.T) { |
| 75 | s := testStore(t) |
| 76 | |
| 77 | key := make([]byte, 32) |
| 78 | rand.Read(key) |
| 79 | s.SetEncryptionKey(key) |
| 80 | |
| 81 | // Empty strings should pass through |
| 82 | encrypted, err := s.encrypt("") |
| 83 | if err != nil { |
| 84 | t.Fatalf("encrypt empty: %v", err) |
| 85 | } |
| 86 | if encrypted != "" { |
| 87 | t.Errorf("expected empty, got %q", encrypted) |
| 88 | } |
| 89 | |
| 90 | decrypted, err := s.decrypt("") |
| 91 | if err != nil { |
| 92 | t.Fatalf("decrypt empty: %v", err) |
| 93 | } |
| 94 | if decrypted != "" { |
| 95 | t.Errorf("expected empty, got %q", decrypted) |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | func TestTOTPEncryptionRoundTrip(t *testing.T) { |
| 100 | s := testStore(t) |
nothing calls this directly
no test coverage detected