Giter VIP home page Giter VIP logo

maelstrom's Introduction

Maelstrom

A high-performance Matrix Home-Server written in Rust designed to have a plugable storage engine, scalable, and light on resources.

General discussion for development is at #maelstrom-server:matrix.org

Project Status

This is a brand new project under daily active development. It is not currently in usable form yet.

Completed Features

You can review the Closed matrix-spec Issues in the issue tracker for a list of completed features.

Project Goals

  1. Performance, both in terms of scale and minimal resources.
  2. From scratch design, no legacy architecture decisions.
  3. Support for embedded (Raspi, Jetson Nano, etc.) or clustered deployment with configurable storage engine (e.g. Postgres, Sqlite, Sled, etc.).
  4. First-class e2e encryption and p2p support (as Matrix.org works towards a direction).
  5. Designed for not only chat, but decentralized IoT use cases as well.
  6. SOCKS5 Proxy support to enable .onion homeservers (Relevant Synapse Issue)

Why

This project started due to a strong interest/support of Web 3.0 (decentralized web applications). Additionally, having a performant embeddable home server can enable a stronger usecase for decentralized IoT applications in addition to chat.

Building & Running

Using Rust

# install rust if needed
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# clone repo and cd
git clone https://github.com/maelstrom-rs/maelstrom.git && cd maelstrom

# copy .env-example and set with your specific settings
cp Settings-example.yml Settings.yml

# build & run
cargo run --release

Generating the AUTH_KEY

openssl ecparam -genkey -name prime256v1 | openssl pkcs8 -topk8 -nocrypt -out ec_private.pem

Make sure you set AUTH_KEY_FILE to path/to/ec_private.pem

Technologies Used

  • Actix-web A high performance webserver written in Rust
  • sqlx A rust version of the popular sqlx db library
  • jwt
  • Ruma

Similar Projects

The following are some other Rust based Home Server projects worth looking at:

  • Ruma The server isn't maintained, but he client libraries appear so.
  • Conduit A new Rust based Home Server under development.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Maelstrom by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

maelstrom's People

Contributors

dr-bonez avatar edwardvear avatar gnieto avatar sparky8251 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

maelstrom's Issues

User data: changePassword

Changes a user's password.

Changes the password for an account on this homeserver.

This API endpoint uses the User-Interactive Authentication API_ to
ensure the user changing the password is actually the owner of the
account.

An access token should be submitted to this endpoint if the client has
an active session.

The homeserver may change the flows available depending on whether a
valid access token is provided. The homeserver SHOULD NOT revoke the
access token provided in the request, however all other access tokens
for the user should be revoked if the request succeeds.

Room discovery: queryPublicRooms

Lists the public rooms on the server with optional filter.

Lists the public rooms on the server, with optional filter.

This API returns paginated responses. The rooms are ordered by the number
of joined members, with the largest rooms first.

Room membership: unban

Unban a user from the room. This allows them to be invited to the room,
and join if they would otherwise be allowed to join according to its join rules.

The caller must have the required power level in order to perform this operation.

User data: getUserProfile

Get this user's profile information.

Get the combined profile information for this user. This API may be used
to fetch the user's own profile information or other users; either
locally or on remote homeservers. This API may return keys which are not
limited to displayname or avatar_url.

Room participation: getOneEvent

Get a single event by event ID.

Get a single event based on event_id. You must have permission to
retrieve this event e.g. by being a member in the room for this event.

This endpoint was deprecated in r0 of this specification. Clients
should instead call the |/rooms/{roomId}/event/{eventId}|_ API
or the |/rooms/{roomId}/context/{eventId}|_ API.

Server administration: getWhoIs

Gets information about a particular user.

This API may be restricted to only be called by the user being looked
up, or by a server admin. Server-local administrator privileges are not
specified in this document.

Media: getContentThumbnail

Download a thumbnail of content from the content repository. See the thumbnailing <#thumbnails>_
section for more information.

Room participation: getJoinedMembersByRoom

Gets the list of currently joined users and their profile data.

This API returns a map of MXIDs to member info objects for members of the room. The current user must be in the room for it to work, unless it is an Application Service in which case any of the AS's users must be in the room. This API is primarily for Application Services and should be faster to respond than /members as it can be implemented more efficiently on the server.

Push notifications: setPushRuleActions

Set the actions for a push rule.

This endpoint allows clients to change the actions of a push rule.
This can be used to change the actions of builtin rules.

Room membership: unban

Unban a user from the room.

Unban a user from the room. This allows them to be invited to the room,
and join if they would otherwise be allowed to join according to its join rules.

The caller must have the required power level in order to perform this operation.

Session management: logout_all

