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 @@ -164,13 +164,15 @@ def key_id(key: PublicKey) -> KeyID:
164164
165165 return KeyID (hashlib .sha256 (public_bytes ).digest ())
166166
167+
167168def get_digest (input_ : IO [bytes ] | sigstore_hashes .Hashed ) -> sigstore_hashes .Hashed :
168169 if isinstance (input_ , sigstore_hashes .Hashed ):
169170 return input_
170171
171- # NOTE: Not able to check for the type `TypeError: Subscripted generics cannot be used with class and instance checks`
172- # when calling isinstance(_input, IO[bytes])
173- return sigstore_hashes .Hashed (digest = sha256_streaming (input_ ), algorithm = HashAlgorithm .SHA2_256 )
172+ return sigstore_hashes .Hashed (
173+ digest = sha256_streaming (input_ ), algorithm = HashAlgorithm .SHA2_256
174+ )
175+
174176
175177def sha256_streaming (io : IO [bytes ]) -> bytes :
176178 """
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