File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -141,13 +141,15 @@ def key_id(key: PublicKey) -> KeyID:
141141
142142 return KeyID (hashlib .sha256 (public_bytes ).digest ())
143143
144+
144145def get_digest (input_ : IO [bytes ] | sigstore_hashes .Hashed ) -> sigstore_hashes .Hashed :
145146 if isinstance (input_ , sigstore_hashes .Hashed ):
146147 return input_
147148
148- # NOTE: Not able to check for the type `TypeError: Subscripted generics cannot be used with class and instance checks`
149- # when calling isinstance(_input, IO[bytes])
150- return sigstore_hashes .Hashed (digest = sha256_streaming (input_ ), algorithm = HashAlgorithm .SHA2_256 )
149+ return sigstore_hashes .Hashed (
150+ digest = sha256_streaming (input_ ), algorithm = HashAlgorithm .SHA2_256
151+ )
152+
151153
152154def sha256_streaming (io : IO [bytes ]) -> bytes :
153155 """
Original file line number Diff line number Diff line change 1-
21# Copyright 2023 The Sigstore Authors
32#
43# Licensed under the Apache License, Version 2.0 (the "License");
You can’t perform that action at this time.
0 commit comments