Invalidates all access tokens for a user

Invalidates all access tokens for a user, so that they can no longer be used for
authorization. This includes the access token that made this request. All devices
for the user are also deleted. Device keys <#device-keys>_ for the device are
deleted alongside the device.

This endpoint does not require UI authorization because UI authorization is
designed to protect against attacks where the someone gets hold of a single access
token then takes over the account. This endpoint invalidates all access tokens for
the user, including the token used in the request, and therefore the attacker is
unable to take over the account in this way.

User data: getDisplayName

Get the user's display name.

Get the user's display name. This API may be used to fetch the user's
own displayname or to query the name of other users; either locally or
on remote homeservers.

User data: setDisplayName

Set the user's display name.

This API sets the given user's display name. You must have permission to
set this user's display name, e.g. you need to have their access_token.

Media: getContentOverrideName

Download content from the content repository. This is the same as
the download endpoint above, except permitting a desired file name.

Reporting content: reportContent

Reports an event as inappropriate.

Reports an event as inappropriate to the server, which may then notify
the appropriate people.

Room membership: leaveRoom

Stop the requesting user participating in a particular room.

This API stops a user participating in a particular room.

If the user was already in the room, they will no longer be able to see
new events in the room. If the room requires an invite to join, they
will need to be re-invited before they can re-join.

If the user was invited to the room, but had not joined, this call
serves to reject the invite.

The user will still be allowed to retrieve history from the room which
they were previously allowed to see.

Push notifications: postPusher

Modify a pusher for this user on the homeserver.

This endpoint allows the creation, modification and deletion of pushers_
for this user ID. The behaviour of this endpoint varies depending on the
values in the JSON body.

Session management: getLoginFlows

Get the supported login types to authenticate users

Gets the homeserver's supported login types to authenticate users. Clients
should pick one of these and supply it as the type when logging in.

Media: getUrlPreview

Get information about a URL for a client

Get information about a URL for the client. Typically this is called when a
client sees a URL in a message and wants to render a preview for the user.

.. Note::
Clients should consider avoiding this endpoint for URLs posted in encrypted
rooms. Encrypted rooms often contain more sensitive information the users
do not want to share with the homeserver, and this can mean that the URLs
being shared should also not be shared with the homeserver.

Device management: deleteDevices

Bulk deletion of devices

This API endpoint uses the User-Interactive Authentication API_.

Deletes the given devices, and invalidates any access token associated with them.

User data: checkUsernameAvailability

Checks to see if a username is available on the server.

Checks to see if a username is available, and valid, for the server.

The server should check to ensure that, at the time of the request, the
username requested is available for use. This includes verifying that an
application service has not claimed the username and that the username
fits the server's desired requirements (for example, a server could dictate
that it does not permit usernames with underscores).

Matrix clients may wish to use this API prior to attempting registration,
however the clients must also be aware that using this API does not normally
reserve the username. This can mean that the username becomes unavailable
between checking its availability and attempting to register it.

Server administration: getWellknown

Gets Matrix server discovery information about the domain.

Gets discovery information about the domain. The file may include
additional keys, which MUST follow the Java package naming convention,
e.g. com.example.myapp.property. This ensures property names are
suitably namespaced for each application and reduces the risk of
clashes.

Note that this endpoint is not necessarily handled by the homeserver,
but by another webserver, to be used for discovering the homeserver URL.

Room participation: roomInitialSync

Snapshot the current state of a room and its most recent messages.

Get a copy of the current state and the most recent messages in a room.

This endpoint was deprecated in r0 of this specification. There is no
direct replacement; the relevant information is returned by the
|/sync|_ API. See the migration guide <https://matrix.org/docs/guides/client-server-migrating-from-v1.html#deprecated-endpoints>_.

Session management: login

Authenticates the user, and issues an access token they can
use to authorize themself in subsequent requests.

If the client does not supply a device_id, the server must
auto-generate one.

The returned access token must be associated with the device_id
supplied by the client or generated by the server. The server may
invalidate any access token previously associated with that device. See
Relationship between access tokens and devices_.

Server administration: getVersions

Gets the versions of the specification supported by the server.

Gets the versions of the specification supported by the server.

Values will take the form rX.Y.Z.

Only the latest Z value will be reported for each supported X.Y value.
i.e. if the server implements r0.0.0, r0.0.1, and r1.2.0, it will report r0.0.1 and r1.2.0.

The server may additionally advertise experimental features it supports
through unstable_features. These features should be namespaced and
may optionally include version information within their name if desired.
Features listed here are not for optionally toggling parts of the Matrix
specification and should only be used to advertise support for a feature
which has not yet landed in the spec. For example, a feature currently
undergoing the proposal process may appear here and eventually be taken
off this list once the feature lands in the spec and the server deems it
reasonable to do so. Servers may wish to keep advertising features here
after they've been released into the spec to give clients a chance to
upgrade appropriately. Additionally, clients should avoid using unstable
features in their stable releases.

