Skip to content

sigstore: type cleanup #1052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 24, 2024
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
2 changes: 1 addition & 1 deletion sigstore/_internal/rekor/checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@

from pydantic import BaseModel, Field, StrictStr

from sigstore._internal.trust import RekorKeyring
from sigstore._utils import KeyID
from sigstore.errors import VerificationError

if typing.TYPE_CHECKING:
from sigstore._internal.trust import RekorKeyring
from sigstore.models import LogEntry


Expand Down
5 changes: 2 additions & 3 deletions sigstore/_internal/sct.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

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

# Precertificates must have their SCT list extension filtered out.
cert_der = DERCert(cert.tbs_precertificate_bytes)
cert_der = cert.tbs_precertificate_bytes
fields.append(issuer_key_id)
else:
raise VerificationError(f"unknown SCT log entry type: {sct.entry_type!r}")
Expand Down
8 changes: 0 additions & 8 deletions sigstore/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,6 @@
"""
A newtype for `str` objects that contain base64 encoded strings.
"""
PEMCert = NewType("PEMCert", str)
"""
A newtype for `str` objects that contain PEM-encoded certificates.
"""
DERCert = NewType("DERCert", bytes)
"""
A newtype for `bytes` objects that contain DER-encoded certificates.
"""
KeyID = NewType("KeyID", bytes)
"""
A newtype for `bytes` objects that contain a key id.
Expand Down
Loading