This commit is contained in:
Thomas Atkins 2021-04-11 07:56:23 -05:00
parent 7a50af0cf6
commit b8e057c341
3 changed files with 9 additions and 6 deletions

View File

@ -207,12 +207,16 @@ class _HomePageState extends State<HomePage> {
combinedHash: transaction.hash,
encodedGPSLocation: "{'none':true}",
partnerPublicKey: transaction.pubKey,
validationSignature: await OpenPGP.encrypt(
transaction.hash, KeyFileManager.keyPair.privateKey),
validationSignature: await OpenPGP.sign(
transaction.hash,
transaction.pubKey,
KeyFileManager.keyPair.publicKey,
'',
),
);
var response = await postEncounter(encounter);
print(response);
showSnackbar(response.body);
// showSnackbar(response.body);
}
},
onPayloadTransferUpdate: (endid, payloadTransferUpdate) {

View File

@ -34,7 +34,7 @@ class _KeygenState extends State<KeygenPage> {
}
Future<void> initKeyPair() async {
var options = KeyOptions()..rsaBits = 2048;
var options = KeyOptions()..rsaBits = 512;
var keyPair =
await OpenPGP.generate(options: Options()..keyOptions = options);
await KeyFileManager.writeKeyPair(keyPair);

View File

@ -14,8 +14,7 @@ class Transaction {
var lesser = idLess ? id : otherUserId;
var greater = idLess ? otherUserId : id;
return Transaction(
hash: DBCrypt()
.hashpw("$lesser-$greater", KeyFileManager.keyPair.privateKey),
hash: DBCrypt().hashpw("$lesser-$greater", DBCrypt().gensalt()),
pubKey: KeyFileManager.keyPair.publicKey,
);
}