From 993ad2778428b8d3c377c3d387b1b92fb3edc5d4 Mon Sep 17 00:00:00 2001 From: Zachary Atkins Date: Sun, 11 Apr 2021 07:28:15 -0500 Subject: [PATCH] added post request --- loc_chain_app/lib/pages/home.dart | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/loc_chain_app/lib/pages/home.dart b/loc_chain_app/lib/pages/home.dart index 9a41a00..87f5f1d 100644 --- a/loc_chain_app/lib/pages/home.dart +++ b/loc_chain_app/lib/pages/home.dart @@ -3,11 +3,13 @@ import 'dart:io'; import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:flutter_udid/flutter_udid.dart'; +import 'package:loc_chain_app/util/requests.dart'; import 'package:loc_chain_app/util/transaction_manager.dart'; import 'package:nearby_connections/nearby_connections.dart'; import 'package:loc_chain_app/util/keyfile_manager.dart'; import 'package:loc_chain_app/util/transaction_manager.dart'; +import 'package:openpgp/openpgp.dart'; class HomePage extends StatefulWidget { HomePage({Key? key, required this.title}) : super(key: key); @@ -201,6 +203,16 @@ class _HomePageState extends State { print("${transaction.hash}"); showSnackbar(endid + ": " + transaction.hash); + var encounter = EncounterTransaction( + combinedHash: transaction.hash, + encodedGPSLocation: "{'none':true}", + partnerPublicKey: transaction.pubKey, + validationSignature: await OpenPGP.sign( + transaction.hash, '', KeyFileManager.keyPair.privateKey, ''), + ); + var response = await postEncounter(encounter); + print(response); + showSnackbar(response.body); } }, onPayloadTransferUpdate: (endid, payloadTransferUpdate) {