Skip to content

Commit b0fb0c9

Browse files
authored
Merge pull request #29 from crocs-muni/local-auth
Added local authentication for protected actions
2 parents d526037 + 2749518 commit b0fb0c9

26 files changed

+475
-15
lines changed

android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
package="com.example.meesign_client">
33
<uses-permission android:name="android.permission.NFC"/>
44
<uses-permission android:name="android.permission.INTERNET"/>
5+
<uses-permission android:name="android.permission.USE_BIOMETRIC"/>
56
<application
67
android:label="MeeSign"
78
android:icon="@mipmap/ic_launcher"
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.example.meesign_client
22

3-
import io.flutter.embedding.android.FlutterActivity
3+
import io.flutter.embedding.android.FlutterFragmentActivity
44

5-
class MainActivity: FlutterActivity() {
5+
class MainActivity: FlutterFragmentActivity() {
66
}

ios/Flutter/Generated.xcconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This is a generated file; do not edit or check into version control.
2+
FLUTTER_ROOT=/Users/ojin/Development/fvm/versions/3.35.0
3+
FLUTTER_APPLICATION_PATH=/Users/ojin/Documents/Projects/MeeSign/meesign-client
4+
COCOAPODS_PARALLEL_CODE_SIGN=true
5+
FLUTTER_TARGET=lib/main.dart
6+
FLUTTER_BUILD_DIR=build
7+
FLUTTER_BUILD_NAME=0.5.1
8+
FLUTTER_BUILD_NUMBER=0.5.1
9+
FLUTTER_CLI_BUILD_MODE=debug
10+
EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 arm64
11+
EXCLUDED_ARCHS[sdk=iphoneos*]=armv7
12+
DART_OBFUSCATION=false
13+
TRACK_WIDGET_CREATION=true
14+
TREE_SHAKE_ICONS=false
15+
PACKAGE_CONFIG=.dart_tool/package_config.json
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
# Generated file, do not edit.
3+
#
4+
5+
import lldb
6+
7+
def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict):
8+
"""Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages."""
9+
base = frame.register["x0"].GetValueAsAddress()
10+
page_len = frame.register["x1"].GetValueAsUnsigned()
11+
12+
# Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the
13+
# first page to see if handled it correctly. This makes diagnosing
14+
# misconfiguration (e.g. missing breakpoint) easier.
15+
data = bytearray(page_len)
16+
data[0:8] = b'IHELPED!'
17+
18+
error = lldb.SBError()
19+
frame.GetThread().GetProcess().WriteMemory(base, data, error)
20+
if not error.Success():
21+
print(f'Failed to write into {base}[+{page_len}]', error)
22+
return
23+
24+
def __lldb_init_module(debugger: lldb.SBDebugger, _):
25+
target = debugger.GetDummyTarget()
26+
# Caveat: must use BreakpointCreateByRegEx here and not
27+
# BreakpointCreateByName. For some reasons callback function does not
28+
# get carried over from dummy target for the later.
29+
bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$")
30+
bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__))
31+
bp.SetAutoContinue(True)
32+
print("-- LLDB integration loaded --")
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#
2+
# Generated file, do not edit.
3+
#
4+
5+
command script import --relative-to-command-file flutter_lldb_helper.py
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
# This is a generated file; do not edit or check into version control.
3+
export "FLUTTER_ROOT=/Users/ojin/Development/fvm/versions/3.35.0"
4+
export "FLUTTER_APPLICATION_PATH=/Users/ojin/Documents/Projects/MeeSign/meesign-client"
5+
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
6+
export "FLUTTER_TARGET=lib/main.dart"
7+
export "FLUTTER_BUILD_DIR=build"
8+
export "FLUTTER_BUILD_NAME=0.5.1"
9+
export "FLUTTER_BUILD_NUMBER=0.5.1"
10+
export "FLUTTER_CLI_BUILD_MODE=debug"
11+
export "DART_OBFUSCATION=false"
12+
export "TRACK_WIDGET_CREATION=true"
13+
export "TREE_SHAKE_ICONS=false"
14+
export "PACKAGE_CONFIG=.dart_tool/package_config.json"

ios/Podfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Uncomment this line to define a global platform for your project
2+
# platform :ios, '13.0'
3+
4+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6+
7+
project 'Runner', {
8+
'Debug' => :debug,
9+
'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17+
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
22+
end
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24+
end
25+
26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
30+
target 'Runner' do
31+
use_frameworks!
32+
33+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
34+
target 'RunnerTests' do
35+
inherit! :search_paths
36+
end
37+
end
38+
39+
post_install do |installer|
40+
installer.pods_project.targets.each do |target|
41+
flutter_additional_ios_build_settings(target)
42+
end
43+
end
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
// clang-format off
6+
7+
#ifndef GeneratedPluginRegistrant_h
8+
#define GeneratedPluginRegistrant_h
9+
10+
#import <Flutter/Flutter.h>
11+
12+
NS_ASSUME_NONNULL_BEGIN
13+
14+
@interface GeneratedPluginRegistrant : NSObject
15+
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
16+
@end
17+
18+
NS_ASSUME_NONNULL_END
19+
#endif /* GeneratedPluginRegistrant_h */
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
// clang-format off
6+
7+
#import "GeneratedPluginRegistrant.h"
8+
9+
#if __has_include(<file_selector_ios/FileSelectorPlugin.h>)
10+
#import <file_selector_ios/FileSelectorPlugin.h>
11+
#else
12+
@import file_selector_ios;
13+
#endif
14+
15+
#if __has_include(<flutter_nfc_kit/FlutterNfcKitPlugin.h>)
16+
#import <flutter_nfc_kit/FlutterNfcKitPlugin.h>
17+
#else
18+
@import flutter_nfc_kit;
19+
#endif
20+
21+
#if __has_include(<image_picker_ios/FLTImagePickerPlugin.h>)
22+
#import <image_picker_ios/FLTImagePickerPlugin.h>
23+
#else
24+
@import image_picker_ios;
25+
#endif
26+
27+
#if __has_include(<local_auth_darwin/LocalAuthPlugin.h>)
28+
#import <local_auth_darwin/LocalAuthPlugin.h>
29+
#else
30+
@import local_auth_darwin;
31+
#endif
32+
33+
#if __has_include(<mobile_scanner/MobileScannerPlugin.h>)
34+
#import <mobile_scanner/MobileScannerPlugin.h>
35+
#else
36+
@import mobile_scanner;
37+
#endif
38+
39+
#if __has_include(<open_filex/OpenFilePlugin.h>)
40+
#import <open_filex/OpenFilePlugin.h>
41+
#else
42+
@import open_filex;
43+
#endif
44+
45+
#if __has_include(<path_provider_foundation/PathProviderPlugin.h>)
46+
#import <path_provider_foundation/PathProviderPlugin.h>
47+
#else
48+
@import path_provider_foundation;
49+
#endif
50+
51+
#if __has_include(<share_plus/FPPSharePlusPlugin.h>)
52+
#import <share_plus/FPPSharePlusPlugin.h>
53+
#else
54+
@import share_plus;
55+
#endif
56+
57+
#if __has_include(<shared_preferences_foundation/SharedPreferencesPlugin.h>)
58+
#import <shared_preferences_foundation/SharedPreferencesPlugin.h>
59+
#else
60+
@import shared_preferences_foundation;
61+
#endif
62+
63+
#if __has_include(<sqlite3_flutter_libs/Sqlite3FlutterLibsPlugin.h>)
64+
#import <sqlite3_flutter_libs/Sqlite3FlutterLibsPlugin.h>
65+
#else
66+
@import sqlite3_flutter_libs;
67+
#endif
68+
69+
#if __has_include(<url_launcher_ios/URLLauncherPlugin.h>)
70+
#import <url_launcher_ios/URLLauncherPlugin.h>
71+
#else
72+
@import url_launcher_ios;
73+
#endif
74+
75+
@implementation GeneratedPluginRegistrant
76+
77+
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
78+
[FileSelectorPlugin registerWithRegistrar:[registry registrarForPlugin:@"FileSelectorPlugin"]];
79+
[FlutterNfcKitPlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterNfcKitPlugin"]];
80+
[FLTImagePickerPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTImagePickerPlugin"]];
81+
[LocalAuthPlugin registerWithRegistrar:[registry registrarForPlugin:@"LocalAuthPlugin"]];
82+
[MobileScannerPlugin registerWithRegistrar:[registry registrarForPlugin:@"MobileScannerPlugin"]];
83+
[OpenFilePlugin registerWithRegistrar:[registry registrarForPlugin:@"OpenFilePlugin"]];
84+
[PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]];
85+
[FPPSharePlusPlugin registerWithRegistrar:[registry registrarForPlugin:@"FPPSharePlusPlugin"]];
86+
[SharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"SharedPreferencesPlugin"]];
87+
[Sqlite3FlutterLibsPlugin registerWithRegistrar:[registry registrarForPlugin:@"Sqlite3FlutterLibsPlugin"]];
88+
[URLLauncherPlugin registerWithRegistrar:[registry registrarForPlugin:@"URLLauncherPlugin"]];
89+
}
90+
91+
@end

lib/app/model/settings.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class Settings {
99
final int minGroupMembers;
1010
final String currentLanguage;
1111
final bool closeWithoutConfirmation;
12+
final bool authenticateProtectedActions;
1213

1314
Settings(
1415
{this.themeMode = ThemeMode.light,
@@ -18,7 +19,8 @@ class Settings {
1819
this.autoRejectGroups = false,
1920
this.minGroupMembers = 2,
2021
this.currentLanguage = 'en',
21-
this.closeWithoutConfirmation = false});
22+
this.closeWithoutConfirmation = false,
23+
this.authenticateProtectedActions = true});
2224

2325
Settings copyWith(
2426
{ThemeMode? themeMode,
@@ -28,7 +30,8 @@ class Settings {
2830
bool? autoRejectGroups,
2931
int? minGroupMembers,
3032
String? currentLanguage,
31-
bool? closeWithoutConfirmation}) {
33+
bool? closeWithoutConfirmation,
34+
bool? authenticateProtectedActions}) {
3235
return Settings(
3336
themeMode: themeMode ?? this.themeMode,
3437
showArchivedItems: showArchivedItems ?? this.showArchivedItems,
@@ -38,6 +41,8 @@ class Settings {
3841
minGroupMembers: minGroupMembers ?? this.minGroupMembers,
3942
currentLanguage: currentLanguage ?? this.currentLanguage,
4043
closeWithoutConfirmation:
41-
closeWithoutConfirmation ?? this.closeWithoutConfirmation);
44+
closeWithoutConfirmation ?? this.closeWithoutConfirmation,
45+
authenticateProtectedActions:
46+
authenticateProtectedActions ?? this.authenticateProtectedActions);
4247
}
4348
}

0 commit comments

Comments
 (0)