37
37
from sigstore ._internal import tuf
38
38
from sigstore ._internal .rekor import _hashedrekord_from_parts
39
39
from sigstore ._internal .rekor .client import RekorClient
40
+ from sigstore ._internal .trust import ClientTrustConfig
40
41
from sigstore ._utils import sha256_digest
41
42
from sigstore .models import Bundle
42
43
from sigstore .oidc import _DEFAULT_AUDIENCE , IdentityToken
@@ -188,10 +189,20 @@ def sign_ctx_and_ident_for_env(
188
189
pytestconfig ,
189
190
env : str ,
190
191
) -> tuple [type [SigningContext ], type [IdentityToken ]]:
192
+ """
193
+ Returns a SigningContext and IdentityToken for the given environment.
194
+ The SigningContext is behind a callable so that it may be lazily evaluated.
195
+ """
191
196
if env == "staging" :
192
- ctx_cls = SigningContext .staging
197
+
198
+ def ctx_cls ():
199
+ return SigningContext .from_trust_config (ClientTrustConfig .staging ())
200
+
193
201
elif env == "production" :
194
- ctx_cls = SigningContext .production
202
+
203
+ def ctx_cls ():
204
+ return SigningContext .from_trust_config (ClientTrustConfig .production ())
205
+
195
206
else :
196
207
raise ValueError (f"Unknown env { env } " )
197
208
@@ -205,7 +216,14 @@ def sign_ctx_and_ident_for_env(
205
216
206
217
@pytest .fixture
207
218
def staging () -> tuple [type [SigningContext ], type [Verifier ], IdentityToken ]:
208
- signer = SigningContext .staging
219
+ """
220
+ Returns a SigningContext, Verifier, and IdentityToken for the staging environment.
221
+ The SigningContext and Verifier are both behind callables so that they may be lazily evaluated.
222
+ """
223
+
224
+ def signer ():
225
+ return SigningContext .from_trust_config (ClientTrustConfig .staging ())
226
+
209
227
verifier = Verifier .staging
210
228
211
229
# Detect env variable for local interactive tests.
0 commit comments