Skip to content

Commit

Permalink
fulcio: remove ABC registration (#1235)
Browse files Browse the repository at this point in the history
  • Loading branch information
woodruffw authored Dec 2, 2024
1 parent 750443e commit acb4ecf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 15 deletions.
12 changes: 1 addition & 11 deletions sigstore/_internal/fulcio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ def signature(self) -> bytes:
return self.digitally_signed[4:]


# SignedCertificateTimestamp is an ABC, so register our DetachedFulcioSCT as
# virtual subclass.
SignedCertificateTimestamp.register(DetachedFulcioSCT)


class ExpiredCertificate(Exception):
"""An error raised when the Certificate is expired."""

Expand Down Expand Up @@ -294,12 +289,7 @@ def post(
)

try:
sct_json = json.loads(base64.b64decode(sct_b64).decode())
except ValueError as exc:
raise FulcioClientError from exc

try:
sct = DetachedFulcioSCT.parse_obj(sct_json)
sct = DetachedFulcioSCT.model_validate_json(base64.b64decode(sct_b64))
except Exception as exc:
# Ideally we'd catch something less generic here.
raise FulcioClientError from exc
Expand Down
4 changes: 0 additions & 4 deletions test/unit/internal/fulcio/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from cryptography.x509.certificate_transparency import (
LogEntryType,
SignatureAlgorithm,
SignedCertificateTimestamp,
Version,
)
from pydantic import ValidationError
Expand All @@ -48,9 +47,6 @@ def test_sct_hash_none(self):


class TestDetachedFulcioSCT:
def test_fulcio_sct_virtual_subclass(self):
assert issubclass(client.DetachedFulcioSCT, SignedCertificateTimestamp)

def test_fields(self):
blob = enc(b"this is a base64-encoded blob")
now = datetime.now(tz=timezone.utc)
Expand Down

0 comments on commit acb4ecf

Please sign in to comment.