Sign inSign up

xomoxcc/minimatrix

By xomoxcc

Updated 6 months ago

Image
0

1.9K

xomoxcc/minimatrix repository overview

black-lint mypy and pytests BuildAndPushMultiarch Cumulative Clones PyPI Downloads PyPI

Gemini_Generated_Image_2bsor82bsor82bso_250x250.png

minimatrix

Standalone Matrix CLI client with E2E encryption. Send messages, listen to rooms, manage invitations, manage devices, and list joined rooms — all from the command line.

Features

  • Send encrypted messages to Matrix rooms
  • Send files — upload and send images, documents, audio, and video with automatic MIME type detection and E2E encryption
  • Listen for incoming messages in real-time (prints to stdout)
  • List joined rooms with display names and member counts
  • Manage invites — list pending invitations and accept individually or auto-join on startup
  • Device management — list, purge orphaned devices, and import E2E keys from old crypto stores
  • Session caching — persists Matrix access tokens to avoid re-authentication on every run
  • E2E encryption via matrix-nio with persistent crypto store and device reuse
  • TOFU device trust — automatically trusts all devices in a room
  • Multiple auth methods: password, SSO, or JWT via Keycloak (ROPC + JWKS)
  • Flexible config: YAML file, environment variables, and CLI args (in ascending priority)

Quick Start

docker run --rm xomoxcc/minimatrix:latest
Usage Examples
# List joined rooms and pending invites
minimatrix --user myuser --password mypass --homeserver https://matrix.example.com rooms

# List and accept invitations
minimatrix --user myuser --password mypass invites
minimatrix --user myuser --password mypass invites accept --room '!abc:example.com'

# Send a message
minimatrix --user myuser --password mypass send --room '!abc:example.com' "Hello!"

# Send a file (or multiple with repeated -f)
minimatrix --user myuser --password mypass send --room '!abc:example.com' --file /path/to/image.png
minimatrix --user myuser --password mypass send --room '!abc:example.com' -f photo.jpg -f doc.pdf "Check these!"

# Listen for messages
minimatrix --user myuser --password mypass listen --room '!abc:example.com'

# Manage devices
minimatrix --user myuser --password mypass devices
minimatrix --user myuser --password mypass devices purge
minimatrix --user myuser --password mypass devices import-keys --delete-old-stores

Or use a config file at ~/.config/minimatrix/config.yaml:

homeserver: "https://matrix.example.com"
user: "myuser"
password: "mypassword"

Configuration

VariableDescriptionDefault
MATRIX_HOMESERVERMatrix homeserver URLhttp://synapse.matrix.svc.cluster.local:8008
MATRIX_USERMatrix username (required)
MATRIX_PASSWORDMatrix password (required)
CRYPTO_STORE_PATHPath for E2E encryption crypto store~/.local/share/minimatrix/crypto_store
AUTH_METHODAuth method (password, sso, or jwt)password
AUTO_JOINAuto-accept pending room invitations on startupfalse
LOGURU_LEVELLog verbosity (DEBUG, INFO, WARNING, ...)DEBUG
JWT Authentication (Keycloak)

Set AUTH_METHOD=jwt to authenticate via Keycloak ROPC grant instead of direct Matrix password login.

VariableDescriptionDefault
KEYCLOAK_URLKeycloak base URL (required if jwt)
KEYCLOAK_REALMKeycloak realm name (required if jwt)
KEYCLOAK_CLIENT_IDKeycloak client ID (required if jwt)
KEYCLOAK_CLIENT_SECRETKeycloak client secret""
JWT_LOGIN_TYPEMatrix login type for JWT authcom.famedly.login.token.oauth

Requires synapse-token-authenticator on the Synapse side. See the README for a full setup guide.

Image Details

  • Base: python:3.14-slim-trixie
  • Non-root user (pythonuser)
  • Entrypoint: tini --
  • Multi-arch: linux/amd64, linux/arm64

Building the Image

# Simple local build
docker build -t minimatrix .

# Multi-arch build & push (via GitHub Actions or local script)
./repo_scripts/build-container-multiarch.sh

License

This project is licensed under the LGPL where applicable/possible — see LICENSE.md. Some files/parts may use other licenses: MIT | GPL | LGPL. Always check per‑file headers/comments.

Authors

  • Repo owner (primary author)
  • Additional attributions are noted inline in code comments

Acknowledgments

  • Inspirations and snippets are referenced in code comments where appropriate.

⚠️ Note

This is a development/experimental project. For production use, review security settings, customize configurations, and test thoroughly in your environment. Provided "as is" without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software. Use at your own risk.

Tag summary

Content type

Image

Digest

sha256:a19716027

Size

200.3 MB

Last updated

6 months ago

docker pull xomoxcc/minimatrix