mirror of
https://github.com/hackku21/loc-chain-app.git
synced 2024-10-27 20:34:05 +00:00
Merge branch 'main' of https://github.com/hackku21/loc-chain-app
This commit is contained in:
commit
f91bc61a8c
@ -2,6 +2,7 @@ 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:loc_chain_app/util/keyfile_manager.dart';
|
||||
|
||||
@ -14,14 +15,14 @@ class Transaction {
|
||||
}
|
||||
late final String _id;
|
||||
final String hash;
|
||||
static Future<String> signTransaction(String otherUserId) async {
|
||||
static Future<String> generateHash(String otherUserId) async {
|
||||
String id = await SharedPreferences.getInstance()
|
||||
.then((s) => s.getString('userName') ?? '');
|
||||
bool idLess = id.compareTo(otherUserId) < 0;
|
||||
var lesser = idLess ? id : otherUserId;
|
||||
var greater = idLess ? otherUserId : id;
|
||||
return RSA.signPKCS1v15("$lesser-$greater", Hash.HASH_SHA256,
|
||||
KeyFileManager.keyPair.privateKey);
|
||||
return DBCrypt()
|
||||
.hashpw("$lesser-$greater", KeyFileManager.keyPair.privateKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
dbcrypt:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: dbcrypt
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -32,6 +32,7 @@ dependencies:
|
||||
path_provider: ^2.0.1
|
||||
fast_rsa: ^1.4.0-nullsafety.4
|
||||
sqflite: ^2.0.0+3
|
||||
dbcrypt: ^2.0.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Loading…
Reference in New Issue
Block a user