Skip to content

Commit

Permalink
fix(verify_sign): fix _verify_sign function in action handler
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaschan-osl committed Jul 8, 2024
1 parent 05ccf87 commit ebf4360
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lark_oapi/card/action_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def _verify_sign(self, request: RawRequest) -> None:
timestamp = request.headers.get(LARK_REQUEST_TIMESTAMP)
nonce = request.headers.get(LARK_REQUEST_NONCE)
signature = request.headers.get(LARK_REQUEST_SIGNATURE)
bs = (timestamp + nonce + self._verification_token).encode(UTF_8) + request.body
h = hashlib.sha1(bs)
bs = (timestamp + nonce + self._encrypt_key).encode(UTF_8) + request.body
h = hashlib.sha256(bs)
if signature != h.hexdigest():
raise AccessDeniedException("signature verification failed")

Expand Down

0 comments on commit ebf4360

Please sign in to comment.