Setup and Configuration
Docker setup and configuration to simulate inabit approvals remotely on your server
Last updated
Was this helpful?
Docker setup and configuration to simulate inabit approvals remotely on your server
Last updated
Was this helpful?
This standalone project is designed to be deployed on a user's own server, enabling integration with inabit from remote.
Its primary purpose is to facilitate the approval of pending transactions within a gated approvals flow. This is essentially replacing an owner/approver's mobile approvals app, allowing users to control approvals on their server.
Upon running, the application must successfully initialize and communicate with Inabit. This involves several steps depending on the initiation state. In other words, this means that there is difference between the first run of the Approver app and subsequent (recurring) runs.
During the first run, the Approver app is approved by the owner, and the pairing process is completed. In subsequent (recurring) runs, the application can proceed with handling pending transactions as expected.
Assuming you received all the details from our representatives, and You start the Approver app docker as described, so then During the first run, a pairing process is initiated.
The Approver app will do these steps:
Logging into Inabit using the provided login token, that you will receive from our team.
Validating the user's current state.
Requesting a pairing code.
Producing an encrypted key used for signing, saving it to a mapped volume.
Sending pairing data to Inabit and requesting the 'Owner' to authorize the approver. **After this step, you will need to get the the pairing code from the docker logs, and pass it to the owner of your Inabit account for pairing completion.
Refreshing the login token i.e. acquiring automatically a new valid login token.
If anything goes wrong during the initiation stage, the approver initiation process will be aborted.
For subsequent runs, after validating that the user is paired, the application continues its operation as usual.
You must have an active account at inabit.com
.
In that account, there must be 2 existing users, with the following roles: A. apiAdmin
user. B. apiSigner
user.
These users are created in your Inabit account by our representatives.
You have received a login token that is related to your "apiSigner" user. This token should have been provided to you by our representatives.
Please verify that host can access api.inabit.com
server (whitelisted IPs and ports).
Please be aware that for completion of the process, you will need interact with your inabit account owner.
Before you begin, ensure all prerequisites are met, and that you have the login token provided by our representatives.
Then, run this in terminal (linux).
Now, Open app.env
file in your text editor, and change the following values:
APPROVER_URL - set here the URL of your app. This URL is the URL that this approver app is hosted on. Means - it will get http requests on this URL, from inabit.com
servers.
SECRET - set here a long secret.
ORGANIZATION_NAME - set here your organization name.
APPROVER_CREATOR_EMAIL - set here your email.
Then save the file, and close the editor.
After the file is ready, build the docker, and run it with the following commands :
Now the last step, you should get the the pairing token from the docker logs. In order to do it, run the following:
Pass this code to your owner.
Ask the owner to open the inabit app on their smartphone. They should have already received a notification from the inabit app requesting approval for the new Approver.
The owner should tap on the notification and enter the provided code when prompted.
After this step is done, you are ready to go!
The next step to do is to create your API Wallet.
If you would like to get deep knowledge, you can read the rest of this document.
From within the root directory inabit/inabit-remote
:
The login token is an approver's token valid for 30 days, allowing authentication with Inabit.
The token is automatically refreshed, i.e. switched to a new 30 days valid token,
on:
each docker init.
every 15 days (configurable)
The refreshed login token is saved to a mapped volume on host machine.
The login token must be mapped to a selected location in the host filesystem for initialization and persistency.
Create a folder named refresh
.
Set into the folder the login token file r.dat
(which includes the login token).
Map the folder in the docker-compose.prod.yml
:
Add the following environment variables in correspondence:
Provide the required configurations by mapping an external environment file (e.g., app.env
) into the container using Docker Compose volumes. Create this file at the project root (e.g., by copying apps/approver/.env.example
to app.env
as shown in the Quick Setup).
Important: Remove any .env
file from the project root or within the apps/approver
directory to prevent conflicts with this Docker Compose volume mapping method.
app.env
via Docker Compose volumesAdd a volume mapping to your approver
service in docker-compose.prod.yml
to map your host's app.env
to the container's expected .env
file location.
Example (docker-compose.prod.yml
):
Key Points:
Host File: The example uses app.env
on your host machine.
Container Target: The application inside the container typically expects /app/apps/approver/.env
.
Configuration Source: Rely solely on the mapped app.env
file for these configurations to avoid confusion.
The approvers' key must be mapped to a selected location in the host filesystem for persistency. This is the required combination of env variables:
In the Docker Compose file:
Ensure Correspondence
Ensure there is correspondence between the volume mapping and the selected KEY_FILE_PATH
settings. The volume mapping in the Docker Compose file should reflect the chosen KEY_FILE_PATH
for persisting the encrypted key:
On Docker init , it is first checked if the approver is in status Paired
or WaitingForApproval
.
If not, a pairing flow starts:
Within the flow interaction with Inabit,
a pairing data is exchanged with Inabit including the public signing key of the approver.
an approval message is sent to the owner of the organization.
a pairing code is produced in the approver start up log trace, please copy it, and deliver it securely to the owner for pairing process completion.
On a transaction creation in Inabit, Inabit will send a request to the this Approver application, to handle the requested transaction approval, and sign on the approve/reject decision.
In order to handle transaction approvals:
Approver needs to be in Paired
status.
Configure an external validation url ('endpoint'), implementing the Approver's required approval logics:
The external validation endpoint is expected to expose a 'post' http endpoint for validation purpose.
*connectivity to the endpoint must be enabled.
The endpoint will automatically be passed a TransactionValidationData
json object at the body of the http 'post' call. with the following structure:
The endpoint is expected to return a response with the following structure:
In case of an exception a retry will be scheduled to execute in 3 minutes time, up to 10 times (10 * 3 minutes).
On receiving a validation url call response, a signed approval (using Approver's key) will be sent back automatically to Inabit, for further processing (policy enforcement).
Instead of an external validation URL, you can configure the Approver to use its own internal validation logic.
1. Mock Validation:
It is also possible to mock external validation url using a predefined endpoint (transaction/validate
) on the Approver, and control the required outcome. Using the following configuration
2. Internal Whitelist Validation:
The Approver app includes an endpoint to validate transactions against the whitelist.csv
file. To use this, set the VALIDATION_CALLBACK_URL
to point to this internal endpoint:
This endpoint will check if the transaction's destination address is present in the whitelist.csv
file.
Whitelist Management (whitelist.csv):
The whitelist.csv
file is used to maintain a list of approved destination addresses for transactions. If you configure the Approver to use internal whitelist validation, transactions to addresses not in this file will be rejected.
Structure:
The whitelist.csv
file should be a CSV file with three columns: address
, network
, and coin
. The first line must be the header. For example:
Configuration:
Set the following environment variables to configure the whitelist:
Volume Mapping:
To ensure the whitelist.csv
file is persisted and accessible to the Docker container, map it as a volume in your docker-compose.prod.yml
file.
Create a folder named whitelist
in the apps/approver
directory (i.e., /whitelist
). Place your whitelist.csv
file inside this folder.
Then, map this folder in the docker-compose.prod.yml
:
Ensure the WHITELIST_CSV_PATH
environment variable corresponds to the path used inside the container.
INABIT_API_BASE_URL - should be: