From b30c9734b0921a6dad1acb41e045e34c64b6730e Mon Sep 17 00:00:00 2001 From: Dundo7 Date: Fri, 10 Jul 2020 11:57:08 +0200 Subject: [PATCH] Resolved maintenance issues --- CHANGELOG.md | 6 +- example/lib/main.dart | 37 ++-- example/pubspec.lock | 2 +- example/test/widget_test.dart | 4 +- lib/flutter_locker.dart | 1 - lib/gen/protos/flutter_locker.pb.dart | 199 +++++++++++++------- lib/gen/protos/flutter_locker.pbenum.dart | 34 ++-- lib/gen/protos/flutter_locker.pbjson.dart | 28 ++- lib/gen/protos/flutter_locker.pbserver.dart | 1 - lib/src/flutter_locker.dart | 10 +- lib/src/flutter_locker_exception.dart | 14 +- lib/src/ios_prompt.dart | 7 +- lib/src/retrieve_secret_request.dart | 10 +- lib/src/save_secret_request.dart | 4 +- pubspec.yaml | 2 +- 15 files changed, 237 insertions(+), 122 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fee7f4..8688d2e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ ## 1.0.0 -* Initial release \ No newline at end of file +* Initial release + +## 1.0.1 + +* Resolved maintenance issues. \ No newline at end of file diff --git a/example/lib/main.dart b/example/lib/main.dart index a4ff330..a1c1704 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -21,35 +21,45 @@ class _MyAppState extends State { Future _canAuthenticate(BuildContext context) async { FlutterLocker.canAuthenticate().then((value) { - Scaffold.of(context).showSnackBar(SnackBar(content: Text('Can authenticate: ' + value.toString()))); + Scaffold.of(context).showSnackBar( + SnackBar(content: Text('Can authenticate: ' + value.toString()))); }).catchError((err) { - Scaffold.of(context).showSnackBar(SnackBar(content: Text('Error happened: ' + err.toString()))); + Scaffold.of(context).showSnackBar( + SnackBar(content: Text('Error happened: ' + err.toString()))); }); } Future _saveSecret(BuildContext context) async { - FlutterLocker.save(SaveSecretRequest(key, secret, AndroidPrompt('Authenticate', 'Cancel'))).then((value) { - Scaffold.of(context).showSnackBar(SnackBar(content: Text('Successfully Saved Secret: $secret'))); + FlutterLocker.save(SaveSecretRequest( + key, secret, AndroidPrompt('Authenticate', 'Cancel'))) + .then((value) { + Scaffold.of(context).showSnackBar( + SnackBar(content: Text('Successfully Saved Secret: $secret'))); }).catchError((err) { - Scaffold.of(context).showSnackBar(SnackBar(content: Text('Error happened: ' + err.toString()))); + Scaffold.of(context).showSnackBar( + SnackBar(content: Text('Error happened: ' + err.toString()))); }); } Future _retrieveSecret(BuildContext context) async { - FlutterLocker.retrieve( - RetrieveSecretRequest(key, AndroidPrompt('Authenticate', 'Cancel'), IOsPrompt('Authenticate'))) + FlutterLocker.retrieve(RetrieveSecretRequest(key, + AndroidPrompt('Authenticate', 'Cancel'), IOsPrompt('Authenticate'))) .then((value) { - Scaffold.of(context).showSnackBar(SnackBar(content: Text('Retrieved secret: ' + value))); + Scaffold.of(context) + .showSnackBar(SnackBar(content: Text('Retrieved secret: ' + value))); }).catchError((err) { - Scaffold.of(context).showSnackBar(SnackBar(content: Text('Error happened: ' + err.toString()))); + Scaffold.of(context).showSnackBar( + SnackBar(content: Text('Error happened: ' + err.toString()))); }); } Future _deleteSecret(BuildContext context) async { FlutterLocker.delete(key).then((value) { - Scaffold.of(context).showSnackBar(SnackBar(content: Text('Secret deleted.'))); + Scaffold.of(context) + .showSnackBar(SnackBar(content: Text('Secret deleted.'))); }).catchError((err) { - Scaffold.of(context).showSnackBar(SnackBar(content: Text('Error happened: ' + err.toString()))); + Scaffold.of(context).showSnackBar( + SnackBar(content: Text('Error happened: ' + err.toString()))); }); } @@ -60,7 +70,10 @@ class _MyAppState extends State { children: [ SizedBox(height: 100), Center( - child: Text('Locker example', style: TextStyle(fontSize: 24),), + child: Text( + 'Locker example', + style: TextStyle(fontSize: 24), + ), ), SizedBox(height: 40), CupertinoButton.filled( diff --git a/example/pubspec.lock b/example/pubspec.lock index ad2b98a..5c13f66 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -82,7 +82,7 @@ packages: path: ".." relative: true source: path - version: "0.0.1" + version: "1.0.1" flutter_test: dependency: "direct dev" description: flutter diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index 945099f..f31d797 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -18,8 +18,8 @@ void main() { // Verify that platform version is retrieved. expect( find.byWidgetPredicate( - (Widget widget) => widget is Text && - widget.data.startsWith('Running on:'), + (Widget widget) => + widget is Text && widget.data.startsWith('Running on:'), ), findsOneWidget, ); diff --git a/lib/flutter_locker.dart b/lib/flutter_locker.dart index 5689b58..7fceaf6 100644 --- a/lib/flutter_locker.dart +++ b/lib/flutter_locker.dart @@ -1,4 +1,3 @@ - library flutter_locker; import 'dart:async'; diff --git a/lib/gen/protos/flutter_locker.pb.dart b/lib/gen/protos/flutter_locker.pb.dart index 4cbfa6f..a0af2c8 100644 --- a/lib/gen/protos/flutter_locker.pb.dart +++ b/lib/gen/protos/flutter_locker.pb.dart @@ -12,32 +12,42 @@ import 'package:protobuf/protobuf.dart' as $pb; export 'flutter_locker.pbenum.dart'; class ProtoAndroidPrompt extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('ProtoAndroidPrompt', createEmptyInstance: create) - ..aOS(1, 'titleText', protoName: 'titleText') - ..aOS(2, 'cancelText', protoName: 'cancelText') - ..aOS(3, 'description') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('ProtoAndroidPrompt', createEmptyInstance: create) + ..aOS(1, 'titleText', protoName: 'titleText') + ..aOS(2, 'cancelText', protoName: 'cancelText') + ..aOS(3, 'description') + ..hasRequiredFields = false; ProtoAndroidPrompt._() : super(); factory ProtoAndroidPrompt() => create(); - factory ProtoAndroidPrompt.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ProtoAndroidPrompt.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory ProtoAndroidPrompt.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ProtoAndroidPrompt.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); ProtoAndroidPrompt clone() => ProtoAndroidPrompt()..mergeFromMessage(this); - ProtoAndroidPrompt copyWith(void Function(ProtoAndroidPrompt) updates) => super.copyWith((message) => updates(message as ProtoAndroidPrompt)); + ProtoAndroidPrompt copyWith(void Function(ProtoAndroidPrompt) updates) => + super.copyWith((message) => updates(message as ProtoAndroidPrompt)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static ProtoAndroidPrompt create() => ProtoAndroidPrompt._(); ProtoAndroidPrompt createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static ProtoAndroidPrompt getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ProtoAndroidPrompt getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static ProtoAndroidPrompt _defaultInstance; @$pb.TagNumber(1) $core.String get titleText => $_getSZ(0); @$pb.TagNumber(1) - set titleText($core.String v) { $_setString(0, v); } + set titleText($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasTitleText() => $_has(0); @$pb.TagNumber(1) @@ -46,7 +56,10 @@ class ProtoAndroidPrompt extends $pb.GeneratedMessage { @$pb.TagNumber(2) $core.String get cancelText => $_getSZ(1); @$pb.TagNumber(2) - set cancelText($core.String v) { $_setString(1, v); } + set cancelText($core.String v) { + $_setString(1, v); + } + @$pb.TagNumber(2) $core.bool hasCancelText() => $_has(1); @$pb.TagNumber(2) @@ -55,7 +68,10 @@ class ProtoAndroidPrompt extends $pb.GeneratedMessage { @$pb.TagNumber(3) $core.String get description => $_getSZ(2); @$pb.TagNumber(3) - set description($core.String v) { $_setString(2, v); } + set description($core.String v) { + $_setString(2, v); + } + @$pb.TagNumber(3) $core.bool hasDescription() => $_has(2); @$pb.TagNumber(3) @@ -63,30 +79,40 @@ class ProtoAndroidPrompt extends $pb.GeneratedMessage { } class ProtoIOsPrompt extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('ProtoIOsPrompt', createEmptyInstance: create) - ..aOS(1, 'touchIdText', protoName: 'touchIdText') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('ProtoIOsPrompt', createEmptyInstance: create) + ..aOS(1, 'touchIdText', protoName: 'touchIdText') + ..hasRequiredFields = false; ProtoIOsPrompt._() : super(); factory ProtoIOsPrompt() => create(); - factory ProtoIOsPrompt.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ProtoIOsPrompt.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory ProtoIOsPrompt.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ProtoIOsPrompt.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); ProtoIOsPrompt clone() => ProtoIOsPrompt()..mergeFromMessage(this); - ProtoIOsPrompt copyWith(void Function(ProtoIOsPrompt) updates) => super.copyWith((message) => updates(message as ProtoIOsPrompt)); + ProtoIOsPrompt copyWith(void Function(ProtoIOsPrompt) updates) => + super.copyWith((message) => updates(message as ProtoIOsPrompt)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static ProtoIOsPrompt create() => ProtoIOsPrompt._(); ProtoIOsPrompt createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static ProtoIOsPrompt getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ProtoIOsPrompt getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static ProtoIOsPrompt _defaultInstance; @$pb.TagNumber(1) $core.String get touchIdText => $_getSZ(0); @$pb.TagNumber(1) - set touchIdText($core.String v) { $_setString(0, v); } + set touchIdText($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasTouchIdText() => $_has(0); @$pb.TagNumber(1) @@ -94,32 +120,43 @@ class ProtoIOsPrompt extends $pb.GeneratedMessage { } class ProtoSaveRequest extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('ProtoSaveRequest', createEmptyInstance: create) - ..aOS(1, 'key') - ..aOS(2, 'secret') - ..aOM(3, 'androidPrompt', protoName: 'androidPrompt', subBuilder: ProtoAndroidPrompt.create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('ProtoSaveRequest', createEmptyInstance: create) + ..aOS(1, 'key') + ..aOS(2, 'secret') + ..aOM(3, 'androidPrompt', + protoName: 'androidPrompt', subBuilder: ProtoAndroidPrompt.create) + ..hasRequiredFields = false; ProtoSaveRequest._() : super(); factory ProtoSaveRequest() => create(); - factory ProtoSaveRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ProtoSaveRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory ProtoSaveRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ProtoSaveRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); ProtoSaveRequest clone() => ProtoSaveRequest()..mergeFromMessage(this); - ProtoSaveRequest copyWith(void Function(ProtoSaveRequest) updates) => super.copyWith((message) => updates(message as ProtoSaveRequest)); + ProtoSaveRequest copyWith(void Function(ProtoSaveRequest) updates) => + super.copyWith((message) => updates(message as ProtoSaveRequest)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static ProtoSaveRequest create() => ProtoSaveRequest._(); ProtoSaveRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static ProtoSaveRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ProtoSaveRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static ProtoSaveRequest _defaultInstance; @$pb.TagNumber(1) $core.String get key => $_getSZ(0); @$pb.TagNumber(1) - set key($core.String v) { $_setString(0, v); } + set key($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasKey() => $_has(0); @$pb.TagNumber(1) @@ -128,7 +165,10 @@ class ProtoSaveRequest extends $pb.GeneratedMessage { @$pb.TagNumber(2) $core.String get secret => $_getSZ(1); @$pb.TagNumber(2) - set secret($core.String v) { $_setString(1, v); } + set secret($core.String v) { + $_setString(1, v); + } + @$pb.TagNumber(2) $core.bool hasSecret() => $_has(1); @$pb.TagNumber(2) @@ -137,7 +177,10 @@ class ProtoSaveRequest extends $pb.GeneratedMessage { @$pb.TagNumber(3) ProtoAndroidPrompt get androidPrompt => $_getN(2); @$pb.TagNumber(3) - set androidPrompt(ProtoAndroidPrompt v) { setField(3, v); } + set androidPrompt(ProtoAndroidPrompt v) { + setField(3, v); + } + @$pb.TagNumber(3) $core.bool hasAndroidPrompt() => $_has(2); @$pb.TagNumber(3) @@ -147,32 +190,45 @@ class ProtoSaveRequest extends $pb.GeneratedMessage { } class ProtoRetrieveRequest extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('ProtoRetrieveRequest', createEmptyInstance: create) - ..aOS(1, 'key') - ..aOM(2, 'androidPrompt', protoName: 'androidPrompt', subBuilder: ProtoAndroidPrompt.create) - ..aOM(3, 'iOsPrompt', protoName: 'iOsPrompt', subBuilder: ProtoIOsPrompt.create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('ProtoRetrieveRequest', createEmptyInstance: create) + ..aOS(1, 'key') + ..aOM(2, 'androidPrompt', + protoName: 'androidPrompt', subBuilder: ProtoAndroidPrompt.create) + ..aOM(3, 'iOsPrompt', + protoName: 'iOsPrompt', subBuilder: ProtoIOsPrompt.create) + ..hasRequiredFields = false; ProtoRetrieveRequest._() : super(); factory ProtoRetrieveRequest() => create(); - factory ProtoRetrieveRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ProtoRetrieveRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - ProtoRetrieveRequest clone() => ProtoRetrieveRequest()..mergeFromMessage(this); - ProtoRetrieveRequest copyWith(void Function(ProtoRetrieveRequest) updates) => super.copyWith((message) => updates(message as ProtoRetrieveRequest)); + factory ProtoRetrieveRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ProtoRetrieveRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + ProtoRetrieveRequest clone() => + ProtoRetrieveRequest()..mergeFromMessage(this); + ProtoRetrieveRequest copyWith(void Function(ProtoRetrieveRequest) updates) => + super.copyWith((message) => updates(message as ProtoRetrieveRequest)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static ProtoRetrieveRequest create() => ProtoRetrieveRequest._(); ProtoRetrieveRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static ProtoRetrieveRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ProtoRetrieveRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static ProtoRetrieveRequest _defaultInstance; @$pb.TagNumber(1) $core.String get key => $_getSZ(0); @$pb.TagNumber(1) - set key($core.String v) { $_setString(0, v); } + set key($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasKey() => $_has(0); @$pb.TagNumber(1) @@ -181,7 +237,10 @@ class ProtoRetrieveRequest extends $pb.GeneratedMessage { @$pb.TagNumber(2) ProtoAndroidPrompt get androidPrompt => $_getN(1); @$pb.TagNumber(2) - set androidPrompt(ProtoAndroidPrompt v) { setField(2, v); } + set androidPrompt(ProtoAndroidPrompt v) { + setField(2, v); + } + @$pb.TagNumber(2) $core.bool hasAndroidPrompt() => $_has(1); @$pb.TagNumber(2) @@ -192,7 +251,10 @@ class ProtoRetrieveRequest extends $pb.GeneratedMessage { @$pb.TagNumber(3) ProtoIOsPrompt get iOsPrompt => $_getN(2); @$pb.TagNumber(3) - set iOsPrompt(ProtoIOsPrompt v) { setField(3, v); } + set iOsPrompt(ProtoIOsPrompt v) { + setField(3, v); + } + @$pb.TagNumber(3) $core.bool hasIOsPrompt() => $_has(2); @$pb.TagNumber(3) @@ -202,33 +264,42 @@ class ProtoRetrieveRequest extends $pb.GeneratedMessage { } class ProtoDeleteRequest extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo('ProtoDeleteRequest', createEmptyInstance: create) - ..aOS(1, 'key') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = + $pb.BuilderInfo('ProtoDeleteRequest', createEmptyInstance: create) + ..aOS(1, 'key') + ..hasRequiredFields = false; ProtoDeleteRequest._() : super(); factory ProtoDeleteRequest() => create(); - factory ProtoDeleteRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory ProtoDeleteRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); + factory ProtoDeleteRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory ProtoDeleteRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); ProtoDeleteRequest clone() => ProtoDeleteRequest()..mergeFromMessage(this); - ProtoDeleteRequest copyWith(void Function(ProtoDeleteRequest) updates) => super.copyWith((message) => updates(message as ProtoDeleteRequest)); + ProtoDeleteRequest copyWith(void Function(ProtoDeleteRequest) updates) => + super.copyWith((message) => updates(message as ProtoDeleteRequest)); $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static ProtoDeleteRequest create() => ProtoDeleteRequest._(); ProtoDeleteRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static ProtoDeleteRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static ProtoDeleteRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static ProtoDeleteRequest _defaultInstance; @$pb.TagNumber(1) $core.String get key => $_getSZ(0); @$pb.TagNumber(1) - set key($core.String v) { $_setString(0, v); } + set key($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasKey() => $_has(0); @$pb.TagNumber(1) void clearKey() => clearField(1); } - diff --git a/lib/gen/protos/flutter_locker.pbenum.dart b/lib/gen/protos/flutter_locker.pbenum.dart index 280953d..adcf9b6 100644 --- a/lib/gen/protos/flutter_locker.pbenum.dart +++ b/lib/gen/protos/flutter_locker.pbenum.dart @@ -10,40 +10,48 @@ import 'dart:core' as $core; import 'package:protobuf/protobuf.dart' as $pb; class ProtoMethodInterface extends $pb.ProtobufEnum { - static const ProtoMethodInterface canAuthenticate = ProtoMethodInterface._(0, 'canAuthenticate'); - static const ProtoMethodInterface saveSecret = ProtoMethodInterface._(1, 'saveSecret'); - static const ProtoMethodInterface retrieveSecret = ProtoMethodInterface._(2, 'retrieveSecret'); - static const ProtoMethodInterface deleteSecret = ProtoMethodInterface._(3, 'deleteSecret'); - - static const $core.List values = [ + static const ProtoMethodInterface canAuthenticate = + ProtoMethodInterface._(0, 'canAuthenticate'); + static const ProtoMethodInterface saveSecret = + ProtoMethodInterface._(1, 'saveSecret'); + static const ProtoMethodInterface retrieveSecret = + ProtoMethodInterface._(2, 'retrieveSecret'); + static const ProtoMethodInterface deleteSecret = + ProtoMethodInterface._(3, 'deleteSecret'); + + static const $core.List values = [ canAuthenticate, saveSecret, retrieveSecret, deleteSecret, ]; - static final $core.Map<$core.int, ProtoMethodInterface> _byValue = $pb.ProtobufEnum.initByValue(values); + static final $core.Map<$core.int, ProtoMethodInterface> _byValue = + $pb.ProtobufEnum.initByValue(values); static ProtoMethodInterface valueOf($core.int value) => _byValue[value]; const ProtoMethodInterface._($core.int v, $core.String n) : super(v, n); } class ProtoLockerError extends $pb.ProtobufEnum { - static const ProtoLockerError secretNotFound = ProtoLockerError._(0, 'secretNotFound'); - static const ProtoLockerError authenticationCanceled = ProtoLockerError._(1, 'authenticationCanceled'); - static const ProtoLockerError authenticationFailed = ProtoLockerError._(2, 'authenticationFailed'); + static const ProtoLockerError secretNotFound = + ProtoLockerError._(0, 'secretNotFound'); + static const ProtoLockerError authenticationCanceled = + ProtoLockerError._(1, 'authenticationCanceled'); + static const ProtoLockerError authenticationFailed = + ProtoLockerError._(2, 'authenticationFailed'); static const ProtoLockerError unknown = ProtoLockerError._(3, 'unknown'); - static const $core.List values = [ + static const $core.List values = [ secretNotFound, authenticationCanceled, authenticationFailed, unknown, ]; - static final $core.Map<$core.int, ProtoLockerError> _byValue = $pb.ProtobufEnum.initByValue(values); + static final $core.Map<$core.int, ProtoLockerError> _byValue = + $pb.ProtobufEnum.initByValue(values); static ProtoLockerError valueOf($core.int value) => _byValue[value]; const ProtoLockerError._($core.int v, $core.String n) : super(v, n); } - diff --git a/lib/gen/protos/flutter_locker.pbjson.dart b/lib/gen/protos/flutter_locker.pbjson.dart index e5c00bc..7abcc44 100644 --- a/lib/gen/protos/flutter_locker.pbjson.dart +++ b/lib/gen/protos/flutter_locker.pbjson.dart @@ -46,7 +46,14 @@ const ProtoSaveRequest$json = const { '2': const [ const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, const {'1': 'secret', '3': 2, '4': 1, '5': 9, '10': 'secret'}, - const {'1': 'androidPrompt', '3': 3, '4': 1, '5': 11, '6': '.ProtoAndroidPrompt', '10': 'androidPrompt'}, + const { + '1': 'androidPrompt', + '3': 3, + '4': 1, + '5': 11, + '6': '.ProtoAndroidPrompt', + '10': 'androidPrompt' + }, ], }; @@ -54,8 +61,22 @@ const ProtoRetrieveRequest$json = const { '1': 'ProtoRetrieveRequest', '2': const [ const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, - const {'1': 'androidPrompt', '3': 2, '4': 1, '5': 11, '6': '.ProtoAndroidPrompt', '10': 'androidPrompt'}, - const {'1': 'iOsPrompt', '3': 3, '4': 1, '5': 11, '6': '.ProtoIOsPrompt', '10': 'iOsPrompt'}, + const { + '1': 'androidPrompt', + '3': 2, + '4': 1, + '5': 11, + '6': '.ProtoAndroidPrompt', + '10': 'androidPrompt' + }, + const { + '1': 'iOsPrompt', + '3': 3, + '4': 1, + '5': 11, + '6': '.ProtoIOsPrompt', + '10': 'iOsPrompt' + }, ], }; @@ -65,4 +86,3 @@ const ProtoDeleteRequest$json = const { const {'1': 'key', '3': 1, '4': 1, '5': 9, '10': 'key'}, ], }; - diff --git a/lib/gen/protos/flutter_locker.pbserver.dart b/lib/gen/protos/flutter_locker.pbserver.dart index b88f535..d03048a 100644 --- a/lib/gen/protos/flutter_locker.pbserver.dart +++ b/lib/gen/protos/flutter_locker.pbserver.dart @@ -6,4 +6,3 @@ // ignore_for_file: camel_case_types,non_constant_identifier_names,library_prefixes,unused_import,unused_shown_name,return_of_invalid_type export 'flutter_locker.pb.dart'; - diff --git a/lib/src/flutter_locker.dart b/lib/src/flutter_locker.dart index d972b14..ebd09e7 100644 --- a/lib/src/flutter_locker.dart +++ b/lib/src/flutter_locker.dart @@ -9,7 +9,8 @@ class FlutterLocker { /// Checks if the devices has biometric features static Future canAuthenticate() async { - final bool success = await _channel.invokeMethod(protos.ProtoMethodInterface.canAuthenticate.value.toString()); + final bool success = await _channel.invokeMethod( + protos.ProtoMethodInterface.canAuthenticate.value.toString()); return success; } @@ -31,7 +32,8 @@ class FlutterLocker { static Future retrieve(RetrieveSecretRequest request) async { return await _catchCommonError(() async { final String secret = await _channel.invokeMethod( - protos.ProtoMethodInterface.retrieveSecret.value.toString(), request.toProto().writeToBuffer()); + protos.ProtoMethodInterface.retrieveSecret.value.toString(), + request.toProto().writeToBuffer()); return secret; }); } @@ -39,7 +41,9 @@ class FlutterLocker { /// Deletes the key. static Future delete(String key) async { final request = protos.ProtoDeleteRequest()..key = key; - await _channel.invokeMethod(ProtoMethodInterface.deleteSecret.value.toString(), request.writeToBuffer()); + await _channel.invokeMethod( + ProtoMethodInterface.deleteSecret.value.toString(), + request.writeToBuffer()); } static _catchCommonError(Function function) async { diff --git a/lib/src/flutter_locker_exception.dart b/lib/src/flutter_locker_exception.dart index a901ca5..08a69df 100644 --- a/lib/src/flutter_locker_exception.dart +++ b/lib/src/flutter_locker_exception.dart @@ -2,19 +2,20 @@ import 'package:flutter/material.dart'; import 'package:flutter_locker/gen/protos/flutter_locker.pb.dart'; class LockerException implements Exception { - LockerException({ - @required this.reason - }) : assert(reason != null); + LockerException({@required this.reason}) : assert(reason != null); final LockerExceptionReason reason; factory LockerException.fromCode(String code) { if (code == ProtoLockerError.secretNotFound.value.toString()) { return LockerException(reason: LockerExceptionReason.secretNotFound); - } else if (code == ProtoLockerError.authenticationCanceled.value.toString()) { - return LockerException(reason: LockerExceptionReason.authenticationCanceled); + } else if (code == + ProtoLockerError.authenticationCanceled.value.toString()) { + return LockerException( + reason: LockerExceptionReason.authenticationCanceled); } else if (code == ProtoLockerError.authenticationFailed.value.toString()) { - return LockerException(reason: LockerExceptionReason.authenticationFailed); + return LockerException( + reason: LockerExceptionReason.authenticationFailed); } else { return null; } @@ -37,7 +38,6 @@ class LockerException implements Exception { return ''; } } - } enum LockerExceptionReason { diff --git a/lib/src/ios_prompt.dart b/lib/src/ios_prompt.dart index 93da068..9ce27b3 100644 --- a/lib/src/ios_prompt.dart +++ b/lib/src/ios_prompt.dart @@ -1,16 +1,15 @@ - part of flutter_locker; /// The iOS native dialog is only shown when retrieveing secret. -/// +/// /// - For phones with Touch ID, the [touchIdText] is displayed in prompt. /// - For phones with Face ID, the text is defined in plist file. class IOsPrompt { IOsPrompt(this.touchIdText); - + final String touchIdText; protos.ProtoIOsPrompt toProto() { return protos.ProtoIOsPrompt()..touchIdText = touchIdText; } -} \ No newline at end of file +} diff --git a/lib/src/retrieve_secret_request.dart b/lib/src/retrieve_secret_request.dart index 57bb6fc..149cf92 100644 --- a/lib/src/retrieve_secret_request.dart +++ b/lib/src/retrieve_secret_request.dart @@ -1,4 +1,3 @@ - part of flutter_locker; /// Data structure for retrieving the saved secret @@ -10,8 +9,9 @@ class RetrieveSecretRequest { final IOsPrompt iOsPrompt; protos.ProtoRetrieveRequest toProto() { - return protos.ProtoRetrieveRequest()..key = key - ..androidPrompt = androidPrompt.toProto() - ..iOsPrompt = iOsPrompt.toProto(); + return protos.ProtoRetrieveRequest() + ..key = key + ..androidPrompt = androidPrompt.toProto() + ..iOsPrompt = iOsPrompt.toProto(); } -} \ No newline at end of file +} diff --git a/lib/src/save_secret_request.dart b/lib/src/save_secret_request.dart index 88158d6..7521f68 100644 --- a/lib/src/save_secret_request.dart +++ b/lib/src/save_secret_request.dart @@ -1,4 +1,3 @@ - part of flutter_locker; /// Data structure for saving the secret @@ -9,11 +8,10 @@ class SaveSecretRequest { final String secret; final AndroidPrompt androidPrompt; - protos.ProtoSaveRequest toProto() { return protos.ProtoSaveRequest() ..key = key ..secret = secret ..androidPrompt = androidPrompt.toProto(); } -} \ No newline at end of file +} diff --git a/pubspec.yaml b/pubspec.yaml index fc59783..84db431 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_locker description: Plugin that secures your secrets in keychain using biometric authentication. -version: 1.0.0 +version: 1.0.1 repository: https://github.com/infinum/flutter-plugins-locker homepage: https://github.com/infinum/flutter-plugins-locker