Crypto
provide.foundation.errors.crypto
¶
TODO: Add module docstring.
Classes¶
CryptoError
¶
CryptoError(
message: str,
*,
code: str | None = None,
context: dict[str, Any] | None = None,
cause: Exception | None = None,
**extra_context: Any
)
Bases: FoundationError
Base exception for cryptographic operations.
Raised when cryptographic operations fail due to invalid inputs, key issues, signature verification failures, or other crypto-related errors.
Examples:
>>> raise CryptoError("Invalid key size", code="CRYPTO_INVALID_KEY")
>>> raise CryptoError("Signature verification failed", code="CRYPTO_VERIFY_FAILED")
Source code in provide/foundation/errors/base.py
CryptoKeyError
¶
CryptoKeyError(
message: str,
*,
code: str | None = None,
context: dict[str, Any] | None = None,
cause: Exception | None = None,
**extra_context: Any
)
Bases: CryptoError
Exception for key-related cryptographic errors.
Raised when key generation, loading, or validation fails.
Examples:
>>> raise CryptoKeyError("Private key must be 32 bytes")
>>> raise CryptoKeyError("Failed to load key from PEM format")
Source code in provide/foundation/errors/base.py
CryptoSignatureError
¶
CryptoSignatureError(
message: str,
*,
code: str | None = None,
context: dict[str, Any] | None = None,
cause: Exception | None = None,
**extra_context: Any
)
Bases: CryptoError
Exception for signature-related cryptographic errors.
Raised when signature operations (signing or verification) fail.
Examples:
>>> raise CryptoSignatureError("Signature must be 64 bytes")
>>> raise CryptoSignatureError("Invalid signature")
Source code in provide/foundation/errors/base.py
CryptoValidationError
¶
CryptoValidationError(
message: str,
*,
code: str | None = None,
context: dict[str, Any] | None = None,
cause: Exception | None = None,
**extra_context: Any
)
Bases: CryptoError
Exception for cryptographic validation failures.
Raised when validation of cryptographic inputs (keys, signatures, data) fails.
Examples:
>>> raise CryptoValidationError("Key size must be 32 bytes")
>>> raise CryptoValidationError("Invalid signature format")