kopia lustrzana https://gitlab.com/jaywink/federation
Actually implement matrix build_send
rodzic
6d1304ab68
commit
602c576aec
|
@ -1,12 +1,9 @@
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from typing import Callable, Tuple, Union, Dict
|
from typing import Callable, Tuple, List, Dict
|
||||||
|
|
||||||
# noinspection PyPackageRequirements
|
from federation.entities.matrix.entities import MatrixEntityMixin
|
||||||
from Crypto.PublicKey.RSA import RsaKey
|
|
||||||
|
|
||||||
from federation.entities.mixins import BaseEntity
|
|
||||||
from federation.types import UserType, RequestType
|
from federation.types import UserType, RequestType
|
||||||
from federation.utils.text import decode_if_bytes
|
from federation.utils.text import decode_if_bytes
|
||||||
|
|
||||||
|
@ -45,17 +42,16 @@ class Protocol:
|
||||||
request = None
|
request = None
|
||||||
user = None
|
user = None
|
||||||
|
|
||||||
def build_send(self, entity: BaseEntity, from_user: UserType, to_user_key: RsaKey = None) -> Union[str, Dict]:
|
# noinspection PyUnusedLocal
|
||||||
|
@staticmethod
|
||||||
|
def build_send(entity: MatrixEntityMixin, *args, **kwargs) -> List[Dict]:
|
||||||
"""
|
"""
|
||||||
Build POST data for sending out to the homeserver.
|
Build POST data for sending out to the homeserver.
|
||||||
|
|
||||||
:param entity: The outbound ready entity for this protocol.
|
:param entity: The outbound ready entity for this protocol.
|
||||||
:param from_user: The user sending this payload. Must have ``private_key`` and ``id`` properties.
|
:returns: list of payloads
|
||||||
:param to_user_key: (Optional) Public key of user we're sending a private payload to.
|
|
||||||
:returns: dict or string depending on if private or public payload.
|
|
||||||
"""
|
"""
|
||||||
# TODO TBD
|
return entity.payloads()
|
||||||
return {}
|
|
||||||
|
|
||||||
def extract_actor(self):
|
def extract_actor(self):
|
||||||
# TODO TBD
|
# TODO TBD
|
||||||
|
|
Ładowanie…
Reference in New Issue