Initial split version of this repo

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent 8dbfc140
# https://raw.githubusercontent.com/github/gitignore/master/Python.gitignore
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
Contributing to the Slixmpp project
===================================
To contribute, the preferred way is to commit your changes on some
publicly-available git repository (on a fork `on gitlab
<https://lab.louiz.org/poezio/slixmpp-omemo>`_ or on your own
repository) and to notify the developers with either:
- a ticket `on the bug tracker <https://dev.poez.io/new>`_
- a pull request on gitlab
- a simple message on `the XMPP MUC <xmpp:slixmpp@muc.poez.io>`_
Even though Slixmpp’s github repository is just a read-only mirror, we can
still be notified of the pull requests and fetch your mirror manually to
integrate your changes.
This diff is collapsed.
Slixmpp OMEMO plugin
####################
This library provides an interface to `python-omemo <https://github.com/syndace/python-omemo>`_.
License
-------
This plugin is licensed under GPLv3.
The python-omemo library being used is a reimplementation of libsignal
in python and plans to stay away from the GPL license as possible. For
the moment, the OMEMO library has to reuse parts of the original
libsignal implementation, (the wireformat), which makes it GPL. Efforts
are being made in order to not have to reuse these libsignal bits, and
move to a more permissive license.
As long as this is not the case, this plugin will stay GPLv3 as well,
and it will not be possible to merge it without changing Slixmpp's
license itself.
Note on the underlying OMEMO library
------------------------------------
As stated in `python-xeddsa's
README <https://github.com/Syndace/python-xeddsa/blob/136b9f12c8286b9463566308963e70f090b60e50/README.md>`_,
(dependency of python-omemo), this library has not undergone any
security audits. If you have the knowledge, any help is welcome.
Please take this into consideration when using this library.
Installation
------------
- ArchLinux (AUR):
`python-slixmpp-omemo <https://aur.archlinux.org/packages/python-slixmpp-omemo>`_, or
`python-slixmpp-omemo-git <https://aur.archlinux.org/packages/python-slixmpp-omemo-git>`_
- PIP: `slixmpp-omemo`
- Manual: `python3 setup.py install`
Credits
-------
For the help on OMEMO:
- Syndace
- Daniel Gultsch (`gultsch.de <https://gultsch.de/>`_)
And on Slixmpp:
- Mathieu Pasquet (`mathieui@mathieui.net <xmpp:mathieui@mathieui.net?message>`_)
- Emmanuel Gil Peyrot (`Link mauve <xmpp:linkmauve@linkmauve.fr?message>`_)
"""
Slixmpp: The Slick XMPP Library
Copyright (C) 2018 Maxime “pep” Buquet <pep@bouah.net>
This file is part of Slixmpp.
See the file LICENSE for copying permission.
"""
from slixmpp.plugins.base import register_plugin
from slixmpp.plugins.xep_0384.plugin import XEP_0384
from slixmpp.plugins.xep_0384 import stanza
register_plugin(XEP_0384)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Slixmpp OMEMO plugin
Copyright (C) 2019 Maxime “pep” Buquet <pep@bouah.net>
This file is part of slixmpp-omemo.
See the file LICENSE for copying permission.
"""
import os
from importlib.machinery import PathFinder
from typing import Optional
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def find_version(load_path, name) -> Optional[str]:
"""Find module version"""
module = None
spec = PathFinder.find_spec(name, load_path)
try:
module = spec.loader.load_module(name)
except (AttributeError, ImportError, SyntaxError):
return None
if module is None:
return None
for key in dir(module):
if key != '__version__':
continue
return getattr(module, key)
return None
MODULE_FILE_PATH = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'slixmpp_omemo',
)
VERSION = find_version(MODULE_FILE_PATH, 'version')
DESCRIPTION = ('Slixmpp OMEMO plugin')
with open('README.rst', encoding='utf8') as readme:
LONG_DESCRIPTION = readme.read()
CLASSIFIERS = [
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Internet :: XMPP',
'Topic :: Security :: Cryptography',
'Topic :: Software Development :: Libraries :: Python Modules',
]
setup(
name="slixmpp-omemo",
version=VERSION,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
author='Maxime Buquet',
author_email='pep@bouah.net',
url='https://lab.louiz.org/poezio/slixmpp-omemo',
license='GPLv3',
platforms=['any'],
install_requires=['slixmpp', 'omemo'],
classifiers=CLASSIFIERS,
)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Slixmpp: The Slick XMPP Library
Copyright (C) 2018 Maxime “pep” Buquet <pep@bouah.net>
This file is part of Slixmpp.
Slixmpp OMEMO plugin
Copyright (C) 2019 Maxime “pep” Buquet <pep@bouah.net>
This file is part of slixmpp-omemo.
See the file LICENSE for copying permission.
"""
......@@ -14,15 +17,17 @@ import os
import json
import base64
import asyncio
from slixmpp.plugins.xep_0384.stanza import OMEMO_BASE_NS
from slixmpp.plugins.xep_0384.stanza import OMEMO_DEVICES_NS, OMEMO_BUNDLES_NS
from slixmpp.plugins.xep_0384.stanza import Bundle, Devices, Device, Encrypted, Key, PreKeyPublic
from slixmpp.plugins.xep_0060.stanza import Items, EventItems
from slixmpp.plugins.base import BasePlugin
from slixmpp.plugins.base import BasePlugin, register_plugin
from slixmpp.exceptions import IqError, IqTimeout
from slixmpp.stanza import Message, Iq
from slixmpp.jid import JID
from .version import __version__, __version_info__
from .stanza import OMEMO_BASE_NS
from .stanza import OMEMO_DEVICES_NS, OMEMO_BUNDLES_NS
from .stanza import Bundle, Devices, Device, Encrypted, Key, PreKeyPublic
log = logging.getLogger(__name__)
HAS_OMEMO = True
......@@ -30,10 +35,19 @@ try:
import omemo.exceptions
from omemo import SessionManager, ExtendedPublicBundle, DefaultOTPKPolicy
from omemo.util import generateDeviceID
from omemo.implementation import JSONFileStorage
from omemo.backends import Backend
from omemo_backend_signal import BACKEND as SignalBackend
from omemo.implementation import JSONFileStorage
except (ImportError,):
class Backend:
pass
class DefaultOTPKPolicy:
pass
class SignalBackend:
pass
HAS_OMEMO = False
TRUE_VALUES = {True, 'true', '1'}
......@@ -422,3 +436,6 @@ class XEP_0384(BasePlugin):
# decide what to do with it, as there isn't much we can if
# other issues can't be resolved.
continue
register_plugin(XEP_0384)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Slixmpp: The Slick XMPP Library
Slixmpp OMEMO plugin
Copyright (C) 2018 Maxime “pep” Buquet <pep@bouah.net>
This file is part of Slixmpp.
This file is part of slixmpp-omemo.
See the file LICENSE for copying permission.
"""
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Slixmpp OMEMO plugin
Copyright (C) 2019 Maxime “pep” Buquet <pep@bouah.net>
This file is part of slixmpp-omemo.
See the file LICENSE for copying permission.
"""
__version__ = "0.1.0"
__version_info__ = (0, 1, 0)
[tox]
envlist = py35
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment