mirror of
https://github.com/mitchell/selfpass.git
synced 2025-12-14 21:27:22 +00:00
Add aes-cbc encryption; add config repo based on shared_preferences
This commit is contained in:
parent
80f9705b19
commit
67744527cc
15 changed files with 254 additions and 154 deletions
|
|
@ -58,8 +58,10 @@ class _ConfigState extends State<Config> {
|
|||
: CupertinoNavigationBar(
|
||||
trailing: GestureDetector(
|
||||
onTap: _buildResetAllHandler(context),
|
||||
child: Text('Reset App',
|
||||
style: TextStyle(color: CupertinoColors.destructiveRed)),
|
||||
child: Text(
|
||||
'Reset',
|
||||
style: TextStyle(color: CupertinoColors.destructiveRed),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
|
|
|
|||
|
|
@ -30,8 +30,9 @@ class Credentials extends StatelessWidget {
|
|||
children: [
|
||||
Text('Decrypting credential...'),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: CupertinoActivityIndicator()),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: CupertinoActivityIndicator(),
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
|
|
@ -44,12 +45,18 @@ class Credentials extends StatelessWidget {
|
|||
|
||||
final credential = await client.get(id);
|
||||
|
||||
credential.password = crypto.decryptPassword(
|
||||
password, await privateKey, credential.password);
|
||||
credential.password = crypto.decrypt(
|
||||
credential.password,
|
||||
password,
|
||||
await privateKey,
|
||||
);
|
||||
|
||||
if (credential.otpSecret != null && credential.otpSecret != '') {
|
||||
credential.otpSecret = crypto.decryptPassword(
|
||||
password, await privateKey, credential.otpSecret);
|
||||
if (credential.otpSecret.isNotEmpty) {
|
||||
credential.otpSecret = crypto.decrypt(
|
||||
credential.otpSecret,
|
||||
password,
|
||||
await privateKey,
|
||||
);
|
||||
}
|
||||
|
||||
Navigator.of(context)
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
const checkPeriod = 30;
|
||||
|
||||
return Timer(Duration(seconds: checkPeriod), () {
|
||||
_config.reset();
|
||||
Navigator.of(context)
|
||||
.pushNamedAndRemoveUntil('/', ModalRoute.withName('/home'));
|
||||
});
|
||||
|
|
@ -127,7 +128,11 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
|
|||
}
|
||||
|
||||
GestureTapCallback _makeLockOnTapHandler(BuildContext context) {
|
||||
return () => Navigator.of(context).pushReplacementNamed('/');
|
||||
return () {
|
||||
_config.reset();
|
||||
Navigator.of(context)
|
||||
.pushNamedAndRemoveUntil('/', ModalRoute.withName('/home'));
|
||||
};
|
||||
}
|
||||
|
||||
GestureTapCallback _makeConfigOnTapHandler(BuildContext context) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue