= 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]. *Note*: The connected Bulletin Board instance is used by all organizations, therefore it is recommended to set it up 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"] %> scheme_name: <%= ENV["ELECTIONS_SCHEME_NAME"] %> number_of_trustees: <%= ENV["ELECTIONS_NUMBER_OF_TRUSTEES"] %> quorum: <%= ENV["ELECTIONS_QUORUM"] %> ---- After restarting the Decidim instance, administrator users will be able to create elections on the configured Bulletin Board. == Scheduled tasks A *crontab* line must be added to your server to be able to open and close the Ballot Box for the elections automatically. You could use https://github.com/javan/whenever[Whenever] to manage it directly from the APP. You probably want to schedule a `bundle exec rake decidim_elections:scheduled_tasks` every hour.