(t *testing.T)
| 225 | } |
| 226 | |
| 227 | func TestMasterKey_EncryptIfNeeded(t *testing.T) { |
| 228 | key, err := MasterKeyFromRecipient(mockRecipient) |
| 229 | assert.NoError(t, err) |
| 230 | |
| 231 | assert.NoError(t, key.EncryptIfNeeded([]byte(mockEncryptedKeyPlain))) |
| 232 | |
| 233 | encryptedKey := key.EncryptedKey |
| 234 | assert.Contains(t, encryptedKey, "AGE ENCRYPTED FILE") |
| 235 | |
| 236 | assert.NoError(t, key.EncryptIfNeeded([]byte("some other data"))) |
| 237 | assert.Equal(t, encryptedKey, key.EncryptedKey) |
| 238 | } |
| 239 | |
| 240 | func TestMasterKey_EncryptedDataKey(t *testing.T) { |
| 241 | key := &MasterKey{EncryptedKey: "some key"} |
nothing calls this directly
no test coverage detected