# Vault Setup

## Connecting Vault
Currently performed by a Finmars employee at the client's request.

## Initializing Vault
### Prerequisites
- A created database with an activated license
### Actions
1. Go to `Settings -> Vault`
2. Activate Vault and save the secret keys. <br> <i>Do not lose these keys, as they cannot be recovered. If the keys are lost, the data saved in the Vault will be lost.</i>
3. Inform the Finmars employee of the Vault token

## Unseal Vault
### Prerequisites
- A created database with an activated license
- Vault initialized
### Actions
1. Go to `Settings -> Vault`
2. Click the Unseal Vault button
3. Enter the three keys one by one

## Adding Access to Proxy Server
### Prerequisites
- A created database with an activated license
- Vault initialized
- Vault unsealed
- Proxy Server deployed
### Actions
1. Go to `Settings -> Vault`
2. Click the `Add Engine` button
4. Enter the name `finmars`
5. Click the `Add Secret` button
6. Add the following `json` content:
```json
{
    "data_url": "{url_to_proxy_server}/md/3.0/", 
    "trading_url": "{url_to_proxy_server}/trade/3.0/",
    "api_key": "foo",
    "secret_key": "bar"
}
```
- `data_url` - URL to the proxy server's information endpoint specifying the API version - example  `https://demo-exante.finmars.com/demo/md/3.0/`
- `trading_url` - URL to the proxy server's trading endpoint (required for enriching transaction information with orders) specifying the API version - example `https://demo-exante.finmars.com/demo/trade/3.0/`
- `api_key`, `secret_key` - credentials for `basic auth` to the proxy server
7. Click the "Save" button