From cb33b4f0aa058943eb5eb3e8a860ed774ad464ef Mon Sep 17 00:00:00 2001 From: lollerfirst Date: Mon, 9 Sep 2024 11:50:46 +0200 Subject: [PATCH] explicit utf-8 encoding --- cashu/lightning/lnmarkets.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cashu/lightning/lnmarkets.py b/cashu/lightning/lnmarkets.py index c6dd471d..cd99ca6c 100644 --- a/cashu/lightning/lnmarkets.py +++ b/cashu/lightning/lnmarkets.py @@ -112,14 +112,14 @@ async def get_request_headers(self, method: Method, path: str, data: dict) -> di signature = base64.b64encode( hmac.new( - self.secret.encode(), - f"{timestamp}{str(method)}{path}{params}".encode(), # bytes from utf-8 string + self.secret.encode("utf-8"), + f"{timestamp}{str(method)}{path}{params}".encode("utf-8"), # bytes from utf-8 string hashlib.sha256, ).digest() ) headers = self.headers.copy() headers["LNM-ACCESS-TIMESTAMP"] = str(timestamp) - headers["LNM-ACCESS-SIGNATURE"] = signature.decode() + headers["LNM-ACCESS-SIGNATURE"] = signature.decode("utf-8") if method == Method.POST: headers["Content-Type"] = "application/json" return headers