- Description
- Requirements
- Running
- Docker Setup
- API docs
- Adding devices queue
- Incoming messages queue
- Bridge setups
- Schemas
- Notes
MacOS (M-series)
brew install libolm
export LIBRARY_PATH="/opt/homebrew/lib:$LIBRARY_PATH"
export CPATH="/opt/homebrew/include:$CPATH"Configure self signing in bridge to avoid error:
failed to decrypt megolm event: no session with given ID found
bridge.conf file:
encryption > self_sign = trueShortMesh Client is a Matrix protocol client that provides messaging capabilities across multiple Matrix bridges.
The project is built to work with any Matrix homeserver and any number of Matrix bridges can be configured to work on it.
- A running Matrix homeserver
- Bridges configured on homeserver which can be activated in the conf.yaml file
- RabbitMQ
- golang
- swagger
go install github.com/swaggo/swag/cmd/swag@latest
go get github.com/swaggo/http-swagger
go get github.com/swaggo/files # optional, but useful for serving the swagger files
export PATH=$PATH:$(go env GOPATH)/bin- libolm
Mac OS
brew install libolm
export CGO_CFLAGS="-I/opt/homebrew/include"
export CGO_LDFLAGS="-L/opt/homebrew/lib"Ubuntu
sudo apt install libolm-devYou can configure the bridges supported by your Homeserver in conf.yaml. The client would try to create Rooms and synchronize for your users for every Bridge it comes across in conf.yaml.
For signal to work please make sure your homeserver is set to put phone numbers in topic
network:
...in_topics: trueYou can modify the conf.yaml file after you make a copy. Place in the following:
homeserverhomeserver_domainmas_client_idmas_client_secretdb_key #should be a high entropy string
cp conf.yaml.example conf.yaml
swag init
go mod tidy
go run .# Build
docker build -t matrix-client .
# Run
docker run -d --name matrix-client -p 8080:8080 \
-v $(pwd)/db:/app/db \
-v $(pwd)/downloads:/app/downloads \
-v $(pwd)/conf.yaml:/app/conf.yaml \
matrix-client
# View logs
docker logs -f matrix-clientversion: '3.8'
services:
rabbitmq:
image: rabbitmq:3-management-alpine
ports:
- "5672:5672"
- "15672:15672"
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
matrix-client:
build: .
ports:
- "8080:8080"
volumes:
- ./db:/app/db
- ./downloads:/app/downloads
- ./conf.yaml:/app/conf.yaml
environment:
- HOST=0.0.0.0
- PORT=8080
depends_on:
- rabbitmqdocker-compose up -d
# View logs
docker-compose logs -f matrix-clientYou can configure your API address in conf.yaml. This would be same address you can access your generated swagger API docs.
swag init[host]/docs/index.html
The incoming messages for adding devices routed to the queue:
exchange: "bridges.topic"
binding key: "bridges.topic.add_new_device"
queue name: {username}_add_new_deviceThe incoming messages are routed to the queue:
exchange: "contacts.topic"
binding key: "contacts.topic.incoming_messages"
queue name: {username}_incoming_messages{
"IsContact": true|false,
"Type": "",
"From": "",
"To": "",
"Message": "",
"DeviceId": "",
"Media": {
"Content": bytes,
"Info": {
"Size": 0 # float64 (Double),
"MimeType": "",
"Width": 0,
"Height": 0,
"BlurHash": ""
}
}
}server {
listen 443 ssl http2;
server_name matrix.example.com;
ssl_certificate /etc/letsencrypt/live/matrix.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/matrix.example.com/privkey.pem;
client_max_body_size 50M;
# IMPORTANT: MAS SHOULD COME BEFORE SYNAPSE FOR REGEX NGINX REASONS
# MAS-backed client auth routes
location ~ ^/_matrix/client/(v3|v1)/(login|logout|refresh|auth_metadata|capabilities) {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Synapse endpoints
location ~ ^(/_matrix|/_synapse/client|/_synapse/mas) {
proxy_pass http://127.0.0.1:8008;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
# .well-known
location /.well-known/matrix/ {
alias /var/www/matrix/.well-known/matrix/;
default_type application/json;
add_header Access-Control-Allow-Origin *;
}
}.well-known/client
{
"m.homeserver": {
"base_url": "https://matrix.example.com"
},
"org.matrix.msc2965.authentication": {
"issuer": "https://auth.example.com/",
"account": "https://auth.example.com/account/"
}
}configuration
services:
matrix-auth-service:
image: ghcr.io/element-hq/matrix-authentication-service:latest
container_name: matrix-auth-service
environment:
- MAS_CONFIG=/app/config/config.yaml
ports:
- "8080:8080"
- "8081:8081" # health endpoint
volumes:
- ./config.yaml:/app/config/config.yaml:ro
restart: unless-stopped
network_mode: "host"config.yaml
http:
listeners:
- name: web
resources:
- name: discovery
- name: human
- name: oauth
- name: compat
- name: graphql
- name: assets
binds:
# - address: '[::]:8080'
- host: 0.0.0.0
port: 8080
proxy_protocol: false
- name: internal
resources:
- name: health
binds:
- host: localhost
port: 8081
proxy_protocol: false
trusted_proxies:
- 192.168.0.0/16
- 172.16.0.0/12
- 10.0.0.0/10
- 127.0.0.1/8
- fd00::/8
- ::1/128
public_base: https://auth.example.com/
issuer: https://auth.example.com/
...
matrix:
kind: synapse
homeserver: matrix.example.com
endpoint: https://matrix.sherlockwisdom.com/
secret: R8PHHknWdVHIsIgUODRuFcN9XYINtrNO
account:
password_registration_enabled: true
password_recovery_enabled: true
account_deactivation_allowed: true
login_with_email_allowed: true- When the user logs in on new device, all synced devices get logged out