Skip to content

Set up API Signer with Docker

Run a Fordefi API Signer locally with Docker desktop.

Before you start

Make sure you complete both of these pre-steps:

  • Download Docker Desktop for your system.

  • In the Fordefi console, navigate to User Management section and create an API User with the Trader role and store its access tokens securely. Learn more. The access token should start with eyJhbG... as in:

    eyJhbGciOiJFZERTQSIsImtpZCI6ImZ3MFc3aVpocUc0SUEzaXV4ZmhQIiwidHlwIjoiSldUIn0.eyJpc3MiOiJodHRwczovL2FwaS5mb3JkZWZpLmNvbS8iLCJzdWIiOiJiY2M1Zjc0Zi1hN2I1LTQ0ZWEtYWM5Mi1iMzE3YzIxZjE4MjBAZm9yZGVmaSIsImF1ZCI6WyJodHRwczovL2FwaS5mb3JkZWZpLmNvbS9hcGkvIl0sImV4cCI6MjA3MTgyMzk1NSwiaWF0IjoxNzU2NDYzOTU1LCJqdGkiOiJjYzdmYmZiYi1lOTlhLTRhMjItYTMxZC0zYWYxNjJhYzQ5NGEifQ.AhSskIoXbk-9xmomj2TpH4K2_d7evIL9uGYQIb9-nQarVaydYd9aywiMfr4lFk7SbFbRRgd0HcQF7veE7JD9Cw

Now, set up Docker.

Docker Setup

  1. Open Docker desktop, start a new terminal and install the Fordefi API Signer image from the Fordefi artifactory (see here).

    Password

    Downloading the API Signer image requires a password. View your password by clicking Settings > API Signer, then View Docker Credentials.

  2. Before you do anything else, go back to the Fordefi console, navigate to Settings > API Signer and select Add API Signer, then name your signer and click Add.

  3. Open your Fordefi mobile app - there should be an Add API signer notification in your inbox.

    alt

    Open the notification and select Activate to start the scanner on your phone.

  4. Go back to Docker, select Provision signer and scan the QR code that is displayed in the terminal with your Fordefi mobile app.

    If the QR code doesn't fit in the Docker terminal, zoom out using command + "minus sign" on your keyboard.

  5. Your API Signer logs should now display the following:

    YYYY-MM-DD INFO Provisioning completed successfully.
    
    ========================================
    ========= API-Signer Main Menu =========
    ========================================
    
    Use the arrow keys to navigate: 
    ? API-Signer is provisioned. What do you want to do?: 
       Run signer
       Show API users
      Configure signer
  6. Ensure that you have a viable API User. Steps for creating one are provided here.

  7. Extract the public key. A full PEM is required: make sure it includes the header and ending, including the BEGIN PUBLIC KEY and END PUBLIC KEY lines. and in a single continuous line, without a line break, as in:

    -----BEGIN PUBLIC KEY-----
    MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAso5ucVifivGBzaEONSo9
    WwuxCgUULQFdl9gn8h0oYMxpxwMcgKUYBZ1CXy4fQ1MkbcRf67OZEQwoVjLdcSdq
    9tkRC3cbBvtgEqliE/PWYi0xiYPScWxEJ4RCh19pu4e3zHglv3kBFFjarsOYGV/Z
    455Rc+hq5qLbGpcBBlaPd0e3HWgdHP9HE2DCY+HrIKqL/qwerW8lhLyM0X807OO1
    /7Igu4PGuhtJaQ+bGBwbn13NoOGEodCh1YR1CZsM1eLZEc0VCDKBnB1Zt6aYbVIC
    Fe4jJRTAGwuutOx6hZlHOc0TUrJ/bV3cJBgBMHKruB5Ddsr9qTpEzb8ehYy1H0XW
    4wQK0VtB92RvJqfSTVBsJWtLZCK02LwbR8s+dWaGFAY2OhyTITwIPiEjMvNHRpuv
    zhVDxYyOONCprGvYMzE7XEM+mVinIwdY3w7L/AxMm37bVp16riMBSZT8yyjgglOc
    rr5gw9A0nCLWax1gz1uys1SBMiQL2XeuE+mnNzLR2Nm4Cuw53tvmYvV+1QtLbVfQ
    Jka2iq7nOo6W4s2EpGW6srlZKTcibveIX+2otev58aW9sFKDq30eZfR6luh1eTuX
    1f9Gr5gd1m3nWMkJoIQ/2wh6kNgdq1Qku5rDRvKC0WTWJxSjBYhQzboDBBJb4l+2
    mkR3xqbk+09AThoP5LtwW4UCAwEAAQ==
    -----END PUBLIC KEY-----    


8. Then go back to Docker, select `Register API user key`, select the API User to register, and paste the public key in the field. Type `Enter` to complete the registration:


9. Finally, select `Run signer` to start your signer.

        Your signer will need to be running to sign transactions initiated by the API User that created the transaction.

**You're done!** 

To successfully transact, your API User will need to **both** authenticate with the Fordefi backend using the access token generated during its creation <!--(see [Before you start](/developers/getting-started/set-up-an-api-signer/api-signer-docker#before-you-start) --> and sign  transaction payloads with the specific `private.pem` key you generated in step 5. You can learn about both steps [here](https://docs.fordefi.com/developers/authentication) and check out our [API examples](https://github.com/FordefiHQ/api-examples) for practical code examples

Also, remember that you API Signer will need to be running to sign transactions initiated by the API User you registered.