0.1.2 • Published 2 years ago

gmobile-voice-otp v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Send Gmobile OTP

Basic use

const client = new GmobileVoiceOTPClient(baseURL, privateKey, publicKey, userCode);

// random id
const transId = v4();
const res = await client.createVoiceOTP({
    callee: '0987654321',
    otp: '123456',
    transId,
});

Generate signature and verify

const client = new GmobileVoiceOTPClient(baseURL, privateKey, publicKey, userCode);

const input = 'callee=0975096810&trans_id=235123511261236&otp=123456'
const signature = client.createSignature(input);

const verify = client.verifySignature(input, signature); // return true/false

How to create private key

ssh-keygen -b 2048 -m PEM -N '' -f ./key

then convert public key key.pub to PKCS8 format

ssh-keygen -f key.pub -e -m PKCS8 > ./key.pubx

provide generated public key to Gmobile

Features

  • Generate signature
  • Verify signature
  • Send Voice OTP
  • Get detail of task

And coming up

  • Get balance
  • Verify callback api

Development and testing

cp test/sandbox.tmp.ts test/sandbox.ts

Update private key, public key, then run commands to test

npm run test
0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago