Skip to main content

Super Invitation flow for Synapse Matrix Homeserver

GitHub CI status main PyPI - Version

Provides extended support for users to invite other users to rooms via an invitation token

Installation

From the virtual environment that you use for Synapse, install this module with:

pip install path/to/synapse-super-invites

(If you run into issues, you may need to upgrade pip first, e.g. by running pip install --upgrade pip)

Then alter your homeserver configuration, adding to your modules configuration:

modules:
  - module: synapse_super_invites.SynapseSuperInvites
    config:
      sql_url: "sqlite:///data/super_invites.db"
      generate_registration_token: true # default: false - whether or not the invite tokens are also usable as registration tokens
      enable_web: true # default: false - not yet ready web/html management app

Using [the ansible script]

If you are using the awesome matrix-docker-ansible-deploy suite by spantaleev (thanks, mate! Great work!), you can install and configure module by setting the following to your vars.yml for the corresponding server:

# make sure we build a custom docker image for synapse
matrix_synapse_container_image_customizations_enabled: true
# install the super invites with pip
matrix_synapse_container_image_customizations_dockerfile_body_custom: |
  RUN pip install synapse_super_invites

# add super-invites to the modules and configure it
matrix_synapse_modules:
  - module: "synapse_super_invites.SynapseSuperInvites"
    config:
      sql_url: "sqlite://///matrix-media-store-parent/super_invites.db"
      generate_registration_token: true

This creates a super_invites database persistent across restarts and docker rebuilds, you can find in /matrix/synapse/storage on your host.

Confirming

You can confirm the installation went well by trying to access the path /_synapse/client/super_invites/tokens on your matrix server. If the module is available this will return with a 401 with errCode: M_MISSING_TOKEN. If it isn't available you will get a 404 with "errcode: "M_UNRECOGNIZED".

Usage

Changelog

0.8.4 - 2024-09-03:

  • [Fix] DMs are encrypted of course, with tests.

0.8.3 - 2024-05-28:

  • [Fix] Skip room if adding fails, but continue with adding to the others, track errors in db

0.8.2 - 2024-05-11:

  • Support for receiving info about a token without redeeming it, #2
  • Fix to mark DMs as direct (includes tests), #7
  • Fix for pyproject URLs, #1, thanks to @HarHarLinks
  • Allow API caller to not disable registration token creation
  • Clean up types

0.8.1 - 2023-11-24:

  • ensure deleted tokens stay unaccessible -- also to the owner

0.8.0 - 2023-11-24:

  • documentation about how to use this with the docker-ansible-scripts
  • roadmap info added

0.8.0b3 - 2023-11-17:

  • Migration file inclusion

0.8.0b2 - 2023-11-17:

  • Fix broken import of resource.*

0.8.0b1 - 2023-11-17:

  • First attempt at releasing

Roadmap

What is missing for a 1.0?

  • Allow room-admins to know about all SuperInviteTokens for the given room
  • Web-Frontend to allow anyone to use this (is this even possible?)

Development

In a virtual environment with pip ≥ 21.1, run

pip install -e .[dev]

To run the unit tests, you can either use:

tox -e py

To run the linters and mypy type checker, use ./scripts-dev/lint.sh.

Generating new db version

Make your changes in model/, then run:

alembic revision --autogenerate -m "Description message"

Metadata

Release files for synapse-super-invites 0.8.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for synapse-super-invites 0.8.4
File Size Uploaded Provenance
synapse_super_invites-0.8.4.tar.gz 24.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for synapse-super-invites 0.8.4
File Interpreter ABI Platform
synapse_super_invites-0.8.4-py3-none-any.whl Python 3 none any Details

Total release size: 45.9 kB

Release files / synapse_super_invites-0.8.4.tar.gz

Download URL synapse_super_invites-0.8.4.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
37909cdb11881a6f77e587151cff95223deef9a74153437a8a53fbcd3e836ccd
BLAKE2b-256 checksum
How to use checksums
31e6c2d3732d9ce5b90f44d767391bef1a2b544cfae9f7c97e7b4da33d54d9ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Release files / synapse_super_invites-0.8.4-py3-none-any.whl

Download URL synapse_super_invites-0.8.4-py3-none-any.whl
Size 21.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d06961bfd76ed5b1276df90eeb5f4d616e8ce180e2d4fb6965556087d53ef6a
BLAKE2b-256 checksum
How to use checksums
972669fbea45c1f11a60272e85fb5966af5ee2a893288184e81a7c912755c6f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.5

Security for synapse-super-invites 0.8.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page