Skip to content

Commit f3d5d60

Browse files
authored
sigstore: type cleanup (#1052)
Signed-off-by: William Woodruff <william@trailofbits.com>
1 parent c5a0201 commit f3d5d60

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

sigstore/_internal/rekor/checkpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727

2828
from pydantic import BaseModel, Field, StrictStr
2929

30-
from sigstore._internal.trust import RekorKeyring
3130
from sigstore._utils import KeyID
3231
from sigstore.errors import VerificationError
3332

3433
if typing.TYPE_CHECKING:
34+
from sigstore._internal.trust import RekorKeyring
3535
from sigstore.models import LogEntry
3636

3737

sigstore/_internal/sct.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737

3838
from sigstore._internal.trust import CTKeyring
3939
from sigstore._utils import (
40-
DERCert,
4140
KeyID,
4241
cert_is_ca,
4342
key_id,
@@ -56,7 +55,7 @@ def _pack_signed_entry(
5655
#
5756
# [0]: opaque ASN.1Cert<1..2^24-1>
5857
pack_format = "!BBB{cert_der_len}s"
59-
cert_der = DERCert(cert.public_bytes(encoding=serialization.Encoding.DER))
58+
cert_der = cert.public_bytes(encoding=serialization.Encoding.DER)
6059
elif sct.entry_type == LogEntryType.PRE_CERTIFICATE:
6160
if not issuer_key_id or len(issuer_key_id) != 32:
6261
raise VerificationError("API misuse: issuer key ID missing")
@@ -68,7 +67,7 @@ def _pack_signed_entry(
6867
pack_format = "!32sBBB{cert_der_len}s"
6968

7069
# Precertificates must have their SCT list extension filtered out.
71-
cert_der = DERCert(cert.tbs_precertificate_bytes)
70+
cert_der = cert.tbs_precertificate_bytes
7271
fields.append(issuer_key_id)
7372
else:
7473
raise VerificationError(f"unknown SCT log entry type: {sct.entry_type!r}")

sigstore/_utils.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@
5656
"""
5757
A newtype for `str` objects that contain base64 encoded strings.
5858
"""
59-
PEMCert = NewType("PEMCert", str)
60-
"""
61-
A newtype for `str` objects that contain PEM-encoded certificates.
62-
"""
63-
DERCert = NewType("DERCert", bytes)
64-
"""
65-
A newtype for `bytes` objects that contain DER-encoded certificates.
66-
"""
6759
KeyID = NewType("KeyID", bytes)
6860
"""
6961
A newtype for `bytes` objects that contain a key id.

0 commit comments

Comments
 (0)