API to Integrate native mobile app with this WordPress plugin #3
muraliwebworld
started this conversation in
Show and tell
Replies: 1 comment
-
Sample DART code in Flutter mobile app showing how to do AES 256 encryption in Flutter app and to decrypt in PHP WordPress String strPwd = "16234hgJKLmllpdcd09b2bc37293"; //secret key generated in step 1 above
GlobalData.pushtoken = token.toString();
final iv = EncryptPack.IV.fromLength(16);
final key = EncryptPack.Key.fromUtf8(strPwd); //hardcode
final encrypter = EncryptPack.Encrypter(EncryptPack.AES(key, mode: EncryptPack.AESMode.cbc));
final encrypted = encrypter.encrypt(token.toString(), iv: iv);
var hmacSha256 = CryptoPack.Hmac(CryptoPack.sha256,ConvertPack.utf8.encode(strPwd)); // HMAC-SHA256
var hmacstring = hmacSha256.convert(ConvertPack.utf8.encode(token.toString()));
var encryptedsubscription = encrypted.base64+":"+iv.base64+":"+hmacstring.toString()+":"+hmacstring.toString(); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
New feature to Integrate Native mobile apps like Flutter mobile app with this WordPress plugin
New API to send push notification subscription from Native mobile apps like Flutter mobile app to WordPress backend and to send push notifications from WordPress to Native mobile app using Firebase.
Generate secret key in mobile app tab to communicate between mobile app(in Integrate app api tab plugin settings)
REST api to send subscription token from Mobile Flutter app using WebView to this WordPress plugin to store it in WordPress db to send push notification whenever new activities/post are published.
Note:- All REST api code is already included in the code, below is only for reference as guide,
REST API using POST method, to send push notification in secured way using AES 256 cryptography encryption method to avoid spams
REST API url post method to send push notification https://domainname.com/wp-json/PNFPBpush/v1/subscriptiontoken
Input parameters in body in http post method in Flutter APP, token – it should be encrypted according to AES 256 cryptography standards,
Following is sample code in dart Flutter AES 256 encryption and hash generation using AES 256 cryptography to send push notification subscription token in encrypted manner to this plugin - WordPress backend
Refer More details are in readme section in plugin description page
Beta Was this translation helpful? Give feedback.
All reactions