Code Samples

Examples of code to interact with Nirova 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:

  1. generate private and public key.
  2. send public key to Nirova representative

Process:

  1. sign request body with your private key
  2. encode signature in base64
  3. put result of step 2 into header X-Nirova-Signature
  4. send request

Process:

  1. sign request body with your private key
  2. encode signature in base64
  3. put result of step 2 into header X-Nirova-Signature
  4. send request
Signing:

Prerequisite: receive and save Nirova public key

Process:

  1. receive request
  2. get value of X-Nirova-Signature header
  3. decode it from base64
  4. check that result of step 3 is valid for combination of this request body and Nirova 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