From 615f2568c7d6b221083f52254e28ddd6be170e0e Mon Sep 17 00:00:00 2001 From: Zachary Atkins Date: Sat, 10 Apr 2021 13:19:02 -0500 Subject: [PATCH 1/3] empty setup --- loc_chain_app/lib/pages/setup.dart | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 loc_chain_app/lib/pages/setup.dart diff --git a/loc_chain_app/lib/pages/setup.dart b/loc_chain_app/lib/pages/setup.dart new file mode 100644 index 0000000..169d015 --- /dev/null +++ b/loc_chain_app/lib/pages/setup.dart @@ -0,0 +1,8 @@ +import 'package:flutter/material.dart'; + +class SetupPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold(); + } +} From 69def3c28bb4a51e6690dc3fdaa15bf4ea57a727 Mon Sep 17 00:00:00 2001 From: Zachary Atkins Date: Sat, 10 Apr 2021 13:51:24 -0500 Subject: [PATCH 2/3] update packages --- loc_chain_app/pubspec.lock | 26 +++++++++++++------------- loc_chain_app/pubspec.yaml | 4 ++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/loc_chain_app/pubspec.lock b/loc_chain_app/pubspec.lock index dc141af..da38942 100644 --- a/loc_chain_app/pubspec.lock +++ b/loc_chain_app/pubspec.lock @@ -63,14 +63,14 @@ packages: name: fast_rsa url: "https://pub.dartlang.org" source: hosted - version: "1.3.6" + version: "1.4.0-nullsafety.4" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "0.1.3" + version: "1.0.0" file: dependency: transitive description: @@ -84,7 +84,7 @@ packages: name: fixnum url: "https://pub.dartlang.org" source: hosted - version: "0.10.11" + version: "1.0.0" flutter: dependency: "direct main" description: flutter @@ -134,35 +134,35 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.6.28" + version: "2.0.1" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.1+2" + version: "2.0.0" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+8" + version: "2.0.0" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "0.0.4+3" + version: "2.0.0" platform: dependency: transitive description: @@ -176,7 +176,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "2.0.0" process: dependency: transitive description: @@ -190,7 +190,7 @@ packages: name: protobuf url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "2.0.0" sky_engine: dependency: transitive description: flutter @@ -258,14 +258,14 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "1.7.4+1" + version: "2.0.5" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "0.2.0" sdks: dart: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" + flutter: ">=1.20.0" diff --git a/loc_chain_app/pubspec.yaml b/loc_chain_app/pubspec.yaml index 63f9d83..a2ecffc 100644 --- a/loc_chain_app/pubspec.yaml +++ b/loc_chain_app/pubspec.yaml @@ -28,8 +28,8 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 - path_provider: ^1.6.28 - fast_rsa: ^1.1.4 + path_provider: ^2.0.1 + fast_rsa: ^1.4.0-nullsafety.4 dev_dependencies: flutter_test: From 7ceaa12c8dde530e6506db8d4b60c799e6a61769 Mon Sep 17 00:00:00 2001 From: Zachary Atkins Date: Sat, 10 Apr 2021 13:51:51 -0500 Subject: [PATCH 3/3] start hash work --- loc_chain_app/lib/pages/keygen.dart | 47 +-------------------- loc_chain_app/lib/util/keyfile_manager.dart | 46 ++++++++++++++++++++ loc_chain_app/lib/util/transaction.dart | 5 +++ 3 files changed, 53 insertions(+), 45 deletions(-) create mode 100644 loc_chain_app/lib/util/keyfile_manager.dart create mode 100644 loc_chain_app/lib/util/transaction.dart diff --git a/loc_chain_app/lib/pages/keygen.dart b/loc_chain_app/lib/pages/keygen.dart index f36160e..c634f6c 100644 --- a/loc_chain_app/lib/pages/keygen.dart +++ b/loc_chain_app/lib/pages/keygen.dart @@ -1,54 +1,11 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; + import 'package:fast_rsa/rsa.dart'; import 'package:fast_rsa/model/bridge.pb.dart'; -import 'package:path_provider/path_provider.dart'; -import 'dart:io'; - -class KeyFileManager { - static Future get _localPath async { - final directory = await getApplicationDocumentsDirectory(); - return directory.path; - } - - static Future get _pubKeyFile async { - final path = await _localPath; - return File('$path/rsa.pub'); - } - - static Future get _privKeyFile async { - final path = await _localPath; - return File('$path/rsa'); - } - - static Future readKeyPair() async { - try { - String privKey = await _privKeyFile.then( - (file) => file.readAsString(), - ); - String pubKey = await _pubKeyFile.then( - (file) => file.readAsString(), - ); - - return KeyPair( - privateKey: privKey, - publicKey: pubKey, - ); - } catch (e) { - print(e); - return KeyPair(); - } - } - - static Future writeKeyPair(KeyPair pair) async { - final File privKeyFile = await _privKeyFile; - final File pubKeyFile = await _pubKeyFile; - pubKeyFile.writeAsString(pair.publicKey); - privKeyFile.writeAsString(pair.privateKey); - } -} +import 'package:loc_chain_app/util/keyfile_manager.dart'; class KeygenPage extends StatefulWidget { KeygenPage({Key? key, required this.title}) : super(key: key); diff --git a/loc_chain_app/lib/util/keyfile_manager.dart b/loc_chain_app/lib/util/keyfile_manager.dart new file mode 100644 index 0000000..97c2136 --- /dev/null +++ b/loc_chain_app/lib/util/keyfile_manager.dart @@ -0,0 +1,46 @@ +import 'package:fast_rsa/model/bridge.pb.dart'; +import 'package:path_provider/path_provider.dart'; +import 'dart:io'; + +class KeyFileManager { + static Future get _localPath async { + final directory = await getApplicationDocumentsDirectory(); + return directory.path; + } + + static Future get _pubKeyFile async { + final path = await _localPath; + return File('$path/rsa.pub'); + } + + static Future get _privKeyFile async { + final path = await _localPath; + return File('$path/rsa'); + } + + static Future readKeyPair() async { + try { + String privKey = await _privKeyFile.then( + (file) => file.readAsString(), + ); + String pubKey = await _pubKeyFile.then( + (file) => file.readAsString(), + ); + + return KeyPair( + privateKey: privKey, + publicKey: pubKey, + ); + } catch (e) { + print(e); + return KeyPair(); + } + } + + static Future writeKeyPair(KeyPair pair) async { + final File privKeyFile = await _privKeyFile; + final File pubKeyFile = await _pubKeyFile; + pubKeyFile.writeAsString(pair.publicKey); + privKeyFile.writeAsString(pair.privateKey); + } +} diff --git a/loc_chain_app/lib/util/transaction.dart b/loc_chain_app/lib/util/transaction.dart new file mode 100644 index 0000000..c8c1643 --- /dev/null +++ b/loc_chain_app/lib/util/transaction.dart @@ -0,0 +1,5 @@ +import 'package:flutter/services.dart'; +import 'package:fast_rsa/model/bridge.pb.dart'; +import 'package:fast_rsa/rsa.dart'; + +class Transaction {}