Code Samples
Examples of code to interact with Niropa API
Signature generation and validation
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
General workflow
Signing:
Staging environment is available at
Prerequisite:
- generate private and public key.
- send public key to Niropa representative
Process:
- sign request body with your private key
- encode signature in base64
- put result of step 2 into header X-Niropa-Signature
- send request
Process:
- sign request body with your private key
- encode signature in base64
- put result of step 2 into header X-Niropa-Signature
- send request
Signing:
Prerequisite: receive and save Niropa public key
Process:
- receive request
- get value of X-Niropa-Signature header
- decode it from base64
- check that result of step 3 is valid for combination of this request body and Niropa public key
Examples
We have few code examples for generating of signature and it's validation. Also priv folder contains omed pair of private and public keys.
- Elixir
- NodeJS
- Java
- PHP
- .NET
- Bash
- Python