Session management: getLoginFlows

Gets the homeserver's supported login types to authenticate users. Clients
should pick one of these and supply it as the type when logging in.

Room discovery: getPublicRooms

Lists the public rooms on the server.

Lists the public rooms on the server.

This API returns paginated responses. The rooms are ordered by the number
of joined members, with the largest rooms first.

Session management: login

Authenticates the user.

Authenticates the user, and issues an access token they can
use to authorize themself in subsequent requests.

If the client does not supply a device_id, the server must
auto-generate one.

The returned access token must be associated with the device_id
supplied by the client or generated by the server. The server may
invalidate any access token previously associated with that device. See
Relationship between access tokens and devices_.

Room participation: getEventContext

Get events and state around the specified event.

This API returns a number of events that happened just before and
after the specified event. This allows clients to get the context
surrounding an event.

Note: This endpoint supports lazy-loading of room member events. See
Lazy-loading room members <#lazy-loading-room-members>_ for more information.

Room membership: forgetRoom

This API stops a user remembering about a particular room.

In general, history is a first class citizen in Matrix. After this API
is called, however, a user will no longer be able to retrieve history
for this room. If all users on a homeserver forget a room, the room is
eligible for deletion from that homeserver.

If the user is currently joined to the room, they must leave the room
before calling this API.

Room creation: createRoom

Create a new room

Create a new room with various configuration options.

The server MUST apply the normal state resolution rules when creating
the new room, including checking power levels for each event. It MUST
apply the events implied by the request in the following order:

  1. A default m.room.power_levels event, giving the room creator
    (and not other members) permission to send state events. Overridden
    by the power_level_content_override parameter.

  2. Events set by the preset. Currently these are the m.room.join_rules,
    m.room.history_visibility, and m.room.guest_access state events.

  3. Events listed in initial_state, in the order that they are
    listed.

  4. Events implied by name and topic (m.room.name and m.room.topic
    state events).

  5. Invite events implied by invite and invite_3pid (m.room.member with
    membership: invite and m.room.third_party_invite).

The available presets do the following with respect to room state:

======================== ============== ====================== ================ =========
Preset join_rules history_visibility guest_access Other
======================== ============== ====================== ================ =========
private_chat invite shared can_join
trusted_private_chat invite shared can_join All invitees are given the same power level as the room creator.
public_chat public shared forbidden
======================== ============== ====================== ================ =========

The server will create a m.room.create event in the room with the
requesting user as the creator, alongside other keys provided in the
creation_content.

Room participation: getOneRoomEvent

Get a single event by event ID.

Get a single event based on roomId/eventId. You must have permission to
retrieve this event e.g. by being a member in the room for this event.

Session management: login

Authenticates the user, and issues an access token they can
use to authorize themself in subsequent requests.

If the client does not supply a device_id, the server must
auto-generate one.

The returned access token must be associated with the device_id
supplied by the client or generated by the server. The server may
invalidate any access token previously associated with that device. See
Relationship between access tokens and devices_.

User data: searchUserDirectory

Searches the user directory.

Performs a search for users. The homeserver may
determine which subset of users are searched, however the homeserver
MUST at a minimum consider the users the requesting user shares a
room with and those who reside in public rooms (known to the homeserver).
The search MUST consider local users to the homeserver, and SHOULD
query remote users as part of the search.

The search is performed case-insensitively on user IDs and display
names preferably using a collation determined based upon the
Accept-Language header provided in the request, if present.

Room membership: forgetRoom

Stop the requesting user remembering about a particular room.

This API stops a user remembering about a particular room.

In general, history is a first class citizen in Matrix. After this API
is called, however, a user will no longer be able to retrieve history
for this room. If all users on a homeserver forget a room, the room is
eligible for deletion from that homeserver.

If the user is currently joined to the room, they must leave the room
before calling this API.

Room participation: defineFilter

Upload a new filter.

Uploads a new filter definition to the homeserver.
Returns a filter ID that may be used in future requests to
restrict which events are returned to the client.

Application service room directory management: updateAppserviceRoomDirectoryVsibility

Updates a room's visibility in the application service's room directory.

Updates the visibility of a given room on the application service's room
directory.

This API is similar to the room directory visibility API used by clients
to update the homeserver's more general room directory.

This API requires the use of an application service access token (as_token)
instead of a typical client's access_token. This API cannot be invoked by
users who are not identified as application services.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.