mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 02:44:53 -04:00
Add missing type hints to synapse.util (#9982)
This commit is contained in:
parent
22a8838f62
commit
7adcb20fc0
9 changed files with 39 additions and 25 deletions
|
@ -17,15 +17,15 @@ import hashlib
|
|||
import unpaddedbase64
|
||||
|
||||
|
||||
def sha256_and_url_safe_base64(input_text):
|
||||
def sha256_and_url_safe_base64(input_text: str) -> str:
|
||||
"""SHA256 hash an input string, encode the digest as url-safe base64, and
|
||||
return
|
||||
|
||||
:param input_text: string to hash
|
||||
:type input_text: str
|
||||
Args:
|
||||
input_text: string to hash
|
||||
|
||||
:returns a sha256 hashed and url-safe base64 encoded digest
|
||||
:rtype: str
|
||||
returns:
|
||||
A sha256 hashed and url-safe base64 encoded digest
|
||||
"""
|
||||
digest = hashlib.sha256(input_text.encode()).digest()
|
||||
return unpaddedbase64.encode_base64(digest, urlsafe=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue