<commit_before>= Elections Bulletin Board

[CAUTION]
====
This is a work in progress and is not fully working yet.
====

In order to celebrate https://en.wikipedia.org/wiki/End-to-end_auditable_voting_systems[End-to-end auditable votings] using the Elections module, you will need to connect your Decidim instance with an instance of the https://github.com/decidim/decidim-bulletin-board/[Decidim Bulletin Board application], preferably run by an independent organization.

== Identification pair of keys generation

The first step needed to setup the connection is to generate an a pair of keys to identify the application against the Bulletin Board.
This can be done running the following rake task in your application environment:

[source,sh]
----
bundle exec rake decidim_elections:generate_identification_keys
----

This task will output the generated private and public keys. You should copy the public key and send it to the Bulletin Board administrator through a secure channel. Together with the key, send your *Authority name* to the Bulletin Board administrator and store its value on the environment variable `AUTHORITY_NAME`.

After that, copy the private key and store that value on the environment variable `AUTHORITY_PRIVATE_KEY`.

Ensure that the private key is not lost between deployments and servers reboots and that only can be accessed by the application.

== Configuration of the Bulletin Board application

The Bulletin Board administrator will store the received public key in their server and will send you back an API key.
To complete the setup process you should store this API key and the Bulletin Board URL address on the environment variables `AUTHORITY_API_KEY` and `BULLETIN_BOARD_SERVER`, respectively.

The following YAML snippet with all the defined environment variables should be used in the `default` block of your application `config/secrets.yml` file.
Maybe this is already done, as it was included in the Decidim applications generator during the development of the Elections module.

[source,yaml]
----
  elections:
    bulletin_board_server: <%= ENV["BULLETIN_BOARD_SERVER"] %>
    bulletin_board_public_key: <%= ENV["BULLETIN_BOARD_PUBLIC_KEY"] %>
    authority_api_key: <%= ENV["AUTHORITY_API_KEY"] %>
    authority_name: <%= ENV["AUTHORITY_NAME"] %>
    authority_private_key: <%= ENV["AUTHORITY_PRIVATE_KEY"] %><commit_msg>Update Bulletin Board documentation (#7572)<commit_after>= Elections Bulletin Board

[CAUTION]
====
This is a work in progress and is not fully working yet.
====

In order to celebrate https://en.wikipedia.org/wiki/End-to-end_auditable_voting_systems[End-to-end auditable votings] using the Elections module, you will need to connect your Decidim instance with an instance of the https://github.com/decidim/decidim-bulletin-board/[Decidim Bulletin Board application], preferably run by an independent organization.

== Identification pair of keys generation

The first step needed to setup the connection is to generate a pair of keys to identify the application against the Bulletin Board.
This can be done running the following rake task in your application environment:

[source,sh]
----
bundle exec rake decidim_elections:generate_identification_keys
----

This task will output the generated private and public keys. You should copy the public key and send it, together with your *Authority name* to the Bulletin Board administrator through a secure channel. Together with the key, send your *Authority name* to the Bulletin Board administrator.

After that, copy the private key and store that value on the environment variable `AUTHORITY_PRIVATE_KEY` and your *Authority name* on the variable `AUTHORITY_NAME`.

Ensure that the private key is not lost between deployments and servers reboots and that it can only be accessed by the application.

As an administrator of the Bulletin Board, you find the steps to be taken https://github.com/decidim/decidim-bulletin-board/blob/develop/decidim-bulletin_board-app/docs/setup.md#adding-an-authority-as-a-client-of-the-bulletin-board[here].

== Configuration of the Bulletin Board application

The Bulletin Board administrator will store the received public key in their server and will send you back an API key.
To complete the setup process you should store this API key and the Bulletin Board URL address on the environment variables `AUTHORITY_API_KEY` and `BULLETIN_BOARD_SERVER`, respectively.

The following YAML snippet with all the defined environment variables should be used in the `default` block of your application `config/secrets.yml` file.
Maybe this is already done, as it was included in the Decidim applications generator during the development of the Elections module.

[source,yaml]
----
  elections:
    bulletin_board_server: <%= ENV["BULLETIN_BOARD_SERVER"] %>
    bulletin_board_public_key: <%= ENV["BULLETIN_BOARD_PUBLIC_KEY"] %>
    authority_api_key: <%= ENV["AUTHORITY_API_KEY"] %>
    authority_name: <%= ENV["AUTHORITY_NAME"] %>
    authority_private_key: <%= ENV["AUTHORITY_PRIVATE_KEY"] %>
{'fraction_non_alphanumeric': 0.06580773042616452, 'fraction_numerical': 0.0007928642220019821, 'mean_word_length': 5.138686131386861, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, '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': '3519197', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1297, 'n_words': 607}