checkotp 0.1.0 checkotp: ^0.1.0 copied to clipboard
A plugin for the Droptxt OTP SMS validation.
Allows users of the Droptxt SMS service in Sri Lanka to run OTP checks on Mobile numbers of users registering for their application.
To use the service, please register by contacting the Droptxt team at email@example.com with a description of your use case.
Once you register, you will be provided with an 'appkey' and a 'passphrase'. You will require these to access the Droptxt OTP API.
Getting Started #
The OTP is validated in 2 steps.
- Pass the mobile number that needs to be verified to the makeOTPRequest(mobile, appkey, passphrase) function, all variables to be passed as string values. The mobile number should follow the format 947XXXXXXXX. The method will return a string response: a. The status of the OTP request will be either ('OTPSent' or 'OTPFailed'). b. In the event of 'OTPFailed', the request can be sent again by calling the makeOTPRequest method.
var checkotp = new CheckOTP(); var otpStatus = ""; otpStatus = checkotp.makeOTPRequest("947XXXXXXXX", dtAppKey, dtPassphrase) as String; print(otpStatus);
- When the user enters the received OTP value, that value should be passed into matchToken(value). The response will be given as "match" for correct validation and "nomatch" if the OTP is incorrect.
var checkotp = new CheckOTP(); var matchMsg = ""; matchMsg = checkotp.matchToken(otpNum) as String; //output will be 'match' or 'nomatch' print(matchMsg);