From fd5eec14a960d096e1e8c70d6a5cacb89a99c347 Mon Sep 17 00:00:00 2001 From: Lasse Yledahl Date: Tue, 8 Oct 2024 09:20:31 +0000 Subject: [PATCH] check for return type on info method --- src/eduid/vccs/server/hasher.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/eduid/vccs/server/hasher.py b/src/eduid/vccs/server/hasher.py index e998ed9de..b19505696 100644 --- a/src/eduid/vccs/server/hasher.py +++ b/src/eduid/vccs/server/hasher.py @@ -66,8 +66,12 @@ def unlock(self, password: str) -> None: self._yhsm.unlock(unhexlify(password)) def info(self) -> str: + # pyhsm.base.YHSM.info() returns bytes(?) ret: bytes = self._yhsm.info() - return ret.decode() + if isinstance(ret, bytes): + return ret.decode() + else: + return ret async def hmac_sha1(self, key_handle: int | None, data: bytes) -> bytes: """