fix transaction manager

This commit is contained in:
Zachary Atkins
2021-04-10 23:41:42 -05:00
parent f0b1fed1c2
commit 8c2dc2a1b7
3 changed files with 33 additions and 22 deletions

View File

@@ -1,21 +1,13 @@
import 'package:fast_rsa/model/bridge.pb.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:sqflite/sqflite.dart';
import 'package:fast_rsa/rsa.dart';
import 'package:dbcrypt/dbcrypt.dart';
import 'package:flutter_udid/flutter_udid.dart';
import 'package:loc_chain_app/util/keyfile_manager.dart';
import 'dart:io';
class Transaction {
Transaction({required this.hash, required this.pubKey});
final String hash;
final String pubKey;
static Future<String> generateHash(String otherUserId) async {
String id = await SharedPreferences.getInstance()
.then((s) => s.getString('userName') ?? '');
String id = await FlutterUdid.consistentUdid;
bool idLess = id.compareTo(otherUserId) < 0;
var lesser = idLess ? id : otherUserId;
var greater = idLess ? otherUserId : id;
@@ -27,13 +19,3 @@ class Transaction {
Future<String> generateP2PPayload(String otherUserId) async =>
"${await generateHash(otherUserId)}:${KeyFileManager.keyPair.publicKey}";
}
class TransactionsDBManager {
static Future<Database> get _localFile async {
return openDatabase('transactions.db');
}
static Future<List<Transaction>?> readTransactions() async {}
static Future<void> writeKeyPair(KeyPair pair) async {}
}