Examples of code to interact with Hub88 API
All examples imply that you have already generated ssl-rsa key-pair with such command:
openssl genrsa -out private.pem 2048
and extracted public key:
openssl rsa -in private.pem -pubout > public.pub
Signing:
Prerequisite:
- generate private and public key.
- send public key to Hub88 representative
Process:
- sign request body with your private key
- encode signature in base64
- put result of step 2 into header X-Hub88-Signature
- send request
Validation of signature:
Prerequisite: receive and save Hub88 public key
Process:
- receive request
- get value of X-Hub88-Signature header
- decode it from base64
- check that result of step 3 is valid for combination of this request body and Hub88 public key
We have few code examples for generating of signature and it's validation. Also priv
folder contains demo pair of private and public keys.
- Elixir
- NodeJS
- Java
- PHP
- .NET
- Bash
- Python
In file signatures.csv you can find examples of data and corresponding signature(signed with private key from priv folder). Try to get same signatures and validate these signatures with public key