Skip to content

Commit

Permalink
explicit utf-8 encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
lollerfirst committed Sep 9, 2024
1 parent 8b9ce72 commit cb33b4f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cashu/lightning/lnmarkets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cb33b4f

Please sign in to comment.