<commit_before>The Portier Broker reference implementation
===========================================

This is the reference implementation of the Broker side of the `Portier`_
protocol `specification`_. Feedback is welcome on `GitHub`_.

.. _Portier: https://portier.github.io/
.. _specification: protocol.md
.. _GitHub: https://github.com/portier/portier-broker


How to run your own broker
--------------------------

|HerokuDeploy|_

Portier is specified such that everyone can run their own Broker instance. You
can point your Relying Parties at your own broker, so that you do not have to
depend on the broker run by the Portier project.

Currently, this project does not ship any binaries. However, once you have the
Rust toolchain `installed`_, building portier broker is very simple:

.. code-block:: shell

   $ cargo install portier_broker

This should fetch and install the Portier broker. The binary is installed into
``~/.cargo/bin/`` by default. Running the `portier-broker` binary requires
a short configuration file. An example is provided in ``config.toml.dist``.

To run the broker, invoke it with the path to a configuration file:

.. code-block:: shell

   $ portier-broker config.toml

You can also supply all required settings as environment variables and
completely omit the configuration file.

You will also need a Redis server and an outgoing SMTP server.

.. _installed: https://doc.rust-lang.org/book/getting-started.html

.. |HerokuDeploy| image:: https://www.herokucdn.com/deploy/button.svg
.. _HerokuDeploy: https://heroku.com/deploy?template=https://github.com/eallrich/portier-broker/tree/issue-88-update

Configuration
-------------

See ``config.toml.dist`` for an example configuration file. This file includes
reasonable default values for most settings, but you must explicitly set:

* ``server.public_url``: The server's public-facing URL.
* ``crypto.keyfiles``: An array of paths to encryption keys, or
* ``crypto.keytext``: The text of an encryption key in PEM format (takes precedence over keyfiles).
* ``redis.url``: The URL of a Redis server for temporary session storage.
* ``smtp.from_address``: The email address that outgoing mail is from.
* ``smtp.server``: The host and port of the outgoing mail server.

If necessary, set ``smtp.username`` and ``smtp.password`` to your SMTP server's
username and password.

To support in-browser Google Authentication for Gmail users, you must also
specify:

* ``google.client_id``: Your Google OAuth API Client ID

You can create encryption keys with ``openssl genrsa 4096 > private.pem``

The complete list of available values are:

**[server] section:**

=============== ====================== =====================<commit_msg>Revert to issue-88 branch for deploys<commit_after>The Portier Broker reference implementation
===========================================

This is the reference implementation of the Broker side of the `Portier`_
protocol `specification`_. Feedback is welcome on `GitHub`_.

.. _Portier: https://portier.github.io/
.. _specification: protocol.md
.. _GitHub: https://github.com/portier/portier-broker


How to run your own broker
--------------------------

|HerokuDeploy|_

Portier is specified such that everyone can run their own Broker instance. You
can point your Relying Parties at your own broker, so that you do not have to
depend on the broker run by the Portier project.

Currently, this project does not ship any binaries. However, once you have the
Rust toolchain `installed`_, building portier broker is very simple:

.. code-block:: shell

   $ cargo install portier_broker

This should fetch and install the Portier broker. The binary is installed into
``~/.cargo/bin/`` by default. Running the `portier-broker` binary requires
a short configuration file. An example is provided in ``config.toml.dist``.

To run the broker, invoke it with the path to a configuration file:

.. code-block:: shell

   $ portier-broker config.toml

You can also supply all required settings as environment variables and
completely omit the configuration file.

You will also need a Redis server and an outgoing SMTP server.

.. _installed: https://doc.rust-lang.org/book/getting-started.html

.. |HerokuDeploy| image:: https://www.herokucdn.com/deploy/button.svg
.. _HerokuDeploy: https://heroku.com/deploy?template=https://github.com/eallrich/portier-broker/tree/issue-88

Configuration
-------------

See ``config.toml.dist`` for an example configuration file. This file includes
reasonable default values for most settings, but you must explicitly set:

* ``server.public_url``: The server's public-facing URL.
* ``crypto.keyfiles``: An array of paths to encryption keys, or
* ``crypto.keytext``: The text of an encryption key in PEM format (takes precedence over keyfiles).
* ``redis.url``: The URL of a Redis server for temporary session storage.
* ``smtp.from_address``: The email address that outgoing mail is from.
* ``smtp.server``: The host and port of the outgoing mail server.

If necessary, set ``smtp.username`` and ``smtp.password`` to your SMTP server's
username and password.

To support in-browser Google Authentication for Gmail users, you must also
specify:

* ``google.client_id``: Your Google OAuth API Client ID

You can create encryption keys with ``openssl genrsa 4096 > private.pem``

The complete list of available values are:

**[server] section:**

=============== ====================== =====================
{'fraction_non_alphanumeric': 0.1364887176664832, 'fraction_numerical': 0.002568336085121996, 'mean_word_length': 4.293203883495146, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 12, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1289749', 'n_tokens_mistral': 1547, 'n_tokens_neox': 1460, 'n_words': 637}