xep_0454: use staticmethods where possible
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
53d38a8115
commit
82ee250295
@ -35,8 +35,8 @@ class XEP_0454(BasePlugin):
|
|||||||
description = 'XEP-0454: OMEMO Media Sharing'
|
description = 'XEP-0454: OMEMO Media Sharing'
|
||||||
dependencies = {'xep_0363'}
|
dependencies = {'xep_0363'}
|
||||||
|
|
||||||
@classmethod
|
@staticmethod
|
||||||
def encrypt(cls, input_file: Optional[IO[bytes]] = None, filename: Optional[Path] = None) -> Tuple[bytes, str]:
|
def encrypt(input_file: Optional[IO[bytes]] = None, filename: Optional[Path] = None) -> Tuple[bytes, str]:
|
||||||
"""
|
"""
|
||||||
Encrypts file as specified in XEP-0454 for use in file sharing
|
Encrypts file as specified in XEP-0454 for use in file sharing
|
||||||
|
|
||||||
@ -71,8 +71,8 @@ class XEP_0454(BasePlugin):
|
|||||||
fragment = aes_gcm_iv.hex() + aes_gcm_key.hex()
|
fragment = aes_gcm_iv.hex() + aes_gcm_key.hex()
|
||||||
return (payload, fragment)
|
return (payload, fragment)
|
||||||
|
|
||||||
@classmethod
|
@staticmethod
|
||||||
def decrypt(cls, input_file: IO[bytes], fragment: str) -> bytes:
|
def decrypt(input_file: IO[bytes], fragment: str) -> bytes:
|
||||||
"""
|
"""
|
||||||
Decrypts file-like.
|
Decrypts file-like.
|
||||||
|
|
||||||
@ -111,8 +111,8 @@ class XEP_0454(BasePlugin):
|
|||||||
|
|
||||||
return plain
|
return plain
|
||||||
|
|
||||||
@classmethod
|
@staticmethod
|
||||||
def format_url(cls, url: str, fragment: str) -> str:
|
def format_url(url: str, fragment: str) -> str:
|
||||||
"""Helper to format a HTTPS URL to an AESGCM URI"""
|
"""Helper to format a HTTPS URL to an AESGCM URI"""
|
||||||
if not url.startswith('https://') or url.find('#') != -1:
|
if not url.startswith('https://') or url.find('#') != -1:
|
||||||
raise InvalidURL
|
raise InvalidURL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user