|
10 | 10 | from django.conf import settings |
11 | 11 | from pydantic import BaseModel, ConfigDict, Field |
12 | 12 | from pydantic.alias_generators import to_snake |
13 | | -from pypi_attestations import ( |
14 | | - Distribution, |
15 | | - Envelope, |
16 | | - Publisher, |
17 | | - VerificationError, |
18 | | - VerificationMaterial, |
19 | | -) |
| 13 | +from pypi_attestations import Attestation as _UpstreamAttestation |
| 14 | +from pypi_attestations import Distribution, Publisher, VerificationError, VerificationMaterial |
20 | 15 | from sigstore.dsse import Envelope as DSSEEnvelope |
21 | 16 | from sigstore.dsse import _pae |
22 | 17 |
|
@@ -57,24 +52,20 @@ def _as_policy(self): |
57 | 52 | ExtendedPublisher = Annotated[_ExtendedPublisherUnion, Field(union_mode="left_to_right")] |
58 | 53 |
|
59 | 54 |
|
60 | | -class Attestation(BaseModel): |
61 | | - """Attestation object as defined in PEP 740.""" |
62 | | - |
63 | | - version: Literal[1] |
| 55 | +class Attestation(_UpstreamAttestation): |
64 | 56 | """ |
65 | | - The attestation format's version, which is always 1. |
| 57 | + Attestation object as defined in PEP 740. |
| 58 | +
|
| 59 | + Inherits from the upstream pypi_attestations.Attestation to keep Sigstore |
| 60 | + verification methods (to_bundle, verify), but makes verification_material |
| 61 | + optional to support attestations signed with a custom key instead of Sigstore. |
66 | 62 | """ |
67 | 63 |
|
68 | 64 | verification_material: VerificationMaterial | None = None |
69 | 65 | """ |
70 | 66 | Cryptographic materials used to verify `message_signature`. |
71 | 67 | """ |
72 | 68 |
|
73 | | - envelope: Envelope |
74 | | - """ |
75 | | - The enveloped attestation statement and signature. |
76 | | - """ |
77 | | - |
78 | 69 |
|
79 | 70 | class AttestationBundle(BaseModel): |
80 | 71 | """ |
|
0 commit comments