Documentation
¶
Overview ¶
Package providertest provides shared test helpers for encryption.Provider implementations. It eliminates duplication of common contract tests across provider packages.
Index ¶
- func AssertCloseBlocksAllOperations(t *testing.T, p encryption.Provider)
- func AssertDecryptDataKeyError(t *testing.T, p encryption.Provider, keyID string)
- func AssertDecryptError(t *testing.T, p encryption.Provider, keyID string)
- func AssertEncryptError(t *testing.T, p encryption.Provider, keyID string)
- func AssertGenerateDataKeyBasics(t *testing.T, p encryption.Provider, keyID string) *encryption.DataKey
- func AssertGenerateDataKeyError(t *testing.T, p encryption.Provider, keyID string)
- func AssertRevokeMakesDecryptFail(t *testing.T, p encryption.Provider, keyID string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertCloseBlocksAllOperations ¶
func AssertCloseBlocksAllOperations(t *testing.T, p encryption.Provider)
AssertCloseBlocksAllOperations verifies that after Close(), all Provider methods return ErrProviderClosed.
func AssertDecryptDataKeyError ¶
func AssertDecryptDataKeyError(t *testing.T, p encryption.Provider, keyID string)
AssertDecryptDataKeyError verifies that DecryptDataKey returns ErrDecryptionFailed.
func AssertDecryptError ¶
func AssertDecryptError(t *testing.T, p encryption.Provider, keyID string)
AssertDecryptError verifies that Decrypt returns ErrDecryptionFailed.
func AssertEncryptError ¶
func AssertEncryptError(t *testing.T, p encryption.Provider, keyID string)
AssertEncryptError verifies that Encrypt returns ErrEncryptionFailed.
func AssertGenerateDataKeyBasics ¶
func AssertGenerateDataKeyBasics(t *testing.T, p encryption.Provider, keyID string) *encryption.DataKey
AssertGenerateDataKeyBasics verifies GenerateDataKey returns a valid DataKey with 32-byte plaintext, non-empty ciphertext, and the correct key ID.
func AssertGenerateDataKeyError ¶
func AssertGenerateDataKeyError(t *testing.T, p encryption.Provider, keyID string)
AssertGenerateDataKeyError verifies that GenerateDataKey returns ErrEncryptionFailed.
func AssertRevokeMakesDecryptFail ¶ added in v1.1.3
func AssertRevokeMakesDecryptFail(t *testing.T, p encryption.Provider, keyID string)
AssertRevokeMakesDecryptFail verifies the core crypto-shred property for any Revocable provider: after a key is revoked, data and DEKs encrypted under it can no longer be decrypted. This is the property that actually delivers the GDPR right to erasure, so every provider (not just local) must satisfy it. keyID must exist and be live when called.
Types ¶
This section is empty.