Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ lint.select = [
"FURB", # refurb
"I", # isort
"PERF", # performance
"PIE", # flake8-pie
"PT018", # pytest style
"PTH", # pathlib
"Q", # flake8-quotes
Expand Down
2 changes: 0 additions & 2 deletions src/otdf_python/autoconfigure_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ def __hash__(self):
class AutoConfigureException(Exception):
"""Exception for auto-configuration errors."""

pass


class AttributeNameFQN:
"""Fully qualified attribute name."""
Expand Down
1 change: 0 additions & 1 deletion src/otdf_python/collection_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class NoOpCollectionStore(CollectionStore):

def store(self, header, key: CollectionKey):
"""Discard key operation (no-op)."""
pass

def get_key(self, header) -> CollectionKey:
return self.NO_PRIVATE_KEY
Expand Down
6 changes: 0 additions & 6 deletions src/otdf_python/ecdh.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,14 @@
class ECDHError(Exception):
"""Base exception for ECDH operations."""

pass


class UnsupportedCurveError(ECDHError):
"""Raised when an unsupported curve is specified."""

pass


class InvalidKeyError(ECDHError):
"""Raised when a key is invalid or malformed."""

pass


def get_curve(curve_name: str) -> ec.EllipticCurve:
"""Get the cryptography curve object for a given curve name.
Expand Down
8 changes: 0 additions & 8 deletions src/otdf_python/nanotdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,18 @@
class NanoTDFException(SDKException):
"""Base exception for NanoTDF operations."""

pass


class NanoTDFMaxSizeLimit(NanoTDFException):
"""Exception for NanoTDF size limit exceeded."""

pass


class UnsupportedNanoTDFFeature(NanoTDFException):
"""Exception for unsupported NanoTDF features."""

pass


class InvalidNanoTDFConfig(NanoTDFException):
"""Exception for invalid NanoTDF configuration."""

pass


class NanoTDF:
"""NanoTDF reader and writer for compact TDF format."""
Expand Down
2 changes: 0 additions & 2 deletions src/otdf_python/nanotdf_ecdsa_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
class IncorrectNanoTDFECDSASignatureSize(Exception):
"""Exception raised when the signature size is incorrect."""

pass


@dataclass
class NanoTDFECDSAStruct:
Expand Down
2 changes: 1 addition & 1 deletion src/otdf_python/nanotdf_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ECCurve(Enum):

SECP256R1 = "secp256r1"
SECP384R1 = "secp384r1"
SECP521R1 = "secp384r1"
SECP521R1 = "secp521r1"
SECP256K1 = "secp256k1"

def __str__(self):
Expand Down
16 changes: 0 additions & 16 deletions src/otdf_python/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ def get_key_cache(self) -> Any:

def close(self):
"""Close resources associated with KAS interface."""
pass

def __exit__(self, exc_type, exc_val, exc_tb):
self.close()
Expand Down Expand Up @@ -219,7 +218,6 @@ def kas(self) -> KAS:

def close(self):
"""Close resources associated with the services."""
pass

def __exit__(self, exc_type, exc_val, exc_tb):
self.close()
Expand Down Expand Up @@ -377,23 +375,15 @@ def is_tdf(data: bytes | BinaryIO) -> bool:
class SplitKeyException(SDKException):
"""Throw when SDK encounters error related to split key operations."""

pass

class DataSizeNotSupported(SDKException):
"""Throw when user attempts to create TDF larger than maximum size."""

pass

class KasInfoMissing(SDKException):
"""Throw during TDF creation when no KAS information is present."""

pass

class KasPublicKeyMissing(SDKException):
"""Throw during encryption when SDK cannot retrieve public key for KAS."""

pass

class TamperException(SDKException):
"""Base class for exceptions related to signature mismatches."""

Expand All @@ -407,18 +397,12 @@ class RootSignatureValidationException(TamperException):
class SegmentSignatureMismatch(TamperException):
"""Throw when segment signature does not match expected value."""

pass

class KasBadRequestException(SDKException):
"""Throw when KAS returns bad request response."""

pass

class KasAllowlistException(SDKException):
"""Throw when KAS allowlist check fails."""

pass

class AssertionException(SDKException):
"""Throw when an assertion validation fails."""

Expand Down
8 changes: 2 additions & 6 deletions src/otdf_python/sdk_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ def set_platform_endpoint(self, endpoint: str) -> "SDKBuilder":

"""
# Normalize the endpoint URL
if endpoint and not (
endpoint.startswith("http://") or endpoint.startswith("https://")
):
if endpoint and not (endpoint.startswith(("http://", "https://"))):
if self.use_plaintext:
endpoint = f"http://{endpoint}"
else:
Expand All @@ -143,9 +141,7 @@ def set_issuer_endpoint(self, issuer: str) -> "SDKBuilder":

"""
# Normalize the issuer URL
if issuer and not (
issuer.startswith("http://") or issuer.startswith("https://")
):
if issuer and not (issuer.startswith(("http://", "https://"))):
issuer = f"https://{issuer}"

self.issuer_endpoint = issuer
Expand Down
2 changes: 1 addition & 1 deletion tests/test_nanotdf_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_eccurve(self):
"""Test ECCurve enum values."""
self.assertEqual(str(ECCurve.SECP256R1), "secp256r1")
self.assertEqual(str(ECCurve.SECP384R1), "secp384r1")
self.assertEqual(str(ECCurve.SECP521R1), "secp384r1")
self.assertEqual(str(ECCurve.SECP521R1), "secp521r1")
self.assertEqual(str(ECCurve.SECP256K1), "secp256k1")

def test_protocol(self):
Expand Down
1 change: 0 additions & 1 deletion tests/test_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def close(self):

def __exit__(self, exc_type, exc_val, exc_tb):
"""Exit context manager."""
pass


def test_sdk_init_and_close():
Expand Down
Loading