gmobile-voice-otp
v0.1.2
Published
Gmobile voice otp library
Maintainers
Readme
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/falseHow to create private key
ssh-keygen -b 2048 -m PEM -N '' -f ./keythen convert public key key.pub to PKCS8 format
ssh-keygen -f key.pub -e -m PKCS8 > ./key.pubxprovide generated public key to Gmobile
Features
- [x] Generate signature
- [x] Verify signature
- [x] Send Voice OTP
- [x] Get detail of task
And coming up
- [ ] Get balance
- [ ] Verify callback api
Development and testing
cp test/sandbox.tmp.ts test/sandbox.tsUpdate private key, public key, then run commands to test
npm run test