Fix RSA object usage in type hints

It seems little-boxes replaced our crypto library which caused
a bit of a mayhem since some of the internal objects don't match.
If we need that library after all, will need to drop these type
hints.
merge-requests/131/head
Jason Robinson 2018-07-31 23:55:37 +03:00
rodzic dc988add94
commit db049c6638
2 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -2,7 +2,7 @@ import json
import logging
from typing import List, Tuple, Union
from Crypto.PublicKey.RSA import RsaKey
from Crypto.PublicKey.RSA import _RSAobj
from federation.entities.diaspora.mappers import get_outbound_entity
from federation.entities.mixins import BaseEntity
@ -15,7 +15,7 @@ logger = logging.getLogger("federation")
def handle_create_payload(
entity:BaseEntity, author_user:UserType, to_user_key:RsaKey=None, parent_user:UserType=None) -> str:
entity:BaseEntity, author_user:UserType, to_user_key:_RSAobj=None, parent_user:UserType=None) -> str:
"""Create a payload with the correct protocol.
Any given user arguments must have ``private_key`` and ``handle`` attributes.
@ -41,7 +41,7 @@ def handle_create_payload(
def handle_send(
entity: BaseEntity,
author_user: UserType,
recipients: List[Union[Tuple[str, RsaKey], str]]=None,
recipients: List[Union[Tuple[str, _RSAobj], str]]=None,
parent_user: UserType=None,
) -> None:
"""Send an entity to remote servers.

Wyświetl plik

@ -4,7 +4,7 @@ from base64 import urlsafe_b64decode
from typing import Callable, Tuple, Union, Dict
from urllib.parse import unquote
from Crypto.PublicKey.RSA import RsaKey
from Crypto.PublicKey.RSA import _RSAobj
from lxml import etree
from federation.entities.mixins import BaseEntity
@ -122,7 +122,7 @@ class Protocol:
raise NoSenderKeyFoundError("Could not find a sender contact to retrieve key")
MagicEnvelope(doc=self.doc, public_key=sender_key, verify=True)
def build_send(self, entity:BaseEntity, from_user:UserType, to_user_key:RsaKey=None) -> Union[str, Dict]:
def build_send(self, entity:BaseEntity, from_user:UserType, to_user_key:_RSAobj=None) -> Union[str, Dict]:
"""
Build POST data for sending out to remotes.