Skip to content

Commit fe29ba8

Browse files
committed
cleanup
Signed-off-by: laurentsimon <laurentsimon@google.com>
1 parent 9f20e28 commit fe29ba8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sigstore/_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ def key_id(key: PublicKey) -> KeyID:
159159

160160
return KeyID(hashlib.sha256(public_bytes).digest())
161161

162-
def hazmat_digest_to_bundle(algo: str):
163-
lookup = {"sha256": HashAlgorithm.SHA2_256}
162+
def hazmat_digest_to_bundle(algo: str) -> HashAlgorithm:
163+
lookup = {hashes.SHA256().name: HashAlgorithm.SHA2_256}
164164
if algo in lookup:
165-
return lookup[algo]
166-
return algo
165+
return HashAlgorithm(lookup[algo])
166+
return ValueError(f"unknown digest algorithm {algo}")
167167

168168
def get_digest(
169169
input_: IO[bytes],

0 commit comments

Comments
 (0)