mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-31 01:59:58 +00:00
🎨 format code using black and isort
This commit is contained in:
@ -8,10 +8,10 @@ log = logger_wrapper("DING")
|
||||
|
||||
|
||||
def calc_hmac_base64(timestamp: str, secret: str):
|
||||
secret_enc = secret.encode('utf-8')
|
||||
string_to_sign = '{}\n{}'.format(timestamp, secret)
|
||||
string_to_sign_enc = string_to_sign.encode('utf-8')
|
||||
hmac_code = hmac.new(secret_enc,
|
||||
string_to_sign_enc,
|
||||
digestmod=hashlib.sha256).digest()
|
||||
secret_enc = secret.encode("utf-8")
|
||||
string_to_sign = "{}\n{}".format(timestamp, secret)
|
||||
string_to_sign_enc = string_to_sign.encode("utf-8")
|
||||
hmac_code = hmac.new(
|
||||
secret_enc, string_to_sign_enc, digestmod=hashlib.sha256
|
||||
).digest()
|
||||
return base64.b64encode(hmac_code)
|
||||
|
Reference in New Issue
Block a user