Security

How you can securely connect to StreamPOS SDK

Android Package Name

You need to share your Android package name with the StreamPay team so we can register it in our system.

Generate Keys

To be able to communicate with our StreamPOS SDK you need to generate your own RSA Keys pair which allows you to sign any data sent by your backend to the SoftPOS SDK so we can verify it with our public key.

Run the below command to generate the private key and don't share it with anyone.

openssl genrsa -out pos_key.pem 2048s

Then run this command to generate the public key and share it with the StreamPay team.

openssl rsa -in pos_key.pem -outform PEM -pubout -out pos_public.pem

pos_public.pem : You need to share it with StreamPay team.

pos_key.pem : Save it in a secure manner to be used to sign any JWT from your side to connect any device to a specific terminal id.

Connect

To be able to connect your user device to a terminal id please use your POS backend to sign the JWT with flowing data.

import * as fs from 'fs';
import * as jwt from 'jsonwebtoken';

function getToken() {
var privateKey: Buffer = fs.readFileSync('./pos_key.pem');

var terminal:any = {
  data:{
    ops: "auth",
    client_uuid: "212f66c6-bbfd-4fc7-9f50-31a749145cd1", // provided by streampay
    terminal_id: "1000003000000006"// get this number from made
  }
}

return jwt.sign(terminal, privateKey, { algorithm: "RS256"});
}

Last updated