-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f3dfd8
commit ec1d33b
Showing
36 changed files
with
1,877 additions
and
999 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
import 'package:http/http.dart' as http; | ||
import 'package:random_string/random_string.dart'; | ||
import 'package:simple_rsa/simple_rsa.dart'; | ||
|
||
String publicKey = | ||
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvt4Iixd3XigxqLLHvMp4PDKklFGFbuqnO96AoUdcLl8IHdv6o3gUJnCz3fpj7VFXQzBD0rZ4aOJhJrctfi9F6OGmcazpj7BVk3B1YbjEVLJf3fsZ27PlnwBd8y4te3EcLdUDlFOKErXXb6kCzd4h6azAKik9VYrIn/nnpfuVJLBTenuJEcnHJRY8MyWlL7F3epikHOvqCQRtDcmEqbrMJqLVCLXVjYlZTnPyrzemQ+tGcpVaKKwsjb1EDR9JgDP/Xkpy8eZ18vCDHncpUp2k7FoBM1pg6n1PBMCYGYMN5J76dX7bjeRVeFkRR2Ajh2Ajw2/UL1C+guDeALlUO92fywIDAQAB"; | ||
String privateKey = | ||
"MIIEwAIBADANBgkqhkiG9w0BAQEFAASCBKowggSmAgEAAoIBAQC+3giLF3deKDGosse8yng8MqSUUYVu6qc73oChR1wuXwgd2/qjeBQmcLPd+mPtUVdDMEPStnho4mEmty1+L0Xo4aZxrOmPsFWTcHVhuMRUsl/d+xnbs+WfAF3zLi17cRwt1QOUU4oStddvqQLN3iHprMAqKT1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IpS9NZSLOg1QTiWIyY97hygLMOKYYZ0kp7sPFdyAGww9t/L6kEOah2ibLG0SYk/IDH+xFFjOIlzqyeaW73FxeTnE4HUJeHXlt5T8PNEhqztAQ7sRC3AurUXM//dbqvgXr6B/HwPPJdwlq5UJsUCgYEAshqcXJ/5Y9HPIheenyNSH1MKaLD91cmRr+nO/stMy+l57VVoqeT2uhxMEbj+Xh7HeMJoXPQ1zfVOdjM2IMJ/caJ2WeIXcooiNLVjYXyb84cSPPCblNbV5tHeI5lqNXnjiL6AkMzQm+L8cbJumOZMDywIod+Sy06sIN/iEUZu7HU="; | ||
|
||
String myHash = 'Qmei1GvwVk2C3ZMFsDmyWZDoWs4oqW1v9eRJfWkF3Nr9mj'; | ||
|
||
String myName = 'Shivam Goyal'; | ||
String myID = 'shivamgoyal@upi'; | ||
String myMobileNumber = '+919012218994'; | ||
List<String> users = [ | ||
'Utkarsh Mishra', | ||
'Mankaran Singh', | ||
'Ambika Arora', | ||
'Radhika Singhania', | ||
'Paytm', | ||
'Khushboo Verma', | ||
'Zomato', | ||
'Uber', | ||
'Swiggy', | ||
'Abhishek Jain', | ||
'Sidhant Singh', | ||
'Saurabh Garg', | ||
'BookMyShow' | ||
]; | ||
|
||
List<String> listDecryptedTransaction = []; | ||
|
||
Future sendTransaction() async { | ||
String myTID = 'NPC' + randomNumeric(32).toString(); | ||
print( | ||
'------------------------------ Previous Hash -------------------------------\n' + | ||
myHash); | ||
print( | ||
'----------------------------------------------------------------------------\n\n'); | ||
print( | ||
'----------------------------- Transaction ID -------------------------------\n' + | ||
myTID); | ||
print( | ||
'----------------------------------------------------------------------------\n\n'); | ||
int selectedUserNumber = randomBetween(0, users.length - 1); | ||
String text = | ||
'${users[selectedUserNumber]},${users[selectedUserNumber].toLowerCase().replaceAll(' ', '') + '@upi'},${'+91' + randomBetween(7000000000, 9999999999).toString()},$myName,$myID,$myMobileNumber,${randomBetween(10, 2000)},$myTID,${DateTime.now()},success'; | ||
print( | ||
'--------------------------------- Text -------------------------------------\n' + | ||
text); | ||
print( | ||
'----------------------------------------------------------------------------\n\n'); | ||
String encryptedText = await encryptString(text, publicKey); | ||
encryptedText = encryptedText.replaceAll('\n', ''); | ||
print( | ||
'----------------------------- Encrypted Text -------------------------------\n' + | ||
encryptedText); | ||
print( | ||
'----------------------------------------------------------------------------\n'); | ||
String url = 'https://npci-database.herokuapp.com/contact'; | ||
var body = { | ||
'status': myHash == '' ? 'Y' : 'N', | ||
'hash': myHash == '' ? '' : myHash, | ||
'tid': myTID, | ||
'main': encryptedText, | ||
}; | ||
var response = await http.post(url, body: body); | ||
myHash = response.body; | ||
print( | ||
'------------------------------ Updated Hash --------------------------------\n' + | ||
myHash); | ||
print( | ||
'----------------------------------------------------------------------------\n'); | ||
print( | ||
' _ \n'); | ||
print( | ||
' .__(.)< (AeroCoders) \n'); | ||
print( | ||
' \\___) \n'); | ||
print( | ||
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n\n'); | ||
} | ||
|
||
Future getTransaction() async { | ||
listDecryptedTransaction.clear(); | ||
print( | ||
'------------------------------ Recorded Hash -------------------------------\n' + | ||
myHash); | ||
print( | ||
'----------------------------------------------------------------------------\n\n'); | ||
String url = 'https://ipfs.io/ipfs/' + myHash; | ||
var response = await http.get(url); | ||
List<String> listEncryptedTransaction = response.body.split('\n'); | ||
String lastEncryptedTransaction = | ||
listEncryptedTransaction[listEncryptedTransaction.length - 2]; | ||
print( | ||
'----------------------- Last Encrypted Transaction -------------------------\n' + | ||
lastEncryptedTransaction); | ||
print( | ||
'----------------------------------------------------------------------------\n\n'); | ||
print( | ||
'------------------------ All Decrypted Transaction -------------------------\n'); | ||
for (int i = 0; i < listEncryptedTransaction.length - 1; i++) { | ||
String toBeAddedTransaction = | ||
await decryptString(listEncryptedTransaction[i], privateKey); | ||
print(toBeAddedTransaction); | ||
listDecryptedTransaction.add(toBeAddedTransaction); | ||
} | ||
print( | ||
'----------------------------------------------------------------------------\n'); | ||
print( | ||
' _ \n'); | ||
print( | ||
' .__(.)< (AeroCoders) \n'); | ||
print( | ||
' \\___) \n'); | ||
print( | ||
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n\n'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.