Search…
⌃K
Links

Security

How you can securely connect to SoftPOS SDK

Android Package Name

You need to share your Android package name with NearPay team so we can register it in our system .
if the package name is not registered in NearPay system , you won't be able to communicate with our system .

🔑
Generate Keys

To be able to communicate with our SoftPOS SDK you need to generate your own RSA Keys pair which allow you to sign any data sent by your backend to the SoftPOS SDK so we can verify it with our public key.
Run the bellow 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 with Nearpay team
openssl rsa -in pos_key.pem -outform PEM -pubout -out pos_public.pem
pos_public.pem : You need to share it with Nearpay team.
pos_key.pem : Save it in secure manner to be used to sign any JWT from your side to connect any device to specific terminal id

🔗
Connect

To be able to connect your user device to a terminal id please use your backend to sign the JWT with flowing data
TypeScript
JavaScript
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 nearpay
terminal_id: "1000003000000006"// get this number from mada
}
}
return jwt.sign(terminal, privateKey, { algorithm: "RS256"});
}
const fs = require('fs');
const jwt = require('jsonwebtoken');
function getToken() {
var privateKey = fs.readFileSync('./pos_key.pem');
var terminal = {
data:{
ops: "auth",
client_uuid: "212f66c6-bbfd-4fc7-9f50-31a749145cd1", // provided by nearpay
terminal_id: "1000003000000006"// get this number from mada
}
}
return jwt.sign(terminal, privateKey, { algorithm: "RS256"});
}