Compare commits

...

273 Commits

Author SHA1 Message Date
vishnukvmd
d389d3d163 v2.0.4 2023-09-08 21:05:02 +05:30
vishnukvmd
60e34f780e Update color of the active track within Toggle Switches 2023-09-08 21:04:41 +05:30
Vishnu Mohandas
16d57b8bad Merge branch 'main' into update_settings 2023-09-08 21:00:34 +05:30
vishnukvmd
ddc14a031e v2.0.3 2023-09-08 21:00:07 +05:30
vishnukvmd
bd7402fe38 Move option to select a language from Account -> General 2023-09-08 20:59:43 +05:30
Vishnu Mohandas
ad3ae560bd Update settings (#240) 2023-09-08 20:56:50 +05:30
vishnukvmd
1a15410f0d v2.0.2 2023-09-08 20:35:38 +05:30
vishnukvmd
3d7a4b1d32 Rename General -> Advanced 2023-09-08 20:32:47 +05:30
vishnukvmd
ba1c74b9b5 Update icon for the general section 2023-09-08 20:31:00 +05:30
vishnukvmd
9d3a7efe29 Remove border from search bar 2023-09-08 20:29:09 +05:30
vishnukvmd
95d7a9fe67 Change app header to simply "ente Auth" 2023-09-08 20:29:01 +05:30
vishnukvmd
e4a549a55b Add setting to auto-focus on search bar on app-start 2023-09-08 20:25:31 +05:30
vishnukvmd
9f0a53e733 Add setting to show large icons 2023-09-08 20:19:16 +05:30
vishnukvmd
c89bffb8ff Remove easter egg 2023-09-08 20:18:15 +05:30
Vishnu Mohandas
7456b0a2e7 Format 6-digit codes (#239) 2023-09-08 18:49:09 +05:30
vishnukvmd
bffff57d28 Format 6-digit codes 2023-09-08 18:40:54 +05:30
Vishnu Mohandas
442bab6bdd Copy next code to clipboard on tap (#238) 2023-09-08 18:39:27 +05:30
Vishnu Mohandas
ef9530af24 Merge branch 'main' into copy_next 2023-09-08 18:33:42 +05:30
vishnukvmd
cdb615b0ba Copy next code to clipboard on tap 2023-09-08 18:33:03 +05:30
Vishnu Mohandas
fddf9169d3 Large icons (#237) 2023-09-08 18:32:14 +05:30
vishnukvmd
91cd77ad8d Animate while switching between small and large icons 2023-09-08 18:26:51 +05:30
vishnukvmd
1697547091 Refresh UI when icon settings are updated 2023-09-08 18:02:10 +05:30
vishnukvmd
7fb3ab02f9 Publish an event when icons are changed 2023-09-08 18:01:45 +05:30
vishnukvmd
d855559bab Add option to save the preference for viewing large icons 2023-09-08 17:51:58 +05:30
vishnukvmd
c02a16a321 Refactor code widget 2023-09-08 17:49:16 +05:30
vishnukvmd
97bc2ba141 Accept icon-width as a param 2023-09-08 17:48:26 +05:30
Neeraj Gupta
7f8673b65b Fix: Avoid duplicate imports during offline to offline switch (#234) 2023-09-05 17:36:45 +05:30
Vishnu Mohandas
a5caa06944 Minor updates to readme (#233) 2023-09-05 17:17:16 +05:30
Neeraj Gupta
457c6ffd2f bump version: 2.0.1+201 2023-09-05 17:13:46 +05:30
Neeraj Gupta
1d960fadce Fix: Run single instance of offline import 2023-09-05 17:13:08 +05:30
vishnukvmd
cba39f4ef5 Minor updates to readme 2023-09-05 16:50:28 +05:30
Vishnu Mohandas
9f270cf471 Bump version: v2.0.0+200 (#232) 2023-09-05 15:41:17 +05:30
Neeraj Gupta
5b8ccea31a Add more logs for offline to online import (#231) 2023-09-05 15:40:44 +05:30
Neeraj Gupta
92201eb4ea bump version: 2.0.0+200 2023-09-05 15:31:10 +05:30
Neeraj Gupta
9d519d90c7 Enchance logging 2023-09-05 14:48:23 +05:30
Neeraj Gupta
4d34ab7a01 Force insert offline entry to avoid bad conflict 2023-09-05 13:40:22 +05:30
Neeraj Gupta
3c25216116 Add more logs for offline to online import 2023-09-05 13:34:04 +05:30
Neeraj Gupta
5d0007d749 Add decryption tool for auth encrypted export (#230) 2023-09-05 13:18:26 +05:30
Neeraj Gupta
1afd2ce27e Update encrypted export doc 2023-09-05 13:15:59 +05:30
Neeraj Gupta
438193ac39 go mod tidy 2023-09-05 13:15:44 +05:30
Neeraj Gupta
286940a5d1 Add decryption tool for auth encrypted export 2023-09-05 13:14:30 +05:30
Neeraj Gupta
50ebcdd1f0 Fix duplicate entry for same code during offline to online transition (#229) 2023-09-05 09:19:24 +05:30
Neeraj Gupta
53c406f30c bump version: 1.0.57+57 2023-09-05 08:21:44 +05:30
Neeraj Gupta
acbbd8d049 Minor imporvement 2023-09-05 08:21:11 +05:30
Neeraj Gupta
5c9e879628 Avoid duplicate imports 2023-09-05 08:12:52 +05:30
Vishnu Mohandas
4b633d1a02 Minor changes (#228) 2023-09-05 06:39:34 +05:30
vishnukvmd
b95ed5fbb5 Increase font size for progress dialogs 2023-09-04 23:28:05 +05:30
vishnukvmd
ffcd4022ea Update icon 2023-09-04 23:23:24 +05:30
vishnukvmd
aa525bfeb1 Update alignment of the support widget 2023-09-04 23:19:06 +05:30
Neeraj Gupta
18d098b310 Add no account/offline mode (#227) 2023-09-04 19:34:04 +05:30
Neeraj Gupta
57930b2dd8 Add warning when user selects without backup option 2023-09-04 19:30:55 +05:30
Neeraj Gupta
0d0c89900a Show copoun code for iOS 2023-09-04 19:22:26 +05:30
Neeraj Gupta
4893753b19 Add warning before export 2023-09-04 19:10:54 +05:30
Neeraj Gupta
a594d1c962 Show support dev banner in offline mode 2023-09-04 18:52:38 +05:30
Neeraj Gupta
2e3b6b27de Add support for importing offline codes 2023-09-04 17:51:09 +05:30
Neeraj Gupta
326653054d Add option to sign in to backup 2023-09-04 17:47:31 +05:30
Neeraj Gupta
a7818fc6d4 Add notification component 2023-09-04 16:58:13 +05:30
Neeraj Gupta
5e327a7d65 Show error toast if device doesn't support biometrics 2023-09-04 16:51:07 +05:30
Neeraj Gupta
9c0aea66ec Check for existing key before creating new 2023-09-04 16:45:08 +05:30
Neeraj Gupta
523f216b61 Update key 2023-09-04 16:34:06 +05:30
Neeraj Gupta
fb0fa73c03 Use Sizebox.shrink() 2023-09-04 16:22:50 +05:30
Neeraj Gupta
535109d08f Hide unsync icon for offline mode 2023-09-04 16:13:19 +05:30
Neeraj Gupta
a02cfef105 Add basic support for offline mode 2023-09-04 16:01:59 +05:30
Neeraj Gupta
2ff8963c52 Refactor to clear online mode keys 2023-09-04 10:54:14 +05:30
Neeraj Gupta
117d397d77 Add offline db 2023-09-04 10:49:28 +05:30
Neeraj Gupta
c5b3808dee Merge branch 'main' into offline_mode 2023-09-04 09:50:32 +05:30
Neeraj Gupta
7cd5b313de Ind Upgrade: Switch to direct download option (#226) 2023-09-04 09:45:48 +05:30
Neeraj Gupta
8cbba78bcb APK download: Switch to direct download option 2023-09-04 09:43:45 +05:30
Neeraj Gupta
9d95bd16cd By default, enable sentry in debugMode 2023-09-04 09:35:38 +05:30
Neeraj Gupta
f9eb7c11fd New Translations (#225) 2023-09-03 06:04:05 +05:30
Crowdin Bot
e5c8e90889 New Crowdin translations by GitHub Action 2023-09-03 00:25:35 +00:00
Vishnu Mohandas
a4941d9975 Update README.md (#224) 2023-09-02 10:15:31 +05:30
Vishnu Mohandas
69f09c896c Update README.md 2023-09-02 10:08:07 +05:30
Neeraj Gupta
7f7954d4ea Update CONTRIBUTING.md 2023-09-02 10:04:06 +05:30
Neeraj Gupta
f736357b04 Add Contribution.md & Updated Readme (#223) 2023-09-02 10:01:47 +05:30
Neeraj Gupta
c413564a4b Add Contribution doc 2023-09-02 09:58:42 +05:30
Neeraj Gupta
445f3f20f0 Add option to install manually 2023-09-02 08:31:38 +05:30
Neeraj Gupta
05a36b051d Clean up configuration 2023-08-31 09:33:03 +05:30
Neeraj Gupta
75843814bd Merge branch 'main' into offline_mode 2023-08-29 15:34:14 +05:30
Neeraj Gupta
c3a38b5002 bump version: 1.0.56+56 2023-08-28 18:57:10 +05:30
Vishnu Mohandas
615809e383 Update _getProviderTitle to also split on parentheses (#221) 2023-08-25 01:44:29 +05:30
laurenspriem
10ca447f54 Update _getProviderTitle to split on parentheses 2023-08-24 22:05:11 +02:00
Neeraj Gupta
7fefadc808 New Translations (#220) 2023-08-24 20:08:10 +05:30
Crowdin Bot
991f7ce302 New Crowdin translations by GitHub Action 2023-08-24 12:09:15 +00:00
Neeraj Gupta
864fbd015d New Translations (#219) 2023-08-23 07:23:57 +05:30
Crowdin Bot
427cf73d9d New Crowdin translations by GitHub Action 2023-08-23 00:23:21 +00:00
Neeraj Gupta
8428af3b40 Obscure secret key during edit #193 (#218) 2023-08-22 23:00:23 +05:30
Alastair McNeill
c117473ce8 Issue #193: masked secret key 2023-08-22 17:12:12 +01:00
Neeraj Gupta
a90670e404 dart fix --apply (#216) 2023-08-22 10:48:50 +05:30
Neeraj Gupta
c758704a2e ignore lint for pb generate 2023-08-22 10:18:38 +05:30
Neeraj Gupta
0a010994ee dart fix --apply 2023-08-22 10:17:15 +05:30
vishnukvmd
d965a0239f Merge branch 'main' into offline_mode 2023-08-20 21:50:38 +05:30
vishnukvmd
a773f999fa Merge branch 'main' into offline_mode 2023-08-20 21:50:09 +05:30
vishnukvmd
3b710e9274 Revert "Generate and save localKey"
This reverts commit 945d6d6728.
2023-08-20 21:49:35 +05:30
Vishnu Mohandas
08090f6873 New Translations (#215) 2023-08-20 19:57:49 +05:30
Crowdin Bot
a59c5539b2 New Crowdin translations by GitHub Action 2023-08-20 12:01:06 +00:00
Vishnu Mohandas
75fb88ba1d Add instructions for adding custom icons (#214) 2023-08-20 03:57:57 +05:30
Vishnu Mohandas
e8416728b4 New Translations (#211) 2023-08-19 22:56:36 +05:30
vishnukvmd
d0481775ad Add instructions for adding custom icons 2023-08-19 22:55:04 +05:30
Neeraj Gupta
2960cb7bac Create a custom icon for Github (#213) 2023-08-19 22:35:10 +05:30
vishnukvmd
2b43825eef Create a custom icon for Github 2023-08-19 21:08:03 +05:30
Crowdin Bot
814fc98274 New Crowdin translations by GitHub Action 2023-08-19 12:07:29 +00:00
Neeraj Gupta
1ba113147f Flutter upgrade: v3.10.6 (#210) 2023-08-19 09:22:24 +05:30
Neeraj Gupta
630c3f8ec8 New Translations (#209) 2023-08-19 08:47:18 +05:30
Neeraj Gupta
f975895e4d [Flutter-submodule] Update to 3.10.6 2023-08-19 07:49:04 +05:30
Crowdin Bot
456e46052d New Crowdin translations by GitHub Action 2023-08-19 00:22:02 +00:00
Neeraj Gupta
0d9223e6ea Upgrade flutter: 3.10.6 2023-08-18 20:03:51 +05:30
Neeraj Gupta
cdd8d7906b Upgrade flutter: 3.10.6 2023-08-18 20:03:33 +05:30
Neeraj Gupta
384f37bb07 Aegis import + bump version (#207) 2023-08-18 17:03:53 +05:30
Neeraj Gupta
7cee6ad7e6 Clean up 2023-08-18 16:14:01 +05:30
Neeraj Gupta
6f51d0bd75 bump version for release 2023-08-18 15:59:29 +05:30
Neeraj Gupta
111c28d076 Add support for importing encrypt aegis vault 2023-08-18 15:59:10 +05:30
Neeraj Gupta
815059f11e Add support for plain text import from Aegis 2023-08-18 14:47:16 +05:30
Vishnu Mohandas
16dbf5b3bf Minor fixes (#206) 2023-08-18 09:07:41 +05:30
vishnukvmd
1c5d4201ea Prioritize custom icons 2023-08-18 08:50:48 +05:30
vishnukvmd
400de2d20e Return empty widget in case there's no icon 2023-08-18 08:50:24 +05:30
Neeraj Gupta
f4ee647144 New Translations (#205) 2023-08-18 06:06:16 +05:30
Vishnu Mohandas
f73df1f8b7 Icons (#204) 2023-08-18 06:05:47 +05:30
Crowdin Bot
0f76e30d0a New Crowdin translations by GitHub Action 2023-08-18 00:23:02 +00:00
Vishnu Mohandas
bc5f731a68 New Translations (#203) 2023-08-18 00:15:02 +05:30
vishnukvmd
51da1ab4c7 Update screenshots 2023-08-17 23:32:13 +05:30
vishnukvmd
909276fe2f Update README 2023-08-17 23:19:35 +05:30
vishnukvmd
041e90a8ed Setup custom icons 2023-08-17 23:16:10 +05:30
vishnukvmd
0ed1b15977 Remove debug statement 2023-08-17 23:04:01 +05:30
vishnukvmd
cdcc8e103f Setup icon loading with colors 2023-08-17 22:54:53 +05:30
vishnukvmd
ab2e3645f5 Add build ID 2023-08-17 22:54:21 +05:30
vishnukvmd
45afcf1e35 Load icons within pubspec 2023-08-17 22:12:07 +05:30
vishnukvmd
2711d3c2e3 Add dependency on Simple Icons 2023-08-17 22:07:27 +05:30
Crowdin Bot
028c2f7e4c New Crowdin translations by GitHub Action 2023-08-17 12:08:31 +00:00
Neeraj Gupta
b54e6a01f1 New Translations (#202) 2023-08-16 18:11:57 +05:30
Crowdin Bot
d551780d81 New Crowdin translations by GitHub Action 2023-08-16 12:08:41 +00:00
vishnukvmd
945d6d6728 Generate and save localKey 2023-08-16 14:00:19 +05:30
vishnukvmd
7d8a85b861 Modify Settings page to work for offline mode 2023-08-16 13:28:09 +05:30
vishnukvmd
54817cc100 Add an option in the onboarding page to opt in for offline mode 2023-08-16 13:27:55 +05:30
vishnukvmd
34a39a2a86 Redirect to home page if user has opted for offline mode 2023-08-16 13:27:30 +05:30
vishnukvmd
52e9567a12 Persist user preference for offline mode 2023-08-16 13:27:13 +05:30
vishnukvmd
0a05fc917b Update Podfile 2023-08-16 13:26:35 +05:30
Neeraj Gupta
e0512f687c New Translations (#201) 2023-08-14 18:08:19 +05:30
Crowdin Bot
2a3886c7c4 New Crowdin translations by GitHub Action 2023-08-14 12:09:07 +00:00
Neeraj Gupta
f8d3cb5d5b Show disable email verification for all users (#200) 2023-08-14 10:08:42 +05:30
Neeraj Gupta
bf9449ea69 Bump version to 1.0.54+54 2023-08-14 10:07:15 +05:30
Neeraj Gupta
2b827fd5d5 New Translations (#199) 2023-08-14 10:04:03 +05:30
Neeraj Gupta
31ffb48e0f Disable emailMFA: request for password if SRP setup is not done 2023-08-14 10:02:37 +05:30
Neeraj Gupta
648f68d6a6 Page for password verification 2023-08-14 09:46:12 +05:30
Crowdin Bot
993fd16075 New Crowdin translations by GitHub Action 2023-08-14 00:24:05 +00:00
Neeraj Gupta
16b2602423 Minor imprvements & fixes (#198) 2023-08-13 11:08:37 +05:30
Neeraj Gupta
90103c67ae Always show the dialog to disable email verification 2023-08-13 11:05:17 +05:30
Neeraj Gupta
4c1783a54b Disable barrier dismissibility for session expired dialog, resolves #166 2023-08-13 11:04:11 +05:30
Neeraj Gupta
65e5a8f900 Dismiss dialog before navigation 2023-08-13 10:28:32 +05:30
Neeraj Gupta
0c4e5b7da6 Improve UX for login via password 2023-08-13 10:27:48 +05:30
Neeraj Gupta
6f032eeba3 Fix qrcode for dark mode, resolves #197 2023-08-13 10:06:47 +05:30
Neeraj Gupta
edc1023caf Fix export for macOS & iPadOS, resolves #196 2023-08-13 10:01:12 +05:30
Neeraj Gupta
c8e8240540 Extract strings 2023-08-12 12:45:55 +05:30
Neeraj Gupta
718fd294a6 Fix update check for Github Channel (#195) 2023-08-12 12:43:36 +05:30
Neeraj Gupta
19942db88d Refactor: route to homePage post import 2023-08-12 12:13:11 +05:30
Neeraj Gupta
287c23038d Update review url for playstore 2023-08-12 12:02:18 +05:30
Neeraj Gupta
4d13ca6c1d Use env variable to identify Github APKs 2023-08-12 11:51:54 +05:30
Neeraj Gupta
9c1e24f8aa New Translations (#191) 2023-08-12 06:03:33 +05:30
Crowdin Bot
8c30cf71b2 New Crowdin translations by GitHub Action 2023-08-12 00:22:12 +00:00
Neeraj Gupta
c1097bf251 Update Social + bump version to 1.0.52+52 (#190) 2023-08-11 17:24:04 +05:30
Neeraj Gupta
3e96118079 Merge branch 'main' into social 2023-08-11 17:10:11 +05:30
Neeraj Gupta
ace3754370 Update case 2023-08-11 17:01:06 +05:30
Neeraj Gupta
3f0cd893b2 Bump version to 1.0.52+52 2023-08-11 16:57:36 +05:30
Neeraj Gupta
66ebcb6701 Add link to blog and shop 2023-08-11 16:57:12 +05:30
Neeraj Gupta
bd18e966f5 Add option to rate 2023-08-11 16:53:59 +05:30
Vishnu Mohandas
ccbe0953d8 New Translations (#189) 2023-08-11 07:12:05 +05:30
Crowdin Bot
a965b859ff New Crowdin translations by GitHub Action 2023-08-11 00:22:37 +00:00
Neeraj Gupta
683d44a83c Fix bug in editing code with username in non-ascii format (#188) 2023-08-10 12:33:13 +05:30
Neeraj Gupta
7d5bbfdadd Add test 2023-08-10 12:25:47 +05:30
Neeraj Gupta
81fcbac0ec Fix: use safeDecode while decoding account & issuer 2023-08-10 11:59:19 +05:30
Neeraj Gupta
32e74929ce New Translations (#186) 2023-08-10 06:34:24 +05:30
Crowdin Bot
d6f20e827a New Crowdin translations by GitHub Action 2023-08-10 00:29:23 +00:00
Neeraj Gupta
67ce577fe4 Add option to view QR code (#184) 2023-08-09 15:42:41 +05:30
Neeraj Gupta
1d7abe4023 Fix bug 2023-08-09 14:27:09 +05:30
Neeraj Gupta
70c72a45b7 Calculate qr size dynamatically 2023-08-09 14:16:18 +05:30
Neeraj Gupta
ea6eb1368c Add support for viewing qrCode 2023-08-09 14:13:12 +05:30
Neeraj Gupta
28f94df354 Minor fixes (#183) 2023-08-09 12:35:56 +05:30
Neeraj Gupta
e5812ed09a Add option to suggest features 2023-08-09 12:07:14 +05:30
Neeraj Gupta
08eac475d1 -mRemove unused import 2023-08-09 12:01:34 +05:30
Neeraj Gupta
306f7fdab7 Fix url for github 2023-08-09 12:00:37 +05:30
Vishnu Mohandas
4257dac83e New Translations (#180) 2023-08-09 09:41:48 +05:30
Crowdin Bot
ef8294adb3 New Crowdin translations by GitHub Action 2023-08-09 00:28:57 +00:00
Neeraj Gupta
dc5cb41f95 Update copies and hook for import & faq on Empty home page (#179) 2023-08-08 10:26:40 +05:30
Neeraj Gupta
caeb0f4e92 Remove unused import 2023-08-08 10:05:40 +05:30
Neeraj Gupta
e8ffaa5278 Bump version 2023-08-08 10:02:23 +05:30
Neeraj Gupta
79b5b835b4 Fix: Check canPop before pop 2023-08-08 09:59:41 +05:30
Neeraj Gupta
2cd8ff6a46 EmptyState: Add hook to import code and faq 2023-08-08 09:59:04 +05:30
Neeraj Gupta
911471cd98 Remove dead code 2023-08-08 09:49:44 +05:30
Neeraj Gupta
4944eff546 Switch to new actionSheet for delete code 2023-08-08 09:45:02 +05:30
Neeraj Gupta
9f470ac709 Update copy for Google auth import 2023-08-08 09:39:54 +05:30
Neeraj Gupta
5d682989cd Add faq for auth (#178) 2023-08-08 09:10:07 +05:30
Neeraj Gupta
b5d5c283a1 bump version 2023-08-08 08:42:40 +05:30
Neeraj Gupta
00fc97129b Remove unused import 2023-08-08 08:39:07 +05:30
Neeraj Gupta
1f6ef8f941 Add faq for auth 2023-08-08 08:38:40 +05:30
Neeraj Gupta
e24fda9ce6 Move UI options (#177) 2023-08-07 19:04:31 +05:30
Neeraj Gupta
98e9cfc44a Move logout and delete options under account 2023-08-07 16:49:32 +05:30
Neeraj Gupta
3db76c7e1b Recovery key under security 2023-08-07 16:45:51 +05:30
Neeraj Gupta
a08c01b49b Document encrypted export format (#175) 2023-08-03 17:20:46 +05:30
Neeraj Gupta
cf862d291d Add support for toggling email MFA (#174) 2023-08-03 16:49:39 +05:30
Neeraj Gupta
007de8bb87 Document encrypted export format 2023-08-03 16:31:41 +05:30
Neeraj Gupta
5dbeb36be9 Minor update 2023-08-02 17:39:00 +05:30
Neeraj Gupta
45e720917d Minor refactor + comment 2023-08-02 16:41:05 +05:30
Neeraj Gupta
a8c2bc2d9a Fix UI refresh 2023-08-02 16:35:57 +05:30
Neeraj Gupta
10a26131ac Extract string 2023-08-02 16:33:10 +05:30
Neeraj Gupta
8394ec72ce Show generic error 2023-08-02 13:39:45 +05:30
Neeraj Gupta
895f9bf410 Bump version 2023-08-02 13:37:54 +05:30
Neeraj Gupta
b8c4711b8d Fetch user profile on Sign in 2023-08-02 13:37:39 +05:30
Neeraj Gupta
553a6ce732 Show option to enable/disable email MFA 2023-08-02 13:17:41 +05:30
Neeraj Gupta
89774972f8 Handle emailMFA flag during login 2023-08-02 13:16:48 +05:30
Neeraj Gupta
58cf5ab4c3 HOTP next counter (#173) 2023-08-01 17:58:48 +05:30
Neeraj Gupta
e401503948 Add support for incrementing hotp counter 2023-08-01 17:34:58 +05:30
Neeraj Gupta
80d97734fd Add support for parsing counter 2023-08-01 15:50:28 +05:30
Neeraj Gupta
e6a6f0a76f Remove bad tests 2023-08-01 15:50:16 +05:30
Neeraj Gupta
8a3a64adcc Google auth import (#172) 2023-08-01 13:22:06 +05:30
Neeraj Gupta
25b10efec4 Add support for importing from Google Authenticator 2023-08-01 12:51:05 +05:30
Neeraj Gupta
2879f9efd7 Add dependency on base32 2023-08-01 12:50:44 +05:30
Neeraj Gupta
39d415bab6 HomePage: Call super.initiate() first 2023-08-01 12:50:24 +05:30
Neeraj Gupta
010c32ecf7 Fix: UI bug 2023-08-01 12:41:04 +05:30
Neeraj Gupta
2637cd60a0 Add generated proto model 2023-08-01 08:09:26 +05:30
Neeraj Gupta
d67f7db834 Add depedency on protobuf 2023-08-01 08:07:41 +05:30
Neeraj Gupta
bd8cc72dfd Add proto for Google Auth 2023-08-01 08:04:45 +05:30
Neeraj Gupta
5cef1cd0e6 Show error if user tries to import zip 2023-08-01 07:54:40 +05:30
Neeraj Gupta
f3bd45f31b Add dependency on archive pkg 2023-07-31 21:51:19 +05:30
Neeraj Gupta
503d06edec RaivoImport: Minor refactor 2023-07-31 21:51:06 +05:30
Neeraj Gupta
b10ee19a50 Login v2 (#156) 2023-07-31 17:52:00 +05:30
Neeraj Gupta
108298b52a Merge branch 'main' into login-v2 2023-07-31 17:36:15 +05:30
Neeraj Gupta
8016c11a2b Support for importing ente encrypted export (#171) 2023-07-31 17:29:38 +05:30
Neeraj Gupta
46d96ef779 Support for importing ente encrypted export 2023-07-31 17:26:56 +05:30
Neeraj Gupta
c666bbb6e8 Fix alignment of codes list (#170) 2023-07-31 16:20:21 +05:30
Neeraj Gupta
c09cb51ef6 Merge branch 'main' into login-v2 2023-07-31 16:07:39 +05:30
Neeraj Gupta
d41cae9903 Merge branch 'main' into login-v2 2023-07-31 16:07:17 +05:30
Neeraj Gupta
fb8aa013fa Export in encrypted format + import from Ravio (#168) 2023-07-31 16:06:51 +05:30
Neeraj Gupta
9070f12edc Merge branch 'main' into fix_165 2023-07-31 15:58:00 +05:30
Neeraj Gupta
f10bc75668 Fix alginment of codes list 2023-07-31 15:56:05 +05:30
Neeraj Gupta
d8182225d3 Make sort case-insensitive (#169) 2023-07-31 15:50:48 +05:30
Neeraj Gupta
5a245ed1ef Make sort case-insensitive 2023-07-31 15:47:54 +05:30
Neeraj Gupta
2cb6275fdf Fix minor bug 2023-07-31 15:43:02 +05:30
Neeraj Gupta
4e4a773c1a Remove commented out code 2023-07-31 15:41:17 +05:30
Neeraj Gupta
50b74367be Extract strings 2023-07-31 15:39:19 +05:30
Neeraj Gupta
94eb5d8c97 Add support for importing raivo codes 2023-07-31 15:26:08 +05:30
Neeraj Gupta
f91d3876d0 Merge branch 'main' into login-v2 2023-07-31 13:12:38 +05:30
Neeraj Gupta
471621880f Fix bug in closing progressDialog 2023-07-31 13:06:00 +05:30
Neeraj Gupta
562f5667eb Show multiple import options 2023-07-31 13:00:38 +05:30
Neeraj Gupta
ea770cfa18 Export auth codes 2023-07-31 10:45:07 +05:30
Neeraj Gupta
07f63bc07c Add model for exporting encrypted codes 2023-07-29 21:10:41 +05:30
Neeraj Gupta
dd90d57675 Update UI 2023-07-29 21:10:24 +05:30
Neeraj Gupta
f40df0b819 Show option to export encrypted or plain text codes 2023-07-29 21:00:01 +05:30
Neeraj Gupta
7a4125a847 Move settings->data files 2023-07-29 16:03:08 +05:30
Neeraj Gupta
a53a13b746 New Translations (#163) 2023-07-28 09:42:53 +05:30
Crowdin Bot
d48fd18749 New Crowdin translations by GitHub Action 2023-07-28 00:26:47 +00:00
Neeraj Gupta
a70d04f704 New Translations (#162) 2023-07-27 09:16:11 +05:30
Crowdin Bot
51ec1d5b0c New Crowdin translations by GitHub Action 2023-07-27 00:26:42 +00:00
Vishnu Mohandas
7827b7dbd8 New Translations (#158) 2023-07-25 22:21:12 +05:30
Crowdin Bot
26af0b4689 New Crowdin translations by GitHub Action 2023-07-25 12:09:05 +00:00
Neeraj Gupta
261496c417 New Translations (#157) 2023-07-25 10:43:08 +05:30
Crowdin Bot
d60f0c3841 New Crowdin translations by GitHub Action 2023-07-25 00:30:33 +00:00
Neeraj Gupta
9a80bf2cb2 Use initial 128bit as loginKey 2023-07-24 15:11:43 +05:30
Neeraj Gupta
a88cd75a5c LoginV2 changes 2023-07-24 11:47:01 +05:30
Neeraj Gupta
37ce8a55db LoginV2 changes 2023-07-24 11:43:17 +05:30
Neeraj Gupta
42b3dee44a Update migration guide (#154) 2023-07-24 08:57:55 +05:30
Neeraj Gupta
4ad2627b8b Add LoginPasswordVerificationPage page 2023-07-20 18:07:43 +05:30
green
b6371179ff Update authy.md
got rid of "there is" because i forgot to delete that for some reason when editing my guide before publishing it
2023-07-20 14:21:24 +02:00
green
9d3a998c42 Update authy.md 2023-07-20 14:06:42 +02:00
green
2ce7ed87e1 Update authy.md
I was going to add a recommendation to delete the unencrypted files that were made during migration, but I forgot to when I wrote the guide and now I've added it
2023-07-20 14:01:48 +02:00
Neeraj Gupta
d13c7bfd3a Login V2 changes - part 2 2023-07-20 17:26:19 +05:30
Neeraj Gupta
ac82e1a004 LoginV2 changes 2023-07-20 16:40:00 +05:30
Neeraj Gupta
5a0927ea82 Add dependency on pointycastle 2023-07-20 16:26:30 +05:30
Neeraj Gupta
dad3d2fa51 Add model for SRP 2023-07-20 16:02:57 +05:30
Neeraj Gupta
16d90d33f5 Upgrade CryptoUtil 2023-07-20 15:59:23 +05:30
Neeraj Gupta
396cd87bbe Lint: ignore flutter submodule 2023-07-20 15:58:51 +05:30
Neeraj Gupta
68b7f3d265 Switch to forked version for computer 2023-07-20 15:49:47 +05:30
Neeraj Gupta
2835f9777b New Translations (#151) 2023-07-17 08:02:25 +05:30
Crowdin Bot
8cd030e62e New Crowdin translations by GitHub Action 2023-07-17 00:35:14 +00:00
124 changed files with 7040 additions and 1952 deletions

View File

@@ -1,4 +1,4 @@
name: Flutter CI
name: release
# This workflow is triggered on pushes to the repository.
on:
@@ -25,7 +25,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
flutter-version: "3.7.3"
flutter-version: "3.10.6"
# Fetch sub modules
- run: git submodule update --init --recursive
@@ -41,7 +41,7 @@ jobs:
# Build independent apk.
- name: Build
run: flutter build apk --release --flavor independent && mv build/app/outputs/flutter-apk/app-independent-release.apk build/app/outputs/flutter-apk/ente-auth.apk
run: flutter build apk --release --flavor independent --dart-define=app.flavor=independent && mv build/app/outputs/flutter-apk/app-independent-release.apk build/app/outputs/flutter-apk/ente-auth.apk
env:
SIGNING_KEY_PATH: "/home/runner/work/_temp/keystore/ente_auth_key.jks"
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
@@ -50,7 +50,7 @@ jobs:
# Build Play store aab.
- name: Build
run: flutter build appbundle --release --flavor playstore
run: flutter build appbundle --release --flavor playstore --dart-define=app.flavor=playstore
env:
SIGNING_KEY_PATH: "/home/runner/work/_temp/keystore/ente_auth_key.jks"
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}

3
.gitmodules vendored
View File

@@ -6,3 +6,6 @@
path = flutter
url = https://github.com/flutter/flutter.git
branch = stable
[submodule "assets/simple-icons"]
path = assets/simple-icons
url = https://github.com/simple-icons/simple-icons.git

56
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,56 @@
# Contributing
Thank you for showing interest in contributing to ente Authenticator. There are a couple of ways to help
out. This document contains some general guidelines for each type of
contribution.
## Translations
[![Crowdin](https://badges.crowdin.net/ente-authenticator-app/localized.svg)](https://crowdin.com/project/ente-authenticator-app)
We use [Crowdin](https://crowdin.com/project/ente-authenticator-app) to crowdsource
translations of ente Authenticator.
If your language is not listed for translation, feel free to [create a GitHub issue](https://github.com/ente-io/auth/issues/new?title=Request+for+New+Language+Translation&body=Language+name%3A) to have it added.
## Icons
ente Auth supports the icon pack provided by
[simple-icons](https://github.com/simple-icons/simple-icons).
If you would like to add your own custom icon, please open a pull-request
with the relevant SVG and color
code ([example PR](https://github.com/ente-io/auth/pull/213/files)).
## Development
If you're planning on adding a new feature or making other changes, please
discuss it with us by creating [an
issue](https://github.com/ente-io/auth/issues/new)
on GitHub. Discussing your idea with us first ensures that everyone is on the
same page before you start working on your change.
### 💻 Setup
1. [Install Flutter v3.10.6](https://flutter.dev/docs/get-started/install)
2. Clone this repository with `git clone git@github.com:ente-io/auth.git`
3. Pull in all submodules with `git submodule update --init --recursive`
4. For Android, run
```bash
flutter run -t lib/main.dart --flavor independent
```
5. For iOS, run `flutter run`
#### Localization
If the feature requires adding new strings, you can do that by following these steps:
1. Add a new entry inside [app_en.arb](https://github.com/ente-io/auth/blob/main/lib/l10n/arb/app_en.arb) (Remember to save)
2. In your dart file, add follwing import
```dart
import "package:ente_auth/l10n/l10n.dart";
```
3. Refer to the string using `context.l10n.<keyName>`. For example
```dart
context.l10n.account
```

View File

@@ -1,5 +1,9 @@
# ente Authenticator
![Build](https://github.com/ente-io/auth/actions/workflows/ci.yml/badge.svg?branch=)
[![Crowdin](https://badges.crowdin.net/ente-authenticator-app/localized.svg)](https://crowdin.com/project/ente-authenticator-app)
[![Matrix](https://img.shields.io/matrix/ente:matrix.org?color=blue)](https://matrix.to/#/#ente:matrix.org)
ente's Authenticator app helps you generate and store 2 step verification (2FA)
tokens on your mobile devices.
@@ -25,22 +29,23 @@ your devices. Every new device you sign into will have access to these tokens.
### Offline Mode
ente generates 2FA tokens offline, so your network connectivity will not get in
the way of your workflow.
the way of your workflow. If you wish to use the app without an account for e2ee
backups, you can do that as well.
### Import and Export Tokens
You can add tokens to ente by one of the following methods:
1. Scanning a QR code
2. Manually entering (copy-pasting) a 2FA secret
3. Bulk importing from a file that contains a list of codes in the following
format:
```
otpauth://totp/provider.com:you@email.com?secret=YOUR_SECRET
```
The codes maybe separated by new lines or commas.
3. Bulk importing from other popular 2FA apps and from a file that contains a list of codes in the following format:.
```
otpauth://totp/provider.com:you@email.com?secret=YOUR_SECRET
```
You can also export the codes you have added to ente, to an **unencrypted** text
file, that adheres to the above format.
You can export the codes you have added to ente, to either an **encrypted** or
plain text file. The encrypted backups can be accessed through the app, as well
as a standalone CLI tool. [Read
more](migration-guides/encrypted_export.md#how-to-use-the-exported-data).
## 📲 Download
@@ -71,16 +76,10 @@ src="https://ente.io/static/ed265c3abdcd3efa5e29f64b927bcb44/e230a/play-store-ba
src="https://user-images.githubusercontent.com/1161789/154795157-c4468ff9-97fd-46f3-87fe-dca789d8733a.png">
</a>
### Web
### Web / Desktop
You can view your 2FA codes at [auth.ente.io](https://auth.ente.io). For adding or managing your secrets, please use our mobile app.
### Desktop
Support for desktop platforms (Linux, Windows and older Macs) is a [work in
progress](https://github.com/ente-io/auth/tree/desktop).
Please ⭐ this repo to be notified of updates.
## 🔩 Architecture
@@ -89,7 +88,7 @@ The architecture that powers end-to-end encrypted storage and sync of your
tokens has been documented [here](architecture/README.md).
## 🧑‍💻 Building from source
## 🧑‍💻 Build from source
1. [Install Flutter](https://flutter.dev/docs/get-started/install)
2. Clone this repository with `git clone git@github.com:ente-io/auth.git`
@@ -101,20 +100,27 @@ For maintainers, there is [additional documentation](RELEASES.md) on
automatically publishing the main branch to App store, Play store and GitHub
releases.
## 🙋‍♂️ Support
## 🧑‍🔧 Contribute
Please refer to our [contribution guide](./CONTRIBUTING.md) if you wish to add
an icon, assist with translation, or develop new features.
You can also support us by giving this project a ⭐ star on GitHub or by leaving
a review on
[PlayStore](https://play.google.com/store/apps/details?id=io.ente.auth),
[AppStore](https://apps.apple.com/us/app/ente-authenticator/id6444121398) or
[AlternativeTo](https://alternativeto.net/software/ente-authenticator/).
## 🙋‍♂️ Help
If you need help, please reach out to support@ente.io, and a human will get in
touch with you.
If you have feature requests, please create a [GitHub issue](https://github.com/ente-io/auth/issues/).
If you wish to support us, please ⭐
[star](https://github.com/ente-io/auth/stargazers) this project.
## 🙌 Translation
[![Crowdin](https://badges.crowdin.net/ente-authenticator-app/localized.svg)](https://crowdin.com/project/ente-authenticator-app)
If you're interested in helping out with translation, please visit our [Crowdin project](https://crowdin.com/project/ente-authenticator-app) to get started. Thank you for your support.
## 💜 Community

View File

@@ -48,4 +48,5 @@ analyzer:
avoid_renaming_method_parameters: ignore # incorrect warnings for `equals` overrides
exclude:
- thirdparty/**
- thirdparty/**
- flutter/**

View File

@@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}

View File

@@ -0,0 +1 @@
f23611a675a8c9bc71eb16e8a1108cf8

View File

@@ -0,0 +1,12 @@
{
"icons": [
{
"title": "ente",
"hex": "1DB954"
},
{
"title": "Github",
"hex": "858585"
}
]
}

View File

@@ -0,0 +1,3 @@
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4.06803 7.096C3.33203 7.096 2.68403 6.952 2.12403 6.664C1.57203 6.376 1.14403 5.984 0.840033 5.488C0.536033 4.984 0.384033 4.412 0.384033 3.772C0.384033 3.124 0.532033 2.552 0.828033 2.056C1.13203 1.552 1.54403 1.16 2.06403 0.879997C2.58403 0.591998 3.17203 0.447998 3.82803 0.447998C4.46003 0.447998 5.02803 0.583998 5.53203 0.855998C6.04403 1.12 6.44803 1.504 6.74403 2.008C7.04003 2.504 7.18803 3.1 7.18803 3.796C7.18803 3.868 7.18403 3.952 7.17603 4.048C7.16803 4.136 7.16003 4.22 7.15203 4.3H1.90803V3.208H6.16803L5.44803 3.532C5.44803 3.196 5.38003 2.904 5.24403 2.656C5.10803 2.408 4.92003 2.216 4.68003 2.08C4.44003 1.936 4.16003 1.864 3.84003 1.864C3.52003 1.864 3.23603 1.936 2.98803 2.08C2.74803 2.216 2.56003 2.412 2.42403 2.668C2.28803 2.916 2.22003 3.212 2.22003 3.556V3.844C2.22003 4.196 2.29603 4.508 2.44803 4.78C2.60803 5.044 2.82803 5.248 3.10803 5.392C3.39603 5.528 3.73203 5.596 4.11603 5.596C4.46003 5.596 4.76003 5.544 5.01603 5.44C5.28003 5.336 5.52003 5.18 5.73603 4.972L6.73203 6.052C6.43603 6.388 6.06403 6.648 5.61603 6.832C5.16803 7.008 4.65203 7.096 4.06803 7.096Z" fill="black" style="fill:black;fill:black;fill-opacity:1;"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1 @@
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub</title><path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>

After

Width:  |  Height:  |  Size: 822 B

1
assets/simple-icons Submodule

Submodule assets/simple-icons added at 7e1ad45175

Submodule flutter updated: b06b8b2710...f468f3366c

View File

@@ -81,20 +81,22 @@ PODS:
- Flutter
- MTBBarcodeScanner
- Reachability (3.2)
- SDWebImage (5.15.0):
- SDWebImage/Core (= 5.15.0)
- SDWebImage/Core (5.15.0)
- Sentry/HybridSDK (7.31.5)
- SDWebImage (5.17.0):
- SDWebImage/Core (= 5.17.0)
- SDWebImage/Core (5.17.0)
- Sentry/HybridSDK (8.9.1):
- SentryPrivate (= 8.9.1)
- sentry_flutter (0.0.1):
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 7.31.5)
- Sentry/HybridSDK (= 8.9.1)
- SentryPrivate (8.9.1)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite (0.0.2):
- sqflite (0.0.3):
- Flutter
- FMDB (>= 2.7.5)
- SwiftyGif (5.4.4)
@@ -121,11 +123,11 @@ DEPENDENCIES:
- move_to_background (from `.symlinks/plugins/move_to_background/ios`)
- open_filex (from `.symlinks/plugins/open_filex/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`)
- sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- uni_links (from `.symlinks/plugins/uni_links/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
@@ -140,6 +142,7 @@ SPEC REPOS:
- Reachability
- SDWebImage
- Sentry
- SentryPrivate
- SwiftyGif
- Toast
@@ -177,7 +180,7 @@ EXTERNAL SOURCES:
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/ios"
:path: ".symlinks/plugins/path_provider_foundation/darwin"
qr_code_scanner:
:path: ".symlinks/plugins/qr_code_scanner/ios"
sentry_flutter:
@@ -185,7 +188,7 @@ EXTERNAL SOURCES:
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite:
:path: ".symlinks/plugins/sqflite/ios"
uni_links:
@@ -207,27 +210,28 @@ SPEC CHECKSUMS:
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
flutter_sodium: c84426b4de738514b5b66cfdeb8a06634e72fe0b
fluttertoast: eb263d302cc92e04176c053d2385237e9f43fad0
fluttertoast: fafc4fa4d01a6a9e4f772ecd190ffa525e9e2d9c
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
local_auth_ios: c6cf091ded637a88f24f86a8875d8b0f526e2605
move_to_background: 39a5b79b26d577b0372cbe8a8c55e7aa9fcd3a2d
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
open_filex: 6e26e659846ec990262224a12ef1c528bb4edbe4
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
SDWebImage: 9bec4c5cdd9579e1f57104735ee0c37df274d593
Sentry: 4c9babff9034785067c896fd580b1f7de44da020
sentry_flutter: b10ae7a5ddcbc7f04648eeb2672b5747230172f1
SDWebImage: 750adf017a315a280c60fde706ab1e552a3ae4e9
Sentry: e3203780941722a1fcfee99e351de14244c7f806
sentry_flutter: 8f0ffd53088e6a4d50c095852c5cad9e4405025c
SentryPrivate: 5e3683390f66611fc7c6215e27645873adb55d13
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
uni_links: d97da20c7701486ba192624d99bffaaffcfc298a
url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
PODFILE CHECKSUM: b4e3a7eabb03395b66e81fc061789f61526ee6bb

View File

@@ -1,4 +1,3 @@
import 'dart:async';
import 'dart:io';
@@ -12,6 +11,7 @@ import "package:ente_auth/l10n/l10n.dart";
import 'package:ente_auth/locale.dart';
import "package:ente_auth/onboarding/view/onboarding_page.dart";
import 'package:ente_auth/services/update_service.dart';
import 'package:ente_auth/services/user_service.dart';
import 'package:ente_auth/ui/home_page.dart';
import 'package:ente_auth/ui/settings/app_update_dialog.dart';
import 'package:flutter/foundation.dart';
@@ -49,6 +49,7 @@ class _AppState extends State<App> {
}
});
_signedInEvent = Bus.instance.on<SignedInEvent>().listen((event) {
UserService.instance.getUserDetailsV2().ignore();
if (mounted) {
setState(() {});
}
@@ -127,7 +128,8 @@ class _AppState extends State<App> {
Map<String, WidgetBuilder> get _getRoutes {
return {
"/": (context) => Configuration.instance.hasConfiguredAccount()
"/": (context) => Configuration.instance.hasConfiguredAccount() ||
Configuration.instance.hasOptedForOfflineMode()
? const HomePage()
: const OnboardingPage(),
};

View File

@@ -38,9 +38,7 @@ final darkTheme = ThemeData(
fontFamily: "Inter",
brightness: Brightness.dark,
scaffoldBackgroundColor: Colors.black,
backgroundColor: Colors.black,
appBarTheme: const AppBarTheme(color: Colors.orange),
colorScheme: const ColorScheme.dark(primary: Colors.white),
textTheme: _buildTextTheme(Colors.white),
outlinedButtonTheme: buildOutlinedButtonThemeData(
bgDisabled: Colors.grey.shade500,
@@ -59,25 +57,25 @@ final darkTheme = ThemeData(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(6),
),
),
), colorScheme: const ColorScheme.dark(primary: Colors.white).copyWith(background: Colors.black),
);
TextTheme _buildTextTheme(Color textColor) {
return const TextTheme().copyWith(
headline4: TextStyle(
headlineMedium: TextStyle(
color: textColor,
fontSize: 32,
fontWeight: FontWeight.w700,
fontFamily: "Inter",
),
headline5: TextStyle(
headlineSmall: TextStyle(
color: textColor,
fontSize: 24,
fontWeight: FontWeight.w600,
fontFamily: "Inter",
),
// AG: Body
headline6: TextStyle(
titleLarge: TextStyle(
color: textColor,
fontSize: 18,
fontFamily: "Inter",
@@ -92,31 +90,31 @@ TextTheme _buildTextTheme(Color textColor) {
height: 28,
),
subtitle1: TextStyle(
titleMedium: TextStyle(
color: textColor,
fontFamily: "Inter",
fontSize: 16,
fontWeight: FontWeight.w500,
),
subtitle2: TextStyle(
titleSmall: TextStyle(
color: textColor,
fontFamily: "Inter",
fontSize: 14,
fontWeight: FontWeight.w500,
),
bodyText1: TextStyle(
bodyLarge: TextStyle(
fontFamily: "Inter",
color: textColor,
fontSize: 16,
fontWeight: FontWeight.w500,
),
bodyText2: TextStyle(
bodyMedium: TextStyle(
fontFamily: "Inter",
color: textColor,
fontSize: 14,
fontWeight: FontWeight.w500,
),
caption: TextStyle(
bodySmall: TextStyle(
color: textColor.withOpacity(0.6),
fontSize: 14,
fontWeight: FontWeight.w500,

View File

@@ -1,10 +1,10 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io' as io;
import 'dart:typed_data';
import 'package:bip39/bip39.dart' as bip39;
import 'package:ente_auth/core/constants.dart';
import 'package:ente_auth/core/errors.dart';
import 'package:ente_auth/core/event_bus.dart';
import 'package:ente_auth/events/signed_in_event.dart';
import 'package:ente_auth/events/signed_out_event.dart';
@@ -18,6 +18,7 @@ import 'package:flutter_sodium/flutter_sodium.dart';
import 'package:logging/logging.dart';
import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:tuple/tuple.dart';
class Configuration {
Configuration._privateConstructor();
@@ -29,15 +30,23 @@ class Configuration {
);
static const emailKey = "email";
static const keyAttributesKey = "key_attributes";
static const keyKey = "key";
static const keyShouldShowLockScreen = "should_show_lock_screen";
static const lastTempFolderClearTimeKey = "last_temp_folder_clear_time";
static const keyKey = "key";
static const secretKeyKey = "secret_key";
static const authSecretKeyKey = "auth_secret_key";
static const offlineAuthSecretKey = "offline_auth_secret_key";
static const tokenKey = "token";
static const encryptedTokenKey = "encrypted_token";
static const userIDKey = "user_id";
static const hasMigratedSecureStorageKey = "has_migrated_secure_storage";
static const hasOptedForOfflineModeKey = "has_opted_for_offline_mode";
final List<String> onlineSecureKeys = [
keyKey,
secretKeyKey,
authSecretKeyKey
];
final kTempFolderDeletionTimeBuffer = const Duration(days: 1).inMicroseconds;
@@ -45,28 +54,20 @@ class Configuration {
String? _cachedToken;
late String _documentsDirectory;
String? _key;
late SharedPreferences _preferences;
String? _key;
String? _secretKey;
String? _authSecretKey;
String? _offlineAuthKey;
late FlutterSecureStorage _secureStorage;
late String _tempDirectory;
late String _thumbnailCacheDirectory;
// 6th July 22: Remove this after 3 months. Hopefully, active users
// will migrate to newer version of the app, where shared media is stored
// on appSupport directory which OS won't clean up automatically
late String _sharedTempMediaDirectory;
late String _sharedDocumentsMediaDirectory;
String? _volatilePassword;
final _secureStorageOptionsIOS = const IOSOptions(
accessibility: KeychainAccessibility.first_unlock_this_device,
);
// const IOSOptions(accessibility: IOSAccessibility.first_unlock);
Future<void> init() async {
_preferences = await SharedPreferences.getInstance();
_secureStorage = const FlutterSecureStorage();
@@ -88,15 +89,27 @@ class Configuration {
_logger.warning(e);
}
tempDirectory.createSync(recursive: true);
final tempDirectoryPath = (await getTemporaryDirectory()).path;
_thumbnailCacheDirectory = tempDirectoryPath + "/thumbnail-cache";
io.Directory(_thumbnailCacheDirectory).createSync(recursive: true);
_sharedTempMediaDirectory = tempDirectoryPath + "/ente-shared-media";
io.Directory(_sharedTempMediaDirectory).createSync(recursive: true);
_sharedDocumentsMediaDirectory = _documentsDirectory + "/ente-shared-media";
io.Directory(_sharedDocumentsMediaDirectory).createSync(recursive: true);
await _initOnlineAccount();
await _initOfflineAccount();
}
Future<void> _initOfflineAccount() async {
_offlineAuthKey = await _secureStorage.read(
key: offlineAuthSecretKey,
iOptions: _secureStorageOptionsIOS,
);
}
Future<void> _initOnlineAccount() async {
if (!_preferences.containsKey(tokenKey)) {
await _secureStorage.deleteAll(iOptions: _secureStorageOptionsIOS);
for (final key in onlineSecureKeys) {
unawaited(
_secureStorage.delete(
key: key,
iOptions: _secureStorageOptionsIOS,
),
);
}
} else {
_key = await _secureStorage.read(
key: keyKey,
@@ -113,13 +126,17 @@ class Configuration {
if (_key == null) {
await logout(autoLogout: true);
}
await _migrateSecurityStorageToFirstUnlock();
}
}
Future<void> logout({bool autoLogout = false}) async {
await _preferences.clear();
await _secureStorage.deleteAll(iOptions: _secureStorageOptionsIOS);
for (String key in onlineSecureKeys) {
await _secureStorage.delete(
key: key,
iOptions: _secureStorageOptionsIOS,
);
}
await AuthenticatorDB.instance.clearTable();
_key = null;
_cachedToken = null;
@@ -146,6 +163,7 @@ class Configuration {
utf8.encode(password) as Uint8List,
kekSalt,
);
final loginKey = await CryptoUtil.deriveLoginKey(derivedKeyResult.key);
// Encrypt the key with this derived key
final encryptedKeyData =
@@ -175,10 +193,12 @@ class Configuration {
Sodium.bin2hex(recoveryKey),
Sodium.bin2base64(keyPair.sk),
);
return KeyGenResult(attributes, privateAttributes);
return KeyGenResult(attributes, privateAttributes, loginKey);
}
Future<KeyAttributes> updatePassword(String password) async {
Future<Tuple2<KeyAttributes, Uint8List>> getAttributesForNewPassword(
String password,
) async {
// Get master key
final masterKey = getKey();
@@ -189,6 +209,7 @@ class Configuration {
utf8.encode(password) as Uint8List,
kekSalt,
);
final loginKey = await CryptoUtil.deriveLoginKey(derivedKeyResult.key);
// Encrypt the key with this derived key
final encryptedKeyData =
@@ -196,42 +217,39 @@ class Configuration {
final existingAttributes = getKeyAttributes();
return existingAttributes!.copyWith(
final updatedAttributes = existingAttributes!.copyWith(
kekSalt: Sodium.bin2base64(kekSalt),
encryptedKey: Sodium.bin2base64(encryptedKeyData.encryptedData!),
keyDecryptionNonce: Sodium.bin2base64(encryptedKeyData.nonce!),
memLimit: derivedKeyResult.memLimit,
opsLimit: derivedKeyResult.opsLimit,
);
return Tuple2(updatedAttributes, loginKey);
}
Future<void> decryptAndSaveSecrets(
// decryptSecretsAndGetLoginKey decrypts the master key and recovery key
// with the given password and save them in local secure storage.
// This method also returns the keyEncKey that can be used for performing
// SRP setup for existing users.
Future<Uint8List> decryptSecretsAndGetKeyEncKey(
String password,
KeyAttributes attributes,
) async {
KeyAttributes attributes, {
Uint8List? keyEncryptionKey,
}) async {
_logger.info('Start decryptAndSaveSecrets');
// validatePreVerificationStateCheck(
// attributes,
// password,
// getEncryptedToken(),
// );
_logger.info('state validation done');
final kek = await CryptoUtil.deriveKey(
keyEncryptionKey ??= await CryptoUtil.deriveKey(
utf8.encode(password) as Uint8List,
Sodium.base642bin(attributes.kekSalt),
attributes.memLimit,
attributes.opsLimit,
).onError((e, s) {
_logger.severe('deriveKey failed', e, s);
throw KeyDerivationError();
});
);
_logger.info('user-key done');
Uint8List key;
try {
key = CryptoUtil.decryptSync(
Sodium.base642bin(attributes.encryptedKey),
kek,
keyEncryptionKey,
Sodium.base642bin(attributes.keyDecryptionNonce),
);
} catch (e) {
@@ -256,6 +274,7 @@ class Configuration {
await setToken(
Sodium.bin2base64(token, variant: Sodium.base64VariantUrlsafe),
);
return keyEncryptionKey;
}
Future<void> recover(String recoveryKey) async {
@@ -306,6 +325,10 @@ class Configuration {
return _cachedToken;
}
bool isLoggedIn() {
return getToken() != null;
}
Future<void> setToken(String token) async {
_cachedToken = token;
await _preferences.setString(tokenKey, token);
@@ -349,52 +372,31 @@ class Configuration {
}
}
Future<void> setKey(String? key) async {
Future<void> setKey(String key) async {
_key = key;
if (key == null) {
await _secureStorage.delete(
key: keyKey,
iOptions: _secureStorageOptionsIOS,
);
} else {
await _secureStorage.write(
key: keyKey,
value: key,
iOptions: _secureStorageOptionsIOS,
);
}
await _secureStorage.write(
key: keyKey,
value: key,
iOptions: _secureStorageOptionsIOS,
);
}
Future<void> setSecretKey(String? secretKey) async {
_secretKey = secretKey;
if (secretKey == null) {
await _secureStorage.delete(
key: secretKeyKey,
iOptions: _secureStorageOptionsIOS,
);
} else {
await _secureStorage.write(
key: secretKeyKey,
value: secretKey,
iOptions: _secureStorageOptionsIOS,
);
}
await _secureStorage.write(
key: secretKeyKey,
value: secretKey,
iOptions: _secureStorageOptionsIOS,
);
}
Future<void> setAuthSecretKey(String? authSecretKey) async {
_authSecretKey = authSecretKey;
if (authSecretKey == null) {
await _secureStorage.delete(
key: authSecretKeyKey,
iOptions: _secureStorageOptionsIOS,
);
} else {
await _secureStorage.write(
key: authSecretKeyKey,
value: authSecretKey,
iOptions: _secureStorageOptionsIOS,
);
}
await _secureStorage.write(
key: authSecretKeyKey,
value: authSecretKey,
iOptions: _secureStorageOptionsIOS,
);
}
Uint8List? getKey() {
@@ -409,11 +411,15 @@ class Configuration {
return _authSecretKey == null ? null : Sodium.base642bin(_authSecretKey!);
}
Uint8List? getOfflineSecretKey() {
return _offlineAuthKey == null ? null : Sodium.base642bin(_offlineAuthKey!);
}
Uint8List getRecoveryKey() {
final keyAttributes = getKeyAttributes()!;
return CryptoUtil.decryptSync(
Sodium.base642bin(keyAttributes.recoveryKeyEncryptedWithMasterKey),
getKey(),
getKey()!,
Sodium.base642bin(keyAttributes.recoveryKeyDecryptionNonce),
);
}
@@ -423,22 +429,34 @@ class Configuration {
return _tempDirectory;
}
String getThumbnailCacheDirectory() {
return _thumbnailCacheDirectory;
}
String getOldSharedMediaCacheDirectory() {
return _sharedTempMediaDirectory;
}
String getSharedMediaDirectory() {
return _sharedDocumentsMediaDirectory;
}
bool hasConfiguredAccount() {
return getToken() != null && _key != null;
}
bool hasOptedForOfflineMode() {
return _preferences.getBool(hasOptedForOfflineModeKey) ?? false;
}
Future<void> optForOfflineMode() async {
if ((await _secureStorage.containsKey(
key: offlineAuthSecretKey,
iOptions: _secureStorageOptionsIOS,
))) {
_offlineAuthKey = await _secureStorage.read(
key: offlineAuthSecretKey,
iOptions: _secureStorageOptionsIOS,
);
} else {
_offlineAuthKey = Sodium.bin2base64(CryptoUtil.generateKey());
await _secureStorage.write(
key: offlineAuthSecretKey,
value: _offlineAuthKey,
iOptions: _secureStorageOptionsIOS,
);
}
await _preferences.setBool(hasOptedForOfflineModeKey, true);
}
bool shouldShowLockScreen() {
if (_preferences.containsKey(keyShouldShowLockScreen)) {
return _preferences.getBool(keyShouldShowLockScreen)!;
@@ -458,27 +476,4 @@ class Configuration {
String? getVolatilePassword() {
return _volatilePassword;
}
Future<void> _migrateSecurityStorageToFirstUnlock() async {
final hasMigratedSecureStorageToFirstUnlock =
_preferences.getBool(hasMigratedSecureStorageKey) ?? false;
if (!hasMigratedSecureStorageToFirstUnlock &&
_key != null &&
_secretKey != null) {
await _secureStorage.write(
key: keyKey,
value: _key,
iOptions: _secureStorageOptionsIOS,
);
await _secureStorage.write(
key: secretKeyKey,
value: _secretKey,
iOptions: _secureStorageOptionsIOS,
);
await _preferences.setBool(
hasMigratedSecureStorageKey,
true,
);
}
}
}

View File

@@ -7,6 +7,7 @@ const String sentryDSN =
"https://ed4ddd6309b847ba8849935e26e9b648@sentry.ente.io/9";
const String sentryTunnel = "https://sentry-reporter.ente.io";
const String roadmapURL = "https://roadmap.ente.io";
const String githubIssuesUrl = "https://github.com/ente-io/auth/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc";
const int microSecondsInDay = 86400000000;
const int android11SDKINT = 30;
const int galleryLoadStartTime = -8000000000000000; // Wednesday, March 6, 1748

View File

@@ -41,4 +41,6 @@ class InvalidStateError extends AssertionError {
class KeyDerivationError extends Error {}
class SrpSetupNotCompleteError extends Error {}
class AuthenticatorKeyNotFound extends Error {}

View File

@@ -204,7 +204,7 @@ class SuperLogging {
static void setUserID(String userID) async {
if (config.sentryDsn != null) {
Sentry.configureScope((scope) => scope.user = SentryUser(id: userID));
Sentry.configureScope((scope) => scope.setUser(SentryUser(id: userID)));
$.info("setting sentry user ID to: $userID");
}
}
@@ -310,7 +310,7 @@ class SuperLogging {
if (_preferences.containsKey(keyShouldReportErrors)) {
return _preferences.getBool(keyShouldReportErrors)!;
} else {
return false;
return kDebugMode;
}
}

View File

@@ -22,11 +22,11 @@ class TunneledTransport implements Transport {
: _dsn = _options.dsn != null ? Dsn.parse(_options.dsn!) : null,
_headers = _buildHeaders(
_options.platformChecker.isWeb,
_options.sdk.identifier,
_options.sentryClientName,
) {
_credentialBuilder = _CredentialBuilder(
_dsn,
_options.sdk.identifier,
_options.sentryClientName,
_options.clock,
);
}

View File

@@ -1,18 +1,29 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/core/constants.dart';
import 'package:fk_user_agent/fk_user_agent.dart';
import 'package:flutter/foundation.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:uuid/uuid.dart';
int kConnectTimeout = 15000;
class Network {
// apiEndpoint points to the Ente server's API endpoint
static const apiEndpoint = String.fromEnvironment(
"endpoint",
defaultValue: kDefaultProductionEndpoint,
);
late Dio _dio;
late Dio _enteDio;
Future<void> init() async {
await FkUserAgent.init();
final packageInfo = await PackageInfo.fromPlatform();
final preferences = await SharedPreferences.getInstance();
_dio = Dio(
BaseOptions(
connectTimeout: kConnectTimeout,
@@ -24,6 +35,18 @@ class Network {
),
);
_dio.interceptors.add(RequestIdInterceptor());
_enteDio = Dio(
BaseOptions(
baseUrl: apiEndpoint,
connectTimeout: kConnectTimeout,
headers: {
HttpHeaders.userAgentHeader: FkUserAgent.userAgent,
'X-Client-Version': packageInfo.version,
'X-Client-Package': packageInfo.packageName,
},
),
);
_enteDio.interceptors.add(EnteRequestInterceptor(preferences, apiEndpoint));
}
Network._privateConstructor();
@@ -31,6 +54,7 @@ class Network {
static Network instance = Network._privateConstructor();
Dio getDio() => _dio;
Dio get enteDio => _enteDio;
}
class RequestIdInterceptor extends Interceptor {
@@ -41,3 +65,27 @@ class RequestIdInterceptor extends Interceptor {
return super.onRequest(options, handler);
}
}
class EnteRequestInterceptor extends Interceptor {
final SharedPreferences _preferences;
final String enteEndpoint;
EnteRequestInterceptor(this._preferences, this.enteEndpoint);
@override
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
if (kDebugMode) {
assert(
options.baseUrl == enteEndpoint,
"interceptor should only be used for API endpoint",
);
}
// ignore: prefer_const_constructors
options.headers.putIfAbsent("x-request-id", () => Uuid().v4().toString());
final String? tokenValue = _preferences.getString(Configuration.tokenKey);
if (tokenValue != null) {
options.headers.putIfAbsent("X-Auth-Token", () => tokenValue);
}
return super.onRequest(options, handler);
}
}

View File

@@ -11,11 +11,6 @@ final lightThemeData = ThemeData(
iconTheme: const IconThemeData(color: Colors.black),
primaryIconTheme:
const IconThemeData(color: Colors.red, opacity: 1.0, size: 50.0),
colorScheme: const ColorScheme.light(
primary: Colors.black,
secondary: Color.fromARGB(255, 163, 163, 163),
),
accentColor: const Color.fromRGBO(0, 0, 0, 0.6),
outlinedButtonTheme: buildOutlinedButtonThemeData(
bgDisabled: const Color.fromRGBO(158, 158, 158, 1),
bgEnabled: const Color.fromRGBO(0, 0, 0, 1),
@@ -26,9 +21,7 @@ final lightThemeData = ThemeData(
onPrimary: const Color.fromRGBO(255, 255, 255, 1),
primary: const Color.fromRGBO(0, 0, 0, 1),
),
toggleableActiveColor: const Color.fromRGBO(102, 187, 106, 1),
scaffoldBackgroundColor: const Color.fromRGBO(255, 255, 255, 1),
backgroundColor: const Color.fromRGBO(255, 255, 255, 1),
appBarTheme: const AppBarTheme().copyWith(
backgroundColor: Colors.white,
foregroundColor: Colors.black,
@@ -38,8 +31,8 @@ final lightThemeData = ThemeData(
//https://api.flutter.dev/flutter/material/TextTheme-class.html
textTheme: _buildTextTheme(const Color.fromRGBO(0, 0, 0, 1)),
primaryTextTheme: const TextTheme().copyWith(
bodyText2: const TextStyle(color: Colors.yellow),
bodyText1: const TextStyle(color: Colors.orange),
bodyMedium: const TextStyle(color: Colors.yellow),
bodyLarge: const TextStyle(color: Colors.orange),
),
cardColor: const Color.fromRGBO(250, 250, 250, 1.0),
dialogTheme: const DialogTheme().copyWith(
@@ -79,7 +72,27 @@ final lightThemeData = ThemeData(
? const Color.fromRGBO(255, 255, 255, 1)
: const Color.fromRGBO(0, 0, 0, 1);
}),
),
), radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return const Color.fromRGBO(102, 187, 106, 1); }
return null;
}),
), switchTheme: SwitchThemeData(
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return const Color.fromRGBO(102, 187, 106, 1); }
return null;
}),
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return const Color.fromRGBO(102, 187, 106, 1); }
return null;
}),
), colorScheme: const ColorScheme.light(
primary: Colors.black,
secondary: Color.fromARGB(255, 163, 163, 163),
).copyWith(background: const Color.fromRGBO(255, 255, 255, 1)),
);
final darkThemeData = ThemeData(
@@ -90,13 +103,10 @@ final darkThemeData = ThemeData(
primaryIconTheme:
const IconThemeData(color: Colors.red, opacity: 1.0, size: 50.0),
hintColor: const Color.fromRGBO(158, 158, 158, 1),
colorScheme: const ColorScheme.dark(primary: Colors.white),
accentColor: const Color.fromRGBO(45, 194, 98, 0.2),
buttonTheme: const ButtonThemeData().copyWith(
buttonColor: const Color.fromRGBO(45, 194, 98, 1.0),
),
textTheme: _buildTextTheme(const Color.fromRGBO(255, 255, 255, 1)),
toggleableActiveColor: const Color.fromRGBO(102, 187, 106, 1),
outlinedButtonTheme: buildOutlinedButtonThemeData(
bgDisabled: const Color.fromRGBO(158, 158, 158, 1),
bgEnabled: const Color.fromRGBO(255, 255, 255, 1),
@@ -108,7 +118,6 @@ final darkThemeData = ThemeData(
primary: const Color.fromRGBO(255, 255, 255, 1),
),
scaffoldBackgroundColor: const Color.fromRGBO(0, 0, 0, 1),
backgroundColor: const Color.fromRGBO(0, 0, 0, 1),
appBarTheme: const AppBarTheme().copyWith(
color: Colors.black,
elevation: 0,
@@ -155,59 +164,76 @@ final darkThemeData = ThemeData(
return const Color.fromRGBO(158, 158, 158, 1);
}
}),
),
), radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return const Color.fromRGBO(102, 187, 106, 1); }
return null;
}),
), switchTheme: SwitchThemeData(
thumbColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return const Color.fromRGBO(102, 187, 106, 1); }
return null;
}),
trackColor: MaterialStateProperty.resolveWith<Color?>((Set<MaterialState> states) {
if (states.contains(MaterialState.disabled)) { return null; }
if (states.contains(MaterialState.selected)) { return const Color.fromRGBO(102, 187, 106, 1); }
return null;
}),
), colorScheme: const ColorScheme.dark(primary: Colors.white).copyWith(background: const Color.fromRGBO(0, 0, 0, 1)),
);
TextTheme _buildTextTheme(Color textColor) {
return const TextTheme().copyWith(
headline4: TextStyle(
headlineMedium: TextStyle(
color: textColor,
fontSize: 32,
fontWeight: FontWeight.w600,
fontFamily: 'Inter',
),
headline5: TextStyle(
headlineSmall: TextStyle(
color: textColor,
fontSize: 24,
fontWeight: FontWeight.w600,
fontFamily: 'Inter',
),
headline6: TextStyle(
titleLarge: TextStyle(
color: textColor,
fontSize: 18,
fontFamily: 'Inter',
fontWeight: FontWeight.w600,
),
subtitle1: TextStyle(
titleMedium: TextStyle(
color: textColor,
fontFamily: 'Inter',
fontSize: 16,
fontWeight: FontWeight.w500,
),
subtitle2: TextStyle(
titleSmall: TextStyle(
color: textColor,
fontFamily: 'Inter',
fontSize: 14,
fontWeight: FontWeight.w500,
),
bodyText1: TextStyle(
bodyLarge: TextStyle(
fontFamily: 'Inter',
color: textColor,
fontSize: 16,
fontWeight: FontWeight.w500,
),
bodyText2: TextStyle(
bodyMedium: TextStyle(
fontFamily: 'Inter',
color: textColor,
fontSize: 14,
fontWeight: FontWeight.w500,
),
caption: TextStyle(
bodySmall: TextStyle(
color: textColor.withOpacity(0.4),
fontSize: 10,
fontWeight: FontWeight.w500,
),
overline: TextStyle(
labelSmall: TextStyle(
fontFamily: 'Inter',
color: textColor,
fontSize: 14,
@@ -344,7 +370,7 @@ extension CustomColorScheme on ColorScheme {
? const Color.fromRGBO(245, 245, 245, 1.0)
: const Color.fromRGBO(30, 30, 30, 1.0);
Color get searchResultsCountTextColor => brightness == Brightness.light
Color get mutedTextColor => brightness == Brightness.light
? const Color.fromRGBO(80, 80, 80, 1)
: const Color.fromRGBO(150, 150, 150, 1);
@@ -410,9 +436,7 @@ ElevatedButtonThemeData buildElevatedButtonThemeData({
}) {
return ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
elevation: elevation,
onPrimary: onPrimary,
primary: primary,
foregroundColor: onPrimary, backgroundColor: primary, elevation: elevation,
alignment: Alignment.center,
textStyle: const TextStyle(
fontWeight: FontWeight.w600,

View File

@@ -0,0 +1,3 @@
import 'package:ente_auth/events/event.dart';
class IconsChangedEvent extends Event {}

View File

@@ -11,6 +11,10 @@
"importScanQrCode": "Scannen eines QR-Codes",
"importEnterSetupKey": "Einen Setup-Schlüssel eingeben",
"importAccountPageTitle": "Kontodaten eingeben",
"secretCanNotBeEmpty": "Geheimnis darf nicht leer sein",
"bothIssuerAndAccountCanNotBeEmpty": "Sowohl Aussteller als auch Konto können nicht leer sein",
"incorrectDetails": "Falsche Angaben",
"pleaseVerifyDetails": "Überprüfe die Angaben und versuche es erneut",
"codeIssuerHint": "Aussteller",
"codeSecretKeyHint": "Geheimer Schlüssel",
"codeAccountHint": "Konto (you@domain.com)",

View File

@@ -1,4 +1,3 @@
{
"account": "Account",
"recoveryKey": "Recovery key",
@@ -6,18 +5,19 @@
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
},
"onBoardingBody": "Secure your 2FA codes",
"onBoardingBody": "Securely backup your 2FA codes",
"onBoardingGetStarted": "Get Started",
"setupFirstAccount": "Setup your first account",
"importScanQrCode": "Scan a QR Code",
"qrCode": "QR Code",
"importEnterSetupKey": "Enter a setup key",
"importAccountPageTitle": "Enter account details",
"secretCanNotBeEmpty": "Secret can not be empty",
"bothIssuerAndAccountCanNotBeEmpty": "Both issuer and account can not be empty",
"incorrectDetails" :"Incorrect details",
"incorrectDetails": "Incorrect details",
"pleaseVerifyDetails": "Please verify the details and try again",
"codeIssuerHint": "Issuer",
"codeSecretKeyHint" : "Secret Key",
"codeSecretKeyHint": "Secret Key",
"codeAccountHint": "Account (you@domain.com)",
"accountKeyType": "Type of key",
"sessionExpired": "Session expired",
@@ -25,7 +25,7 @@
"description": "Title of the dialog when the users current session is invalid/expired"
},
"pleaseLoginAgain": "Please login again",
"loggingOut" : "Logging out...",
"loggingOut": "Logging out...",
"timeBasedKeyType": "Time based (TOTP)",
"counterBasedKeyType": "Counter based (HOTP)",
"saveAction": "Save",
@@ -58,6 +58,9 @@
}
},
"contactSupport": "Contact support",
"rateUsOnStore" : "Rate us on {storeName}",
"blog": "Blog",
"merchandise": "Merchandise",
"verifyPassword": "Verify password",
"pleaseWait": "Please wait...",
"generatingEncryptionKeysTitle": "Generating encryption keys...",
@@ -67,16 +70,29 @@
"incorrectPasswordTitle": "Incorrect password",
"welcomeBack": "Welcome back!",
"madeWithLoveAtPrefix": "made with ❤️ at ",
"supportDevs" : "Subscribe to <bold-green>ente</bold-green> to support this project.",
"supportDiscount" : "Use coupon code \"AUTH\" to get 10% off first year",
"supportDevs": "Subscribe to <bold-green>ente</bold-green> to support this project",
"supportDiscount": "Use coupon code \"AUTH\" to get 10% off first year",
"changeEmail": "Change email",
"changePassword": "Change password",
"data" : "Data",
"data": "Data",
"importCodes": "Import codes",
"importTypePlainText": "Plain text",
"importTypeEnteEncrypted": "ente Encrypted export",
"passwordForDecryptingExport": "Password to decrypt export",
"passwordEmptyError": "Password can not be empty",
"importFromApp": "Import codes from {appName}",
"importGoogleAuthGuide": "Export your accounts from Google Authenticator to a QR code using the \"Transfer Accounts\" option. Then using another device, scan the QR code.\n\nTip: You can use your laptop's webcam to take a picture of the QR code.",
"importSelectJsonFile": "Select JSON file",
"importEnteEncGuide": "Select the encrypted JSON file exported from ente",
"importRaivoGuide": "Use the \"Export OTPs to Zip archive\" option in Raivo's Settings.\n\nExtract the zip file and import the JSON file.",
"importAegisGuide": "Use the \"Export the vault\" option in Aegis's Settings.\n\nIf your vault is encrypted, you will need to enter vault password to decrypt the vault.",
"exportCodes": "Export codes",
"importLabel": "Import",
"importInstruction": "Please select a file that contains a list of your codes in the following format",
"importCodeDelimiterInfo": "The codes can be separated by a comma or a new line",
"selectFile": "Select file",
"emailVerificationToggle": "Email verification",
"authToChangeEmailVerificationSetting": "Please authenticate to change email verification",
"authToViewYourRecoveryKey": "Please authenticate to view your recovery key",
"authToChangeYourEmail": "Please authenticate to change your email",
"authToChangeYourPassword": "Please authenticate to change your password",
@@ -86,15 +102,28 @@
"no": "No",
"email": "Email",
"support": "Support",
"general": "General",
"settings": "Settings",
"copied": "Copied",
"pleaseTryAgain": "Please try again",
"existingUser": "Existing User",
"newUser" : "New to ente",
"newUser": "New to ente",
"delete": "Delete",
"enterYourPasswordHint": "Enter your password",
"forgotPassword": "Forgot password",
"oops": "Oops",
"suggestFeatures": "Suggest features",
"faq": "FAQ",
"faq_q_1": "How secure is ente Auth?",
"faq_a_1": "All codes you backup via ente is stored end-to-end encrypted. This means only you can access your codes. Our apps are open source and our cryptography has been externally audited.",
"faq_q_2": "Can I access my codes on desktop?",
"faq_a_2": "You can access your codes on the web @ auth.ente.io.",
"faq_q_3": "How can I delete codes?",
"faq_a_3": "You can delete a code by swiping left on that item.",
"faq_q_4": "How can I support this project?",
"faq_a_4": "You can support the development of this project by subscribing to our Photos app @ ente.io.",
"faq_q_5": "How can I enable FaceID lock in ente Auth",
"faq_a_5": "You can enable FaceID lock under Settings → Security → Lockscreen.",
"somethingWentWrongMessage": "Something went wrong, please try again",
"leaveFamily": "Leave family",
"leaveFamilyMessage": "Are you sure that you want to leave the family plan?",
@@ -110,7 +139,7 @@
"recoverAccount": "Recover account",
"enterRecoveryKeyHint": "Enter your recovery key",
"recover": "Recover",
"contactSupportViaEmailMessage":"Please drop an email to {email} from your registered email address",
"contactSupportViaEmailMessage": "Please drop an email to {email} from your registered email address",
"@contactSupportViaEmailMessage": {
"placeholders": {
"email": {
@@ -155,12 +184,14 @@
"enterDetailsManually": "Enter details manually",
"edit": "Edit",
"copiedToClipboard": "Copied to clipboard",
"copiedNextToClipboard": "Copied next code to clipboard",
"error": "Error",
"recoveryKeyCopiedToClipboard": "Recovery key copied to clipboard",
"recoveryKeyOnForgotPassword": "If you forget your password, the only way you can recover your data is with this key.",
"recoveryKeySaveDescription": "We don't store this key, please save this 24 word key in a safe place.",
"doThisLater": "Do this later",
"saveKey": "Save key",
"back": "Back",
"createAccount": "Create account",
"passwordStrength": "Password strength: {passwordStrengthValue}",
"@passwordStrength": {
@@ -175,7 +206,7 @@
"message": "Password Strength: {passwordStrengthText}"
},
"password": "Password",
"signUpTerms" : "I agree to the <u-terms>terms of service</u-terms> and <u-policy>privacy policy</u-policy>",
"signUpTerms": "I agree to the <u-terms>terms of service</u-terms> and <u-policy>privacy policy</u-policy>",
"privacyPolicyTitle": "Privacy Policy",
"termsOfServicesTitle": "Terms",
"encryption": "Encryption",
@@ -224,18 +255,22 @@
"privacy": "Privacy",
"terms": "Terms",
"checkForUpdates": "Check for updates",
"downloadUpdate": "Download",
"criticalUpdateAvailable": "Critical update available",
"updateAvailable": "Update available",
"update": "Update",
"checking": "Checking...",
"youAreOnTheLatestVersion": "You are on the latest version",
"warning": "Warning",
"exportWarningDesc": "The exported file contains sensitive information. Please store this safely.",
"iUnderStand" : "I understand",
"iUnderStand": "I understand",
"@iUnderStand": {
"description": "Text for the button to confirm the user understands the warning"
},
"authToExportCodes": "Please authenticate to export your codes",
"importSuccessTitle": "Yay!",
"importSuccessDesc": "You have imported {count} codes!",
"@importSuccessDesc" : {
"@importSuccessDesc": {
"placeholders": {
"count": {
"description": "The number of codes imported",
@@ -244,9 +279,9 @@
}
}
},
"sorry" : "Sorry",
"sorry": "Sorry",
"importFailureDesc": "Could not parse the selected file.\nPlease write to support@ente.io if you need help!",
"pendingSyncs" : "Warning",
"pendingSyncs": "Warning",
"pendingSyncsWarningBody": "Some of your codes have not been backed up.\n\nPlease ensure that you have a backup for these codes before you logout.",
"checkInboxAndSpamFolder": "Please check your inbox (and spam) to complete verification",
"tapToEnterCode": "Tap to enter code",
@@ -268,5 +303,31 @@
"thisWillLogYouOutOfTheFollowingDevice": "This will log you out of the following device:",
"terminateSession": "Terminate session?",
"terminate": "Terminate",
"thisDevice": "This device"
"thisDevice": "This device",
"toResetVerifyEmail": "To reset your password, please verify your email first.",
"thisEmailIsAlreadyInUse": "This email is already in use",
"verificationFailedPleaseTryAgain": "Verification failed, please try again",
"yourVerificationCodeHasExpired": "Your verification code has expired",
"incorrectCode": "Incorrect code",
"sorryTheCodeYouveEnteredIsIncorrect": "Sorry, the code you've entered is incorrect",
"emailChangedTo": "Email changed to {newEmail}",
"authenticationFailedPleaseTryAgain": "Authentication failed, please try again",
"authenticationSuccessful": "Authentication successful!",
"twofactorAuthenticationSuccessfullyReset": "Two-factor authentication successfully reset",
"incorrectRecoveryKey": "Incorrect recovery key",
"theRecoveryKeyYouEnteredIsIncorrect": "The recovery key you entered is incorrect",
"enterPassword": "Enter password",
"selectExportFormat": "Select export format",
"exportDialogDesc": "Encrypted exports will be protected by a password of your choice.",
"encrypted": "Encrypted",
"plainText": "Plain text",
"passwordToEncryptExport": "Password to encrypt export",
"export": "Export",
"useOffline": "Use without backups",
"signInToBackup": "Sign in to backup your codes",
"singIn": "Sign in",
"sigInBackupReminder": "Please export your codes to ensure that you have a backup you can restore from.",
"offlineModeWarning": "You have chosen to proceed without backups. Please take manual backups to make sure your codes are safe.",
"showLargeIcons": "Show large icons",
"focusOnSearchBar": "Focus search on app start"
}

View File

@@ -68,10 +68,14 @@
"changePassword": "Modifier le mot de passe",
"data": "Données",
"importCodes": "Importer les codes",
"importSelectJsonFile": "Sélectionnez un fichier JSON",
"importEnteEncGuide": "Sélectionnez le fichier JSON chiffré exporté à partir de ente",
"exportCodes": "Exporter les codes",
"importInstruction": "Veuillez sélectionner un fichier qui contient une liste de vos codes dans le format suivant",
"importCodeDelimiterInfo": "Les codes peuvent être séparés par une virgule ou un retour à la ligne",
"selectFile": "Sélectionner le fichier",
"emailVerificationToggle": "Vérification de l'adresse e-mail",
"authToChangeEmailVerificationSetting": "Veuillez vous authentifier pour modifier votre adresse e-mail",
"authToViewYourRecoveryKey": "Veuillez vous authentifier pour afficher votre clé de récupération",
"authToChangeYourEmail": "Veuillez vous authentifier pour modifier votre adresse e-mail",
"authToChangeYourPassword": "Veuillez vous authentifier pour modifier votre mot de passe",
@@ -90,6 +94,14 @@
"enterYourPasswordHint": "Saisir votre mot de passe",
"forgotPassword": "Mot de passe oublié",
"oops": "Oups",
"suggestFeatures": "Suggérer des fonctionnalités",
"faq": "FAQ",
"faq_q_2": "Puis-je accéder à mes codes sur mon ordinateur ?",
"faq_a_2": "Vous pouvez accéder à vos codes sur le web via auth.ente.io.",
"faq_q_3": "Comment puis-je supprimer des codes ?",
"faq_a_3": "Vous pouvez supprimer un code en glissant vers la gauche.",
"faq_q_4": "Comment puis-je soutenir le projet?",
"faq_a_4": "Vous pouvez soutenir le développement de ce projet en vous abonnant à notre application Photos, ente.io.",
"somethingWentWrongMessage": "Quelque chose s'est mal passé, veuillez recommencer",
"leaveFamily": "Quitter le plan familial",
"leaveFamilyMessage": "Êtes-vous certains de vouloir quitter le plan familial?",
@@ -156,6 +168,7 @@
"recoveryKeySaveDescription": "Nous ne stockons pas cette clé, veuillez enregistrer cette clé de 24 mots dans un endroit sûr.",
"doThisLater": "Plus tard",
"saveKey": "Enregistrer la clé",
"back": "Retour",
"createAccount": "Créer un compte",
"passwordStrength": "Force du mot de passe : {passwordStrengthValue}",
"@passwordStrength": {
@@ -186,6 +199,7 @@
"continueLabel": "Continuer",
"insecureDevice": "Appareil non sécurisé",
"sorryWeCouldNotGenerateSecureKeysOnThisDevicennplease": "Désolé, nous n'avons pas pu générer de clés sécurisées sur cet appareil.\n\nVeuillez vous inscrire depuis un autre appareil.",
"howItWorks": "Comment ça fonctionne",
"ackPasswordLostWarning": "Je comprends que si je perds mon mot de passe, je risque de perdre mes données puisque celles-ci sont <underline>chiffrées de bout en bout</underline>.",
"loginTerms": "En cliquant sur \"Connexion\", j'accepte les <u-terms>conditions d'utilisation</u-terms> et la <u-policy>politique de confidentialité</u-policy>",
"logInLabel": "Connexion",
@@ -262,5 +276,19 @@
"thisWillLogYouOutOfTheFollowingDevice": "Cela vous déconnectera de l'appareil suivant :",
"terminateSession": "Quitter la session ?",
"terminate": "Quitter",
"thisDevice": "Cet appareil"
"thisDevice": "Cet appareil",
"toResetVerifyEmail": "Pour réinitialiser votre mot de passe, veuillez d'abord vérifier votre e-mail.",
"thisEmailIsAlreadyInUse": "Cette adresse mail est déjà utilisé",
"verificationFailedPleaseTryAgain": "La vérification a échouée, veuillez réessayer",
"yourVerificationCodeHasExpired": "Votre code de vérification a expiré",
"incorrectCode": "Code non valide",
"sorryTheCodeYouveEnteredIsIncorrect": "Le code que vous avez saisi est incorrect",
"emailChangedTo": "L'e-mail a été changé en {newEmail}",
"authenticationFailedPleaseTryAgain": "L'authentification a échouée, veuillez réessayer",
"authenticationSuccessful": "Authentification réussie!",
"twofactorAuthenticationSuccessfullyReset": "L'authentification à deux facteurs a été réinitialisée avec succès ",
"incorrectRecoveryKey": "Clé de récupération non valide",
"theRecoveryKeyYouEnteredIsIncorrect": "La clé de récupération que vous avez entrée est incorrecte",
"enterPassword": "Saisissez le mot de passe",
"export": "Exporter"
}

View File

@@ -9,8 +9,13 @@
"onBoardingGetStarted": "Per iniziare",
"setupFirstAccount": "Configura il tuo primo account",
"importScanQrCode": "Scansiona un codice QR",
"qrCode": "Codice QR",
"importEnterSetupKey": "Inserisci il codice segreto",
"importAccountPageTitle": "Inserisci i dettagli del tuo account",
"secretCanNotBeEmpty": "La chiave segreta è obbligatoria",
"bothIssuerAndAccountCanNotBeEmpty": "Sia l'emittente che l'account sono obbligatori",
"incorrectDetails": "Dettagli errati",
"pleaseVerifyDetails": "Verifica i dettagli e riprova",
"codeIssuerHint": "Emittente",
"codeSecretKeyHint": "Codice segreto",
"codeAccountHint": "Account (username@dominio.it)",
@@ -53,6 +58,9 @@
}
},
"contactSupport": "Contatta il supporto",
"rateUsOnStore": "Valutaci su {storeName}",
"blog": "Blog",
"merchandise": "Prodotti",
"verifyPassword": "Verifica la password",
"pleaseWait": "Attendere prego...",
"generatingEncryptionKeysTitle": "Generazione delle chiavi di crittografia...",
@@ -68,10 +76,23 @@
"changePassword": "Cambia password",
"data": "Dati",
"importCodes": "Importa codici",
"importTypePlainText": "Testo in chiaro",
"importTypeEnteEncrypted": "ente Esportazione criptata",
"passwordForDecryptingExport": "Password per decriptare il file esportato",
"passwordEmptyError": "La password è obbligatoria",
"importFromApp": "Importa codici da {appName}",
"importGoogleAuthGuide": "Esporta i tuoi account da Google Authenticator in un codice QR utilizzando l'opzione \"Trasferisci Account\". Quindi, usando un altro dispositivo, scansiona il codice QR.\n\nSuggerimento: Puoi usare la webcam del tuo computer portatile per scattare una foto del codice QR.",
"importSelectJsonFile": "Seleziona file JSON",
"importEnteEncGuide": "Seleziona il file JSON criptato esportato da ente",
"importRaivoGuide": "Utilizza l'opzione \"Esporta i codici OTP in archivio Zip\" nelle impostazioni di Raivo.\n\nEstrai il file zip e importa il file JSON.",
"importAegisGuide": "Usa l'opzione \"Esporta la cassaforte\" nelle impostazioni di Aegis.\n\nSe la tua cassaforte è criptata, dovrai inserire la password della cassaforte per decriptarla.",
"exportCodes": "Esporta codici",
"importLabel": "Importa",
"importInstruction": "Per favore seleziona un file contenente una lista dei tuoi codici nel seguente formato",
"importCodeDelimiterInfo": "I codici possono essere separati da una virgola o da una nuova riga",
"selectFile": "Seleziona file",
"emailVerificationToggle": "Verifica Email",
"authToChangeEmailVerificationSetting": "Autenticati per cambiare la verifica email",
"authToViewYourRecoveryKey": "Autenticati per visualizzare la tua chiave di recupero",
"authToChangeYourEmail": "Autenticati per cambiare la tua email",
"authToChangeYourPassword": "Autenticati per cambiare la tua password",
@@ -90,6 +111,18 @@
"enterYourPasswordHint": "Inserisci la tua password",
"forgotPassword": "Password dimenticata",
"oops": "Oops",
"suggestFeatures": "Suggerisci funzionalità",
"faq": "FAQ",
"faq_q_1": "Quanto è sicuro ente Auth?",
"faq_a_1": "Tutti i codici di cui fai il backup tramite ente sono memorizzati con crittografia end-to-end. Ciò significa che solo tu puoi accedere ai tuoi codici. Le nostre app sono open source e la nostra crittografia è stata verificata esternamente.",
"faq_q_2": "Posso accedere ai miei codici sul desktop?",
"faq_a_2": "Puoi accedere ai tuoi codici sul web @ auth.ente.io.",
"faq_q_3": "Come posso cancellare i codici?",
"faq_a_3": "Puoi eliminare un codice scorrendo il dito a sinistra sul codice in questione.",
"faq_q_4": "Come posso supportare questo progetto?",
"faq_a_4": "Puoi supportare lo sviluppo di questo progetto abbonandoti alla nostra app Photos @ ente.io.",
"faq_q_5": "Come posso abilitare il blocco FaceID in ente Auth",
"faq_a_5": "Puoi abilitare il blocco FaceID in Impostazioni → Sicurezza → Schermata di blocco.",
"somethingWentWrongMessage": "Qualcosa è andato storto, per favore riprova",
"leaveFamily": "Abbandona il piano famiglia",
"leaveFamilyMessage": "Sei sicuro di voler uscire dal piano famiglia?",
@@ -156,6 +189,7 @@
"recoveryKeySaveDescription": "Non memorizziamo questa chiave, per favore salva questa chiave di 24 parole in un posto sicuro.",
"doThisLater": "Fallo più tardi",
"saveKey": "Salva chiave",
"back": "Indietro",
"createAccount": "Crea account",
"passwordStrength": "Forza password: {passwordStrengthValue}",
"@passwordStrength": {
@@ -263,5 +297,24 @@
"thisWillLogYouOutOfTheFollowingDevice": "Questo ti disconnetterà dal seguente dispositivo:",
"terminateSession": "Termina sessione?",
"terminate": "Termina",
"thisDevice": "Questo dispositivo"
"thisDevice": "Questo dispositivo",
"toResetVerifyEmail": "Per reimpostare la tua password, prima verifica la tua email.",
"thisEmailIsAlreadyInUse": "Questa email é già in uso",
"verificationFailedPleaseTryAgain": "Verifica fallita, per favore riprova",
"yourVerificationCodeHasExpired": "Il tuo codice di verifica è scaduto",
"incorrectCode": "Codice errato",
"sorryTheCodeYouveEnteredIsIncorrect": "Spiacenti, il codice che hai inserito non è corretto",
"emailChangedTo": "Email modificata in {newEmail}",
"authenticationFailedPleaseTryAgain": "Autenticazione non riuscita, riprova",
"authenticationSuccessful": "Autenticazione riuscita!",
"twofactorAuthenticationSuccessfullyReset": "Autenticazione a due fattori ripristinata con successo",
"incorrectRecoveryKey": "Chiave di recupero errata",
"theRecoveryKeyYouEnteredIsIncorrect": "La chiave di recupero che hai inserito non è corretta",
"enterPassword": "Inserisci la password",
"selectExportFormat": "Seleziona formato di esportazione",
"exportDialogDesc": "Le esportazioni criptate saranno protette da una password a tua scelta.",
"encrypted": "Criptato",
"plainText": "Testo in chiaro",
"passwordToEncryptExport": "Password per criptare il file esportato",
"export": "Esporta"
}

View File

@@ -9,8 +9,13 @@
"onBoardingGetStarted": "Begin",
"setupFirstAccount": "Maak je account aan",
"importScanQrCode": "Scan een QR-code",
"qrCode": "QR Code",
"importEnterSetupKey": "Voer een toegangssleutel in",
"importAccountPageTitle": "Accountgegevens invoeren",
"secretCanNotBeEmpty": "Geheime code mag niet leeg zijn",
"bothIssuerAndAccountCanNotBeEmpty": "Uitgever en account kunnen niet beiden leeg zijn",
"incorrectDetails": "Onjuiste gegevens",
"pleaseVerifyDetails": "Controleer je gegevens en probeer het nog eens",
"codeIssuerHint": "Uitgever",
"codeSecretKeyHint": "Geheime sleutel",
"codeAccountHint": "Account (jij@domein.nl)",
@@ -53,6 +58,9 @@
}
},
"contactSupport": "Klantenservice",
"rateUsOnStore": "Beoordeel ons op {storeName}",
"blog": "Blog",
"merchandise": "Merchandise",
"verifyPassword": "Bevestig wachtwoord",
"pleaseWait": "Een ogenblik geduld...",
"generatingEncryptionKeysTitle": "Encryptiesleutels genereren...",
@@ -68,10 +76,23 @@
"changePassword": "Wachtwoord wijzigen",
"data": "Gegevens",
"importCodes": "Codes importeren",
"importTypePlainText": "Kale tekst",
"importTypeEnteEncrypted": "ente versleutelde export",
"passwordForDecryptingExport": "Wachtwoord voor het decoderen van export",
"passwordEmptyError": "Wachtwoord kan niet leeg zijn",
"importFromApp": "Importeer codes van {appName}",
"importGoogleAuthGuide": "Exporteer uw accounts van Google Authenticator naar een QR-code met behulp van de optie \"Transfer Accounts\". Met een ander apparaat scan je de QR-code.\n\nTip: Je kunt de webcam van je laptop gebruiken om een foto van de QR-code te maken.",
"importSelectJsonFile": "Selecteer JSON bestand",
"importEnteEncGuide": "Selecteer het versleutelde JSON-bestand dat vanuit ente geëxporteerd is",
"importRaivoGuide": "Gebruik de optie \"Export OTPs to Zip archive\" in Raivo's instellingen.\n\nPak het zip-bestand uit en importeer het JSON-bestand.",
"importAegisGuide": "Gebruik de optie \"Exporteer de kluis\" in de instellingen van Aegis.\n\nAls uw kluis is versleuteld, moet u het wachtwoord invoeren om de kluis te ontsleutelen.",
"exportCodes": "Codes exporteren",
"importLabel": "Importeren",
"importInstruction": "Selecteer een bestand dat een lijst van uw codes in de volgende indeling bevat",
"importCodeDelimiterInfo": "De codes mogen gescheiden worden door een komma of een nieuwe regel",
"selectFile": "Bestand selecteren",
"emailVerificationToggle": "E-mailverificatie",
"authToChangeEmailVerificationSetting": "Gelieve te verifiëren om de e-mailverificatie te wijzigen",
"authToViewYourRecoveryKey": "Graag verifiëren om uw herstelsleutel te bekijken",
"authToChangeYourEmail": "Graag verifiëren om je e-mailadres te wijzigen",
"authToChangeYourPassword": "Graag verifiëren om je wachtwoord te wijzigen",
@@ -90,6 +111,18 @@
"enterYourPasswordHint": "Voer je wachtwoord in",
"forgotPassword": "Wachtwoord vergeten",
"oops": "Oeps",
"suggestFeatures": "Features voorstellen",
"faq": "Veelgestelde vragen",
"faq_q_1": "Hoe veilig is ente Auth?",
"faq_a_1": "Alle codes in ente zijn versleuteld opgeslagen met end-to-end encryptie. Dit betekent dat alleen jij toegang hebt tot je codes. Onze apps zijn open source en onze cryptografie is extern gecontroleerd.",
"faq_q_2": "Kan ik toegang krijgen tot mijn codes op desktop?",
"faq_a_2": "U heeft toegang tot uw codes op het web @ auth.ente.io.",
"faq_q_3": "Hoe kan ik codes verwijderen?",
"faq_a_3": "Je kunt een code verwijderen door naar links te vegen op dat item.",
"faq_q_4": "Hoe kan ik dit project steunen?",
"faq_a_4": "U kunt de ontwikkeling van dit project steunen door u te abonneren op onze Photos app @ ente.io.",
"faq_q_5": "Hoe kan ik FaceID lock inschakelen in ente Auth",
"faq_a_5": "Je kunt FaceID vergrendelen onder Instellingen → Beveiliging → Lockscreen.",
"somethingWentWrongMessage": "Er is iets fout gegaan, probeer het opnieuw",
"leaveFamily": "Familie verlaten",
"leaveFamilyMessage": "Weet je zeker dat je het familie-plan wil verlaten?",
@@ -156,6 +189,7 @@
"recoveryKeySaveDescription": "We slaan deze code niet op, bewaar deze code met 24 woorden op een veilige plaats.",
"doThisLater": "Doe dit later",
"saveKey": "Sleutel opslaan",
"back": "Terug",
"createAccount": "Account aanmaken",
"passwordStrength": "Wachtwoord sterkte: {passwordStrengthValue}",
"@passwordStrength": {
@@ -263,5 +297,24 @@
"thisWillLogYouOutOfTheFollowingDevice": "Dit zal je uitloggen van het volgende apparaat:",
"terminateSession": "Sessie beëindigen?",
"terminate": "Beëindigen",
"thisDevice": "Dit apparaat"
"thisDevice": "Dit apparaat",
"toResetVerifyEmail": "Verifieer eerst je e-mailadres om je wachtwoord opnieuw in te stellen.",
"thisEmailIsAlreadyInUse": "Dit e-mailadres is al in gebruik",
"verificationFailedPleaseTryAgain": "Verificatie mislukt, probeer het opnieuw",
"yourVerificationCodeHasExpired": "Uw verificatiecode is verlopen",
"incorrectCode": "Onjuiste code",
"sorryTheCodeYouveEnteredIsIncorrect": "Sorry, de ingevoerde code is onjuist",
"emailChangedTo": "E-mailadres gewijzigd naar {newEmail}",
"authenticationFailedPleaseTryAgain": "Verificatie mislukt, probeer het opnieuw",
"authenticationSuccessful": "Verificatie geslaagd!",
"twofactorAuthenticationSuccessfullyReset": "Tweestapsverificatie succesvol gereset",
"incorrectRecoveryKey": "Onjuiste herstelsleutel",
"theRecoveryKeyYouEnteredIsIncorrect": "De ingevoerde herstelsleutel is onjuist",
"enterPassword": "Voer wachtwoord in",
"selectExportFormat": "Selecteer export formaat",
"exportDialogDesc": "Versleutelde exports worden beschermd door een wachtwoord van uw keuze.",
"encrypted": "Versleuteld",
"plainText": "Kale tekst",
"passwordToEncryptExport": "Wachtwoord voor het versleutelen van export",
"export": "Exporteren"
}

View File

@@ -9,8 +9,13 @@
"onBoardingGetStarted": "Начать",
"setupFirstAccount": "Настройте свой первый аккаунт",
"importScanQrCode": "Сканировать QR-код",
"importEnterSetupKey": "Введите ключ установки",
"qrCode": "QR-код",
"importEnterSetupKey": "Ввести ключ настройки",
"importAccountPageTitle": "Введите данные аккаунта",
"secretCanNotBeEmpty": "Секретный код не может быть пустым",
"bothIssuerAndAccountCanNotBeEmpty": "И эмитент, и аккаунт не могут быть пустыми",
"incorrectDetails": "Неправильные данные",
"pleaseVerifyDetails": "Пожалуйста, проверьте детали и попробуйте еще раз",
"codeIssuerHint": "Эмитент",
"codeSecretKeyHint": "Секретный ключ",
"codeAccountHint": "Аккаунт (you@domain.com)",
@@ -53,6 +58,9 @@
}
},
"contactSupport": "Связаться с поддержкой",
"rateUsOnStore": "Оценить нас на {storeName}",
"blog": "Блог",
"merchandise": "Товары",
"verifyPassword": "Подтверждение пароля",
"pleaseWait": "Пожалуйста, подождите...",
"generatingEncryptionKeysTitle": "Генерируем ключи шифрования...",
@@ -64,14 +72,27 @@
"madeWithLoveAtPrefix": "сделана с ❤️ в ",
"supportDevs": "Подпишитесь на <bold-green>ente</bold-green> для поддержки этого проекта.",
"supportDiscount": "Используйте код скидки \"AUTH\", чтобы получить скидку 10% в первый год",
"changeEmail": "изменить почту",
"changeEmail": "Изменить почту",
"changePassword": "Изменить пароль",
"data": "Данные",
"importCodes": "Импортировать коды",
"importTypePlainText": "Обычный текст",
"importTypeEnteEncrypted": "ente Зашифрованный экспорт",
"passwordForDecryptingExport": "Пароль для расшифровки экспорта",
"passwordEmptyError": "Пароль не может быть пустым",
"importFromApp": "Импорт кодов из {appName}",
"importGoogleAuthGuide": "Экспортируйте учетные записи из Google Authenticator в QR-код, используя опцию «Перенести учетные записи». Затем с помощью другого устройства отсканируйте QR-код.\n\nСовет: Чтобы сфотографировать QR-код, можно воспользоваться веб-камерой ноутбука.",
"importSelectJsonFile": "Выбрать JSON-файл",
"importEnteEncGuide": "Выберите зашифрованный JSON-файл, экспортированный из ente",
"importRaivoGuide": "Используйте опцию «Export OTPs to Zip archive» в настройках Raivo.\n\nРаспакуйте zip-архив и импортируйте JSON-файл.",
"importAegisGuide": "Используйте опцию «Экспортировать хранилище» в настройках Aegis.\n\nЕсли ваше хранилище зашифровано, то для его расшифровки потребуется ввести пароль хранилища.",
"exportCodes": "Экспортировать коды",
"importLabel": "Импорт",
"importInstruction": "Пожалуйста, выберите файл, содержащий список ваших кодов в следующем формате",
"importCodeDelimiterInfo": "Коды могут быть разделены запятой или новой строкой",
"selectFile": "Выберите файл",
"selectFile": "Выбрать файл",
"emailVerificationToggle": "Подтверждение электронной почты",
"authToChangeEmailVerificationSetting": "Авторизуйтесь, чтобы изменить подтверждение электронной почты",
"authToViewYourRecoveryKey": "Пожалуйста, авторизуйтесь для просмотра вашего ключа восстановления",
"authToChangeYourEmail": "Пожалуйста, авторизуйтесь, чтобы изменить адрес электронной почты",
"authToChangeYourPassword": "Пожалуйста, авторизуйтесь, чтобы изменить пароль",
@@ -90,6 +111,18 @@
"enterYourPasswordHint": "Введите пароль",
"forgotPassword": "Забыл пароль",
"oops": "Ой",
"suggestFeatures": "Предложить улучшения",
"faq": "FAQ",
"faq_q_1": "Насколько безопасен ente Auth?",
"faq_a_1": "Все коды, которые вы резервируете с помощью ente, хранятся в зашифрованном виде. Это означает, что только вы можете получить доступ к своим кодам. Наши приложения имеют открытый исходный код, а наша криптография прошла внешний аудит.",
"faq_q_2": "Могу ли я получить доступ к моим кодам на компьютере?",
"faq_a_2": "Вы можете получить доступ к своим кодам на сайте @ auth.ente.io.",
"faq_q_3": "Как я могу удалить коды?",
"faq_a_3": "Вы можете удалить код, проведя пальцем влево по этому элементу.",
"faq_q_4": "Как я могу поддержать этот проект?",
"faq_a_4": "Вы можете поддержать развитие этого проекта, подписавшись на наше приложение Photos @ ente.io.",
"faq_q_5": "Как мне включить блокировку FaceID в ente Auth?",
"faq_a_5": "Вы можете включить блокировку FaceID в Настройки → Безопасность → Экран блокировки.",
"somethingWentWrongMessage": "Что-то пошло не так. Попробуйте еще раз",
"leaveFamily": "Покинуть семью",
"leaveFamilyMessage": "Вы уверены, что хотите отказаться от семейного плана?",
@@ -156,6 +189,7 @@
"recoveryKeySaveDescription": "Мы не храним этот ключ, пожалуйста, сохраните этот ключ в безопасном месте.",
"doThisLater": "Сделать позже",
"saveKey": "Сохранить ключ",
"back": "Вернуться",
"createAccount": "Создать аккаунт",
"passwordStrength": "Мощность пароля: {passwordStrengthValue}",
"@passwordStrength": {
@@ -263,5 +297,24 @@
"thisWillLogYouOutOfTheFollowingDevice": "Вы выйдете из списка следующих устройств:",
"terminateSession": "Завершить сеанс?",
"terminate": "Завершить",
"thisDevice": "Это устройство"
"thisDevice": "Это устройство",
"toResetVerifyEmail": "Чтобы сбросить пароль, сначала подтвердите свой адрес электронной почты.",
"thisEmailIsAlreadyInUse": "Этот адрес электронной почты уже используется",
"verificationFailedPleaseTryAgain": "Проверка не удалась, попробуйте еще раз",
"yourVerificationCodeHasExpired": "Срок действия вашего проверочного кода истек",
"incorrectCode": "Неверный код",
"sorryTheCodeYouveEnteredIsIncorrect": "Извините, введенный вами код неверный",
"emailChangedTo": "Адрес электронной почты изменен на {newEmail}",
"authenticationFailedPleaseTryAgain": "Аутентификация не удалась, попробуйте еще раз",
"authenticationSuccessful": "Аутентификация прошла успешно!",
"twofactorAuthenticationSuccessfullyReset": "Двухфакторная аутентификация успешно сброшена",
"incorrectRecoveryKey": "Неправильный ключ восстановления",
"theRecoveryKeyYouEnteredIsIncorrect": "Введен неправильный ключ восстановления",
"enterPassword": "Введите пароль",
"selectExportFormat": "Выбрать формат экспорта",
"exportDialogDesc": "Зашифрованные экспортированные данные будут защищены паролем, который вы выберете.",
"encrypted": "Зашифрованный",
"plainText": "Обычный текст",
"passwordToEncryptExport": "Пароль для шифрования экспорта",
"export": "Экспорт"
}

View File

@@ -9,8 +9,11 @@
"onBoardingGetStarted": "Başlayın",
"setupFirstAccount": "İlk hesabınızı ekleyin",
"importScanQrCode": "Karekodu tara",
"qrCode": "QR Kodu",
"importEnterSetupKey": "Kurulum anahtarını giriniz",
"importAccountPageTitle": "Hesap bilgilerinizi girin",
"incorrectDetails": "Bilgiler yanlış",
"pleaseVerifyDetails": "Lütfen bilgileri doğrulayın ve tekrar deneyin",
"codeIssuerHint": "Yayınlayan",
"codeSecretKeyHint": "Gizli Anahtar",
"codeAccountHint": "Hesap (örnek@domain.com)",
@@ -24,7 +27,7 @@
"timeBasedKeyType": "Zaman tabanlı (TOTP)",
"counterBasedKeyType": "Sayaç tabanlı (HOTP)",
"saveAction": "Kaydet",
"nextTotpTitle": "ileri",
"nextTotpTitle": "sonraki",
"deleteCodeTitle": "Kodu silmek istiyor musunuz?",
"deleteCodeMessage": "Bu kodu silmek istediğinize emin misiniz? Bu geri alınamaz bir işlemdir.",
"viewLogsAction": "Günlüğü görüntüle",
@@ -53,6 +56,9 @@
}
},
"contactSupport": "Destek ekibiyle iletişime geçin",
"rateUsOnStore": "Bizi {storeName} üzerinden değerlendirin",
"blog": "Blog",
"merchandise": "Ürünler",
"verifyPassword": "Şifreyi doğrulayın",
"pleaseWait": "Lütfen bekleyin...",
"generatingEncryptionKeysTitle": "Şifreleme anahtarları üretiliyor...",
@@ -67,11 +73,24 @@
"changeEmail": "E-postayı değiştir",
"changePassword": "Şifreyi değiştir",
"data": "Veriler",
"importCodes": "Kodu İçe Aktar",
"importCodes": "Kodu içe aktar",
"importTypePlainText": "Düz metin",
"importTypeEnteEncrypted": "ente Şifreli dışa aktarma",
"passwordForDecryptingExport": "Dışa aktarımın şifresini çözmek için parola",
"passwordEmptyError": "Şifre boş olamaz",
"importFromApp": "Kodları {appName} uygulamasından içe aktarın",
"importGoogleAuthGuide": "\"Hesapları Aktar\" seçeneğini kullanarak hesaplarınızı Google Authenticator'dan bir QR koduna aktarın. Ardından başka bir cihaz kullanarak QR kodunu tarayın.\n\nİpucu: QR kodunun fotoğrafını çekmek için dizüstü bilgisayarınızın kamerasını kullanabilirsiniz.",
"importSelectJsonFile": "JSON dosyasını seçin",
"importEnteEncGuide": "Ente'den dışa aktarılan şifrelenmiş JSON dosyasını seçin",
"importRaivoGuide": "Raivo'nun ayarlarında \"OTP'leri Zip arşivine aktar\" seçeneğini kullanın.\n\nZip dosyasını çıkarın ve JSON dosyasını içe aktarın.",
"importAegisGuide": "Aegis'in Ayarlarında \"Kasayı dışa aktar\" seçeneğini kullanın.\n\nKasanız şifrelenmişse, kasanın şifresini çözmek için kasa parolasını girmeniz gerekecektir.",
"exportCodes": "Kodu dışa aktar",
"importLabel": "İçe aktar",
"importInstruction": "Lütfen aşağıdaki şekilde kodlarınızın listesini içeren dosyayı seçiniz",
"importCodeDelimiterInfo": "Kodlar, virgülle ya da yeni bir satırla ayrılabilir",
"selectFile": "Dosya seç",
"emailVerificationToggle": "E-posta doğrulama",
"authToChangeEmailVerificationSetting": "E-posta doğrulamasını değiştirmek için lütfen kimlik doğrulaması yapın",
"authToViewYourRecoveryKey": "Kurtarma anahtarınızı görmek için lütfen kimliğinizi doğrulayın",
"authToChangeYourEmail": "Epostanızı değiştirmek için lütfen kimliğinizi doğrulayın",
"authToChangeYourPassword": "Şifrenizi değiştirmek için lütfen kimliğinizi doğrulayın",
@@ -90,6 +109,18 @@
"enterYourPasswordHint": "Parolanızı girin",
"forgotPassword": "Şifremi unuttum",
"oops": "Hay aksi",
"suggestFeatures": "Özellik önerin",
"faq": "SSS",
"faq_q_1": "Ente Auth ne kadar güvenli?",
"faq_a_1": "Ente aracılığıyla yedeklediğiniz tüm kodlar uçtan uca şifrelenmiş olarak saklanır. Bu, kodlarınıza yalnızca sizin erişebileceğiniz anlamına gelir. Uygulamalarımız açık kaynaklıdır ve kriptografimiz harici olarak denetlenmiştir.",
"faq_q_2": "Kodlarıma masaüstünden erişebilir miyim?",
"faq_a_2": "Kodlarınıza internet üzerinden @ auth.ente.io adresinden erişebilirsiniz.",
"faq_q_3": "Kodları nasıl silebilirim?",
"faq_a_3": "Bir kodu, o öğenin üzerinde sola kaydırarak silebilirsiniz.",
"faq_q_4": "Bu projeye nasıl destek olabilirim?",
"faq_a_4": "Fotoğraflar uygulamamıza @ ente.io abone olarak bu projenin geliştirilmesine destek olabilirsiniz.",
"faq_q_5": "FaceID kilidini ente Auth'ta nasıl etkinleştirebilirim",
"faq_a_5": "FaceID kilidini Ayarlar → Güvenlik → Kilit Ekranı altında etkinleştirebilirsiniz.",
"somethingWentWrongMessage": "Bir şeyler ters gitti, lütfen tekrar deneyin",
"leaveFamily": "Aile planından ayrıl",
"leaveFamilyMessage": "Aile planından ayrılmak istediğinize emin misiniz?",
@@ -133,7 +164,7 @@
"close": "Kapat",
"oopsSomethingWentWrong": "Hay aksi, bir sorun oluştu.",
"selectLanguage": "Dil Seçin",
"language": "Language",
"language": "Dil",
"social": "Sosyal Medya",
"security": "Güvenlik",
"lockscreen": "Kilit ekranı",
@@ -156,6 +187,7 @@
"recoveryKeySaveDescription": "Biz bu anahtarı saklamıyoruz, lütfen. bu 24 kelimelik anahtarı güvenli bir yerde saklayın.",
"doThisLater": "Bunu daha sonra yap",
"saveKey": "Anahtarı kaydet",
"back": "Geri",
"createAccount": "Hesap oluştur",
"passwordStrength": "Şifre gücü: {passwordStrengthValue}",
"@passwordStrength": {
@@ -214,6 +246,7 @@
"enterYourRecoveryKey": "Kurtarma anahtarınızı girin",
"tempErrorContactSupportIfPersists": "Bir şeyler ters gitmiş gibi görünüyor. Lütfen bir süre sonra tekrar deneyin. Hata devam ederse, lütfen destek ekibimizle iletişime geçin.",
"itLooksLikeSomethingWentWrongPleaseRetryAfterSome": "Bir şeyler ters gitmiş gibi görünüyor. Lütfen bir süre sonra tekrar deneyin. Hata devam ederse, lütfen destek ekibimizle iletişime geçin.",
"about": "Hakkında",
"weAreOpenSource": "Biz açık kaynağız!",
"privacy": "Gizlilik",
"terms": "Şartlar",
@@ -238,6 +271,7 @@
}
}
},
"sorry": "Üzgünüz",
"importFailureDesc": "Seçilen dosya ayrıştırılamadı.\nYardıma ihtiyacınız varsa lütfen support@ente.io adresine yazın!",
"pendingSyncs": "Uyarı",
"pendingSyncsWarningBody": "Kodlarınızdan bazıları yedeklenmemiş.\n\nLütfen oturumu kapatmadan önce bu kodların yedeğini aldığınızdan emin olun.",
@@ -257,7 +291,28 @@
},
"activeSessions": "Aktif oturumlar",
"somethingWentWrongPleaseTryAgain": "Bir şeyler ters gitti, lütfen tekrar deneyin",
"thisWillLogYouOutOfThisDevice": "Bu sizin bu cihazdaki oturumunuzu kapatacaktır!",
"thisWillLogYouOutOfTheFollowingDevice": "Bu, aşağıdaki cihazdan çıkış yapmanızı sağlayacaktır:",
"terminateSession": "Oturumu sonlandır?",
"terminate": "Sonlandır",
"thisDevice": "Bu cihaz"
"thisDevice": "Bu cihaz",
"toResetVerifyEmail": "Şifrenizi sıfırlamak için lütfen önce e-postanızı doğrulayın.",
"thisEmailIsAlreadyInUse": "Bu e-posta zaten kullanılıyor",
"verificationFailedPleaseTryAgain": "Doğrulama başarısız oldu, lütfen tekrar deneyin",
"yourVerificationCodeHasExpired": "Doğrulama kodunuzun süresi doldu",
"incorrectCode": "Yanlış kod",
"sorryTheCodeYouveEnteredIsIncorrect": "Üzgünüz, girdiğiniz kod yanlış",
"emailChangedTo": "E-posta {newEmail} olarak değiştirildi",
"authenticationFailedPleaseTryAgain": "Kimlik doğrulama başarısız oldu, lütfen tekrar deneyin",
"authenticationSuccessful": "Kimlik doğrulama başarılı!",
"twofactorAuthenticationSuccessfullyReset": "İki faktörlü kimlik doğrulama başarıyla sıfırlandı",
"incorrectRecoveryKey": "Yanlış kurtarma kodu",
"theRecoveryKeyYouEnteredIsIncorrect": "Girdiğiniz kurtarma kodu yanlış",
"enterPassword": "Şifreyi girin",
"selectExportFormat": "Dışa aktarma formatını seç",
"exportDialogDesc": "Şifrelenmiş dışa aktarımlar seçtiğiniz bir parola ile korunacaktır.",
"encrypted": "Şifreli",
"plainText": "Düz metin",
"passwordToEncryptExport": "Dışa aktarımı şifrelemek için parola",
"export": "Dışa aktar"
}

271
lib/l10n/arb/app_vi.arb Normal file
View File

@@ -0,0 +1,271 @@
{
"account": "Tài khoản",
"recoveryKey": "Khóa khôi phục",
"counterAppBarTitle": "Bộ Đếm",
"@counterAppBarTitle": {
"description": "Text shown in the AppBar of the Counter Page"
},
"onBoardingBody": "Bảo mật mã 2FA của bạn",
"onBoardingGetStarted": "Bắt đầu",
"setupFirstAccount": "Thiết lập tài khoản đầu tiên của bạn",
"importScanQrCode": "Quét mã QR",
"importEnterSetupKey": "Nhập khóa thiết lập",
"importAccountPageTitle": "Nhập chi tiết tài khoản",
"secretCanNotBeEmpty": "Khoá bí mật không được để trống",
"bothIssuerAndAccountCanNotBeEmpty": "Cả nhà phát hành và tài khoản không được để trống",
"incorrectDetails": "Thông tin chi tiết không chính xác",
"pleaseVerifyDetails": "Vui lòng xác minh chi tiết và thử lại",
"codeIssuerHint": "Nhà phát hành",
"codeSecretKeyHint": "Khóa bí mật",
"codeAccountHint": "Tài khoản (bạn@miền.com)",
"accountKeyType": "Loại khóa",
"sessionExpired": "Phiên làm việc đã hết hạn",
"@sessionExpired": {
"description": "Title of the dialog when the users current session is invalid/expired"
},
"pleaseLoginAgain": "Vui lòng đăng nhập lại",
"loggingOut": "Đang thoát...",
"timeBasedKeyType": "Dựa trên thời gian (TOTP)",
"counterBasedKeyType": "Dựa trên bộ đếm (HOTP)",
"saveAction": "Lưu",
"nextTotpTitle": "tiếp",
"deleteCodeTitle": "Xóa mã?",
"deleteCodeMessage": "Bạn có chắc chắn muốn xóa mã này không? Hành động này không thể đảo ngược.",
"viewLogsAction": "Xem các bản ghi",
"sendLogsDescription": "Thao tác này sẽ gửi nhật ký để giúp chúng tôi gỡ lỗi sự cố của bạn. Mặc dù chúng tôi thực hiện các biện pháp phòng ngừa để đảm bảo rằng thông tin nhạy cảm không được ghi lại, nhưng chúng tôi khuyến khích bạn xem các nhật ký này trước khi chia sẻ chúng.",
"preparingLogsTitle": "Đang chuẩn bị nhật ký...",
"emailLogsTitle": "Nhật ký email",
"emailLogsMessage": "Vui lòng gửi nhật ký tới {email}",
"@emailLogsMessage": {
"placeholders": {
"email": {
"type": "String"
}
}
},
"copyEmailAction": "Sao chép email",
"exportLogsAction": "Xuất nhật ký",
"reportABug": "Báo cáo lỗi",
"crashAndErrorReporting": "Báo cáo sự cố và lỗi",
"reportBug": "Báo lỗi",
"emailUsMessage": "Vui lòng gửi email cho chúng tôi tại {email}",
"@emailUsMessage": {
"placeholders": {
"email": {
"type": "String"
}
}
},
"contactSupport": "Liên hệ hỗ trợ",
"verifyPassword": "Xác nhận mật khẩu",
"pleaseWait": "Vui lòng chờ...",
"generatingEncryptionKeysTitle": "Đang tạo khóa mã hóa...",
"recreatePassword": "Tạo lại mật khẩu",
"recreatePasswordMessage": "Thiết bị hiện tại không đủ mạnh để xác minh mật khẩu của bạn, vì vậy chúng tôi cần tạo lại mật khẩu một lần theo cách hoạt động với tất cả các thiết bị. \n\nVui lòng đăng nhập bằng khóa khôi phục và tạo lại mật khẩu của bạn (bạn có thể sử dụng lại cùng một mật khẩu nếu muốn).",
"useRecoveryKey": "Dùng khóa khôi phục",
"incorrectPasswordTitle": "Mật khẩu không đúng",
"welcomeBack": "Chào mừng trở lại!",
"madeWithLoveAtPrefix": "được làm bằng ❤️ tại ",
"supportDevs": "Đăng ký <bold-green>ente</bold-green> để hỗ trợ dự án này.",
"supportDiscount": "Sử dụng mã giảm giá \"AUTH\" để được giảm 10% trong năm đầu tiên",
"changeEmail": "Thay đổi email",
"changePassword": "Thay đổi mật khẩu",
"data": "Dữ liệu",
"importCodes": "Nhập mã",
"exportCodes": "Xuất mã",
"importInstruction": "Vui lòng chọn tệp chứa danh sách mã của bạn ở định dạng sau",
"importCodeDelimiterInfo": "Các mã có thể được phân tách bằng một dấu phẩy hoặc một dòng mới",
"selectFile": "Chọn tập tin",
"authToViewYourRecoveryKey": "Vui lòng xác thực để xem khóa khôi phục của bạn",
"authToChangeYourEmail": "Vui lòng xác thực để thay đổi email của bạn",
"authToChangeYourPassword": "Vui lòng xác thực để thay đổi mật khẩu của bạn",
"ok": "Được rồi",
"cancel": "Hủy",
"yes": "Đúng",
"no": "Không",
"email": "Thư điện tử",
"support": "Hỗ trợ",
"settings": "Cài đặt",
"copied": "\u001dĐã sao chép",
"pleaseTryAgain": "Vui lòng thử lại",
"existingUser": "Người dùng hiện tại",
"newUser": "Mới tham gia ente",
"delete": "Xóa",
"enterYourPasswordHint": "Nhập mật khẩu của bạn",
"forgotPassword": "Quên mật khẩu",
"oops": "Rất tiếc",
"somethingWentWrongMessage": "Phát hiện có lỗi, xin thử lại",
"leaveFamily": "Rời khỏi gia đình",
"leaveFamilyMessage": "Bạn có chắc chắn muốn thoát khỏi gói dành cho gia đình không?",
"inFamilyPlanMessage": "Bạn đang sử dụng gói dành cho gia đình!",
"swipeHint": "Vuốt sang trái để chỉnh sửa hoặc xóa mã",
"scan": "Quét",
"scanACode": "Quét mã",
"verify": "Xác minh",
"verifyEmail": "Xác nhận địa chỉ Email",
"enterCodeHint": "Nhập mã gồm 6 chữ số từ ứng dụng xác thực của bạn",
"lostDeviceTitle": "Bạn đã mất thiết bị?",
"twoFactorAuthTitle": "Xác thực hai yếu tố",
"recoverAccount": "Khôi phục tài khoản",
"enterRecoveryKeyHint": "Nhập khóa khôi phục của bạn",
"recover": "Khôi phục",
"contactSupportViaEmailMessage": "Vui lòng gửi email đến {email} từ địa chỉ email đã đăng ký của bạn",
"@contactSupportViaEmailMessage": {
"placeholders": {
"email": {
"type": "String"
}
}
},
"noRecoveryKeyTitle": "Không có khóa khôi phục?",
"enterEmailHint": "Nhập địa chỉ email của bạn",
"invalidEmailTitle": "Địa chỉ email không hợp lệ",
"invalidEmailMessage": "Xin vui lòng nhập một địa chỉ email hợp lệ.",
"deleteAccount": "Xoá tài khoản",
"deleteAccountQuery": "Chúng tôi sẽ rất tiếc khi thấy bạn đi. Bạn đang phải đối mặt với một số vấn đề?",
"yesSendFeedbackAction": "Có, gửi phản hồi",
"noDeleteAccountAction": "Không, xóa tài khoản",
"initiateAccountDeleteTitle": "Vui lòng xác thực để bắt đầu xóa tài khoản",
"confirmAccountDeleteTitle": "Bạn có chắc rằng bạn muốn xóa tài khoản ente của bạn không?",
"confirmAccountDeleteMessage": "Dữ liệu đã tải lên của bạn, trên tất cả các ứng dụng (cả Ảnh và Authenticator), sẽ được lên lịch xóa và tài khoản của bạn sẽ bị xóa vĩnh viễn.",
"sendEmail": "Gửi email",
"createNewAccount": "Tạo tài khoản mới",
"weakStrength": "Yếu",
"strongStrength": "Mạnh",
"moderateStrength": "Trung bình",
"confirmPassword": "Xác nhận mật khẩu",
"close": "Đóng",
"oopsSomethingWentWrong": "Rất tiếc, Đã xảy ra lỗi.",
"selectLanguage": "Chọn ngôn ngữ",
"language": "Ngôn ngữ",
"social": "Xã hội",
"security": "Bảo mật",
"lockscreen": "Màn hình khoá",
"authToChangeLockscreenSetting": "Vui lòng xác thực để thay đổi cài đặt màn hình khóa",
"lockScreenEnablePreSteps": "Để bật màn hình khóa, vui lòng thiết lập mật khẩu thiết bị hoặc khóa màn hình trong cài đặt hệ thống của bạn.",
"viewActiveSessions": "Xem danh sách phiên làm việc hiện tại",
"authToViewYourActiveSessions": "Vui lòng xác thực để xem danh sách phiên làm việc của bạn",
"searchHint": "Tìm kiếm...",
"search": "Tìm kiếm",
"sorryUnableToGenCode": "Rất tiếc, không thể tạo mã cho {issuerName}",
"noResult": "Không có kết quả",
"addCode": "Thêm mã",
"scanAQrCode": "Quét mã QR",
"enterDetailsManually": "Nhập chi tiết thủ công",
"edit": "Sửa",
"copiedToClipboard": "Đã sao chép vào khay nhớ tạm",
"error": "Lỗi",
"recoveryKeyCopiedToClipboard": "Đã sao chép khóa khôi phục vào bộ nhớ tạm",
"recoveryKeyOnForgotPassword": "Nếu bạn quên mật khẩu, cách duy nhất bạn có thể khôi phục dữ liệu của mình là sử dụng khóa này.",
"recoveryKeySaveDescription": "Chúng tôi không lưu trữ khóa này, vui lòng lưu khóa 24 từ này ở nơi an toàn.",
"doThisLater": "Để sau",
"saveKey": "Lưu khóa",
"createAccount": "Tạo tài khoản",
"passwordStrength": "Độ mạnh mật khẩu: {passwordStrengthValue}",
"@passwordStrength": {
"description": "Text to indicate the password strength",
"placeholders": {
"passwordStrengthValue": {
"description": "The strength of the password as a string",
"type": "String",
"example": "Weak or Moderate or Strong"
}
},
"message": "Password Strength: {passwordStrengthText}"
},
"password": "Mật khẩu",
"signUpTerms": "Tôi đồng ý với <u-terms>điều khoản dịch vụ</u-terms> và <u-policy>chính sách quyền riêng tư</u-policy>",
"privacyPolicyTitle": "Chính sách bảo mật",
"termsOfServicesTitle": "Điều khoản",
"encryption": "Mã hóa",
"setPasswordTitle": "Đặt mật khẩu",
"changePasswordTitle": "Thay đổi mật khẩu",
"resetPasswordTitle": "Đặt lại mật khẩu",
"encryptionKeys": "Khóa mã hóa",
"passwordWarning": "Chúng tôi không lưu trữ mật khẩu này, vì vậy nếu bạn quên, <underline>chúng tôi không thể giải mã dữ liệu của bạn</underline>",
"enterPasswordToEncrypt": "Nhập mật khẩu mà chúng tôi có thể sử dụng để mã hóa dữ liệu của bạn",
"enterNewPasswordToEncrypt": "Nhập một mật khẩu mới mà chúng tôi có thể sử dụng để mã hóa dữ liệu của bạn",
"passwordChangedSuccessfully": "Thay đổi mật khẩu thành công",
"generatingEncryptionKeys": "Đang tạo khóa mã hóa...",
"continueLabel": "Tiếp tục",
"insecureDevice": "Thiết bị không an toàn",
"sorryWeCouldNotGenerateSecureKeysOnThisDevicennplease": "Rất tiếc, chúng tôi không thể tạo khóa bảo mật trên thiết bị này.\n\nvui lòng đăng ký từ một thiết bị khác.",
"howItWorks": "Cách thức hoạt động",
"ackPasswordLostWarning": "Tôi hiểu rằng việc mất mật khẩu có thể đồng nghĩa với việc mất dữ liệu của tôi vì dữ liệu của tôi được <underline>mã hóa hai đầu</underline>.",
"loginTerms": "Bằng cách nhấp vào đăng nhập, tôi đồng ý với <u-terms>điều khoản dịch vụ</u-terms> và <u-policy>chính sách quyền riêng tư</u-policy>",
"logInLabel": "Đăng nhập",
"logout": "Đăng xuất",
"areYouSureYouWantToLogout": "Bạn có chắc chắn muốn đăng xuất?",
"yesLogout": "Có, đăng xuất",
"exit": "Thoát",
"verifyingRecoveryKey": "Đang xác minh khóa khôi phục...",
"recoveryKeyVerified": "Khóa khôi phục đã được xác thực",
"recoveryKeySuccessBody": "Tuyệt vời! Khóa khôi phục của bạn hợp lệ. Cảm ơn bạn đã xác minh.\n\nHãy nhớ sao lưu khóa khôi phục của bạn một cách an toàn.",
"invalidRecoveryKey": "Khóa khôi phục bạn đã nhập không hợp lệ. Vui lòng đảm bảo rằng nó chứa 24 từ và kiểm tra chính tả của từng từ.\n\nNếu bạn đã nhập mã khôi phục cũ hơn, hãy đảm bảo mã đó dài 64 ký tự và kiểm tra từng ký tự.",
"recreatePasswordTitle": "Tạo lại mật khẩu",
"recreatePasswordBody": "Thiết bị hiện tại không đủ mạnh để xác minh mật khẩu của bạn nhưng chúng tôi có thể tạo lại mật khẩu theo cách hoạt động với tất cả các thiết bị.\n\nVui lòng đăng nhập bằng khóa khôi phục và tạo lại mật khẩu của bạn (bạn có thể sử dụng lại cùng một mật khẩu nếu muốn).",
"invalidKey": "Khoá không hợp lệ",
"tryAgain": "Thử lại",
"viewRecoveryKey": "Hiển thị khóa khôi phục",
"confirmRecoveryKey": "Xác nhận khóa khôi phục",
"recoveryKeyVerifyReason": "Nếu bạn quên mật khẩu, khóa khôi phục là cách duy nhất để khôi phục ảnh của bạn. Bạn có thể tìm thấy khóa khôi phục của mình trong Cài đặt > Tài khoản.\n\nVui lòng nhập khóa khôi phục của bạn tại đây để xác minh rằng bạn đã lưu chính xác.",
"confirmYourRecoveryKey": "Xác nhận khóa khôi phục",
"confirm": "Xác nhận",
"emailYourLogs": "Gửi email nhật ký của bạn",
"pleaseSendTheLogsTo": "Vui lòng gửi nhật ký đến \n{toEmail}",
"copyEmailAddress": "Sao chép địa chỉ email",
"exportLogs": "Xuất nhật ký",
"enterYourRecoveryKey": "Nhập khóa khôi phục của bạn",
"tempErrorContactSupportIfPersists": "Có vẻ như đã xảy ra sự cố. Vui lòng thử lại sau một thời gian. Nếu lỗi vẫn tiếp diễn, vui lòng liên hệ với nhóm hỗ trợ của chúng tôi.",
"itLooksLikeSomethingWentWrongPleaseRetryAfterSome": "Có vẻ như đã xảy ra sự cố. Vui lòng thử lại sau một thời gian. Nếu lỗi vẫn tiếp diễn, vui lòng liên hệ với nhóm hỗ trợ của chúng tôi.",
"about": "Về chúng tôi",
"weAreOpenSource": "Chúng tôi có mã nguồn mở!",
"privacy": "Riêng tư",
"terms": "Điều khoản",
"checkForUpdates": "Kiểm tra cập nhật",
"checking": "Đang kiểm tra...",
"youAreOnTheLatestVersion": "Bạn đang sử dụng phiên bản mới nhất",
"warning": "Cánh báo",
"exportWarningDesc": "Tệp đã xuất chứa thông tin nhạy cảm. Hãy lưu trữ tệp này một cách an toàn.",
"iUnderStand": "Tôi hiểu",
"@iUnderStand": {
"description": "Text for the button to confirm the user understands the warning"
},
"authToExportCodes": "Vui lòng xác thực để xuất mã của bạn",
"importSuccessTitle": "Hoan hô!",
"importSuccessDesc": "Bạn đã nhập {count} mã!",
"@importSuccessDesc": {
"placeholders": {
"count": {
"description": "The number of codes imported",
"type": "int",
"example": "1"
}
}
},
"sorry": "Xin lỗi",
"importFailureDesc": "Không thể phân tích cú pháp tệp đã chọn.\nVui lòng viết thư cho support@ente.io nếu bạn cần trợ giúp!",
"pendingSyncs": "Cánh báo",
"pendingSyncsWarningBody": "Một số mã của bạn chưa được sao lưu.\n\nVui lòng đảm bảo rằng bạn có bản sao lưu cho các mã này trước khi đăng xuất.",
"checkInboxAndSpamFolder": "Vui lòng kiểm tra hộp thư đến (và thư rác) của bạn để hoàn tất xác minh",
"tapToEnterCode": "Chạm để nhập mã",
"resendEmail": "Gửi lại email",
"weHaveSendEmailTo": "Chúng tôi đã gửi thư đến <green>{email}</green>",
"@weHaveSendEmailTo": {
"description": "Text to indicate that we have sent a mail to the user",
"placeholders": {
"email": {
"description": "The email address of the user",
"type": "String",
"example": "example@ente.io"
}
}
},
"activeSessions": "Các phiên làm việc hiện tại",
"somethingWentWrongPleaseTryAgain": "Phát hiện có lỗi, xin thử lại",
"thisWillLogYouOutOfThisDevice": "Thao tác này sẽ đăng xuất bạn khỏi thiết bị này!",
"thisWillLogYouOutOfTheFollowingDevice": "Thao tác này sẽ đăng xuất bạn khỏi thiết bị sau:",
"terminateSession": "Chấm dứt phiên?",
"terminate": "Dừng lại",
"thisDevice": "Thiết bị này"
}

View File

@@ -9,8 +9,13 @@
"onBoardingGetStarted": "开始",
"setupFirstAccount": "设置您的第一个账户",
"importScanQrCode": "扫描二维码",
"qrCode": "二维码",
"importEnterSetupKey": "输入设置密钥",
"importAccountPageTitle": "输入账户详细信息",
"secretCanNotBeEmpty": "密码不能为空",
"bothIssuerAndAccountCanNotBeEmpty": "发行人和账户均不能为空",
"incorrectDetails": "详细信息不正确",
"pleaseVerifyDetails": "请验证详细信息并重试",
"codeIssuerHint": "发行人",
"codeSecretKeyHint": "私钥",
"codeAccountHint": "账户 (you@domain.com)",
@@ -53,6 +58,9 @@
}
},
"contactSupport": "联系支持",
"rateUsOnStore": "在 {storeName} 上给我们评分",
"blog": "博客",
"merchandise": "商品",
"verifyPassword": "验证密码",
"pleaseWait": "请稍候...",
"generatingEncryptionKeysTitle": "正在生成加密密钥...",
@@ -68,10 +76,23 @@
"changePassword": "修改密码",
"data": "数据",
"importCodes": "导入代码",
"importTypePlainText": "纯文本",
"importTypeEnteEncrypted": "ente 加密导出",
"passwordForDecryptingExport": "用来解密导出的密码",
"passwordEmptyError": "密码不能为空",
"importFromApp": "从 {appName} 导入代码",
"importGoogleAuthGuide": "使用“转移帐户”选项将您的帐户从 Google 身份验证器导出到二维码。然后使用另一台设备扫描二维码。\n\n提示您可以使用笔记本电脑的网络摄像头拍摄二维码的照片。",
"importSelectJsonFile": "选择 JSON 文件",
"importEnteEncGuide": "选择从ente导出的加密JSON文件",
"importRaivoGuide": "使用 Raivo 设置中的“将 OTP 导出到 Zip 存档”选项。\n\n解压 zip 文件并导入 JSON 文件。",
"importAegisGuide": "在Aegis的设置中使用\"导出密码库\"选项。\n\n如果您的密码库已加密您需要输入密码才能解密密码库。",
"exportCodes": "导出代码",
"importLabel": "导入",
"importInstruction": "请以以下格式选择包含代码列表的文件",
"importCodeDelimiterInfo": "代码可以用逗号或新行分隔。",
"selectFile": "选择文件",
"emailVerificationToggle": "电子邮件验证",
"authToChangeEmailVerificationSetting": "请进行身份验证以更改电子邮件验证",
"authToViewYourRecoveryKey": "请验证以查看您的恢复密钥",
"authToChangeYourEmail": "请验证以更改您的电子邮件",
"authToChangeYourPassword": "请验证以更改密码",
@@ -90,6 +111,18 @@
"enterYourPasswordHint": "输入您的密码",
"forgotPassword": "忘记密码",
"oops": "哎呀",
"suggestFeatures": "建议新功能",
"faq": "常见问题",
"faq_q_1": "ente Auth的安全程度如何",
"faq_a_1": "您通过 ente 备份的所有代码均以端到端加密方式存储。这意味着只有您可以访问您的代码。 我们的应用程序是开源的,我们的加密技术已经过外部审计。",
"faq_q_2": "我可以在桌面上访问我的代码吗?",
"faq_a_2": "您可以在 web @auth.ente.io 上访问您的代码。",
"faq_q_3": "我如何删除代码?",
"faq_a_3": "您可以通过向左滑动该项目来删除该代码。",
"faq_q_4": "我该如何支持该项目?",
"faq_a_4": "您可以通过订阅我们的照片应用程序@ente.io来支持该项目的开发。",
"faq_q_5": "如何在 ente Auth 中启用 FaceID 锁定",
"faq_a_5": "您可以在“设置”→“安全”→“锁屏”下启用 FaceID 锁定。",
"somethingWentWrongMessage": "出了点问题,请重试",
"leaveFamily": "离开家庭",
"leaveFamilyMessage": "您确定要离开家庭计划吗?",
@@ -156,6 +189,7 @@
"recoveryKeySaveDescription": "我们不会存储此密钥请将此24个单词密钥保存在一个安全的地方。",
"doThisLater": "稍后再做",
"saveKey": "保存密钥",
"back": "返回",
"createAccount": "创建账户",
"passwordStrength": "密码强度: {passwordStrengthValue}",
"@passwordStrength": {
@@ -263,5 +297,24 @@
"thisWillLogYouOutOfTheFollowingDevice": "这将使您在以下设备中退出登录:",
"terminateSession": "是否终止会话?",
"terminate": "终止",
"thisDevice": "此设备"
"thisDevice": "此设备",
"toResetVerifyEmail": "要重置您的密码,请先验证您的电子邮件。",
"thisEmailIsAlreadyInUse": "该电子邮件已被使用",
"verificationFailedPleaseTryAgain": "验证失败,请再试一次",
"yourVerificationCodeHasExpired": "您的验证码已过期",
"incorrectCode": "验证码错误",
"sorryTheCodeYouveEnteredIsIncorrect": "抱歉,您输入的验证码不正确",
"emailChangedTo": "电子邮件已更改为 {newEmail}",
"authenticationFailedPleaseTryAgain": "认证失败,请重试",
"authenticationSuccessful": "认证成功!",
"twofactorAuthenticationSuccessfullyReset": "双因素身份验证已成功重置",
"incorrectRecoveryKey": "恢复密钥不正确",
"theRecoveryKeyYouEnteredIsIncorrect": "您输入的恢复密钥不正确",
"enterPassword": "输入密码",
"selectExportFormat": "选择导出格式",
"exportDialogDesc": "加密导出将由您选择的密码保护。",
"encrypted": "已加密",
"plainText": "纯文本",
"passwordToEncryptExport": "用来加密导出的密码",
"export": "导出"
}

View File

@@ -1,4 +1,5 @@
import 'package:adaptive_theme/adaptive_theme.dart';
import 'package:computer/computer.dart';
import "package:ente_auth/app/view/app.dart";
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/core/constants.dart';
@@ -16,7 +17,9 @@ import 'package:ente_auth/services/user_service.dart';
import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/ui/tools/app_lock.dart';
import 'package:ente_auth/ui/tools/lock_screen.dart';
import 'package:ente_auth/ui/utils/icon_utils.dart';
import 'package:ente_auth/utils/crypto_util.dart';
import 'package:flutter/foundation.dart';
import "package:flutter/material.dart";
import 'package:logging/logging.dart';
import 'package:path_provider/path_provider.dart';
@@ -70,6 +73,8 @@ Future _runWithLogs(Function() function, {String prefix = ""}) async {
}
Future<void> _init(bool bool, {String? via}) async {
// Start workers asynchronously. No need to wait for them to start
Computer.shared().turnOn(workersCount: 4, verbose: kDebugMode);
CryptoUtil.init();
await PreferenceService.instance.init();
await CodeStore.instance.init();
@@ -81,4 +86,5 @@ Future<void> _init(bool bool, {String? via}) async {
await BillingService.instance.init();
await NotificationService.instance.init();
await UpdateService.instance.init();
await IconUtils.instance.init();
}

View File

@@ -0,0 +1,135 @@
class SetupSRPRequest {
final String srpUserID;
final String srpSalt;
final String srpVerifier;
final String srpA;
final bool isUpdate;
SetupSRPRequest({
required this.srpUserID,
required this.srpSalt,
required this.srpVerifier,
required this.srpA,
required this.isUpdate,
});
Map<String, dynamic> toMap() {
return {
'srpUserID': srpUserID.toString(),
'srpSalt': srpSalt,
'srpVerifier': srpVerifier,
'srpA': srpA,
'isUpdate': isUpdate,
};
}
factory SetupSRPRequest.fromJson(Map<String, dynamic> json) {
return SetupSRPRequest(
srpUserID: json['srpUserID'],
srpSalt: json['srpSalt'],
srpVerifier: json['srpVerifier'],
srpA: json['srpA'],
isUpdate: json['isUpdate'],
);
}
}
class SetupSRPResponse {
final String setupID;
final String srpB;
SetupSRPResponse({
required this.setupID,
required this.srpB,
});
Map<String, dynamic> toMap() {
return {
'setupID': setupID.toString(),
'srpB': srpB,
};
}
factory SetupSRPResponse.fromJson(Map<String, dynamic> json) {
return SetupSRPResponse(
setupID: json['setupID'],
srpB: json['srpB'],
);
}
}
class CompleteSRPSetupRequest {
final String setupID;
final String srpM1;
CompleteSRPSetupRequest({
required this.setupID,
required this.srpM1,
});
Map<String, dynamic> toMap() {
return {
'setupID': setupID.toString(),
'srpM1': srpM1,
};
}
factory CompleteSRPSetupRequest.fromJson(Map<String, dynamic> json) {
return CompleteSRPSetupRequest(
setupID: json['setupID'],
srpM1: json['srpM1'],
);
}
}
class SrpAttributes {
final String srpUserID;
final String srpSalt;
final int memLimit;
final int opsLimit;
final String kekSalt;
final bool isEmailMFAEnabled;
SrpAttributes({
required this.srpUserID,
required this.srpSalt,
required this.memLimit,
required this.opsLimit,
required this.kekSalt,
required this.isEmailMFAEnabled,
});
factory SrpAttributes.fromMap(Map<String, dynamic> map) {
return SrpAttributes(
srpUserID: map['attributes']['srpUserID'],
srpSalt: map['attributes']['srpSalt'],
memLimit: map['attributes']['memLimit'],
opsLimit: map['attributes']['opsLimit'],
kekSalt: map['attributes']['kekSalt'],
isEmailMFAEnabled: map['attributes']['isEmailMFAEnabled'],
);
}
}
class CompleteSRPSetupResponse {
final String setupID;
final String srpM2;
CompleteSRPSetupResponse({
required this.setupID,
required this.srpM2,
});
Map<String, dynamic> toMap() {
return {
'setupID': setupID,
'srpM2': srpM2,
};
}
factory CompleteSRPSetupResponse.fromJson(Map<String, dynamic> json) {
return CompleteSRPSetupResponse(
setupID: json['setupID'],
srpM2: json['srpM2'],
);
}
}

View File

@@ -13,6 +13,7 @@ class Code {
final Algorithm algorithm;
final Type type;
final String rawData;
final int counter;
bool? hasSynced;
Code(
@@ -23,6 +24,7 @@ class Code {
this.secret,
this.algorithm,
this.type,
this.counter,
this.rawData, {
this.generatedID,
});
@@ -35,6 +37,7 @@ class Code {
String? secret,
Algorithm? algorithm,
Type? type,
int? counter,
}) {
final String updateAccount = account ?? this.account;
final String updateIssuer = issuer ?? this.issuer;
@@ -43,6 +46,7 @@ class Code {
final String updatedSecret = secret ?? this.secret;
final Algorithm updatedAlgo = algorithm ?? this.algorithm;
final Type updatedType = type ?? this.type;
final int updatedCounter = counter ?? this.counter;
return Code(
updateAccount,
@@ -52,6 +56,7 @@ class Code {
updatedSecret,
updatedAlgo,
updatedType,
updatedCounter,
"otpauth://${updatedType.name}/" +
updateIssuer +
":" +
@@ -59,7 +64,7 @@ class Code {
"?algorithm=${updatedAlgo.name}&digits=$updatedDigits&issuer=" +
updateIssuer +
"&period=$updatePeriod&secret=" +
updatedSecret,
updatedSecret + (updatedType == Type.hotp ? "&counter=$updatedCounter" : ""),
generatedID: generatedID,
);
}
@@ -77,6 +82,7 @@ class Code {
secret,
Algorithm.sha1,
Type.totp,
0,
"otpauth://totp/" +
issuer +
":" +
@@ -99,6 +105,7 @@ class Code {
getSanitizedSecret(uri.queryParameters['secret']!),
_getAlgorithm(uri),
_getType(uri),
_getCounter(uri),
rawData,
);
} catch(e) {
@@ -163,6 +170,18 @@ class Code {
}
}
static int _getCounter(Uri uri) {
try {
final bool hasCounterKey = uri.queryParameters.containsKey('counter');
if (!hasCounterKey) {
return 0;
}
return int.parse(uri.queryParameters['counter']!);
} catch (e) {
return defaultPeriod;
}
}
static Algorithm _getAlgorithm(Uri uri) {
try {
final algorithm =
@@ -197,6 +216,7 @@ class Code {
other.digits == digits &&
other.period == period &&
other.secret == secret &&
other.counter == counter &&
other.type == type &&
other.rawData == rawData;
}
@@ -209,6 +229,7 @@ class Code {
period.hashCode ^
secret.hashCode ^
type.hashCode ^
counter.hashCode ^
rawData.hashCode;
}
}

View File

@@ -0,0 +1,66 @@
/*
Version: 1.0
KDF Algo: ARGON2ID
Decrypted Data Format: It contains code.rawData [1] separated by new line.
[1] otpauth://totp/provider.com:you@email.com?secret=YOUR_SECRET
*/
class EnteAuthExport {
final int version;
final KDFParams kdfParams;
final String encryptedData;
final String encryptionNonce;
// Named constructor which can be used to specify each field individually
EnteAuthExport({
required this.version,
required this.kdfParams,
required this.encryptedData,
required this.encryptionNonce,
});
// Convert EnteExport object to JSON
Map<String, dynamic> toJson() => {
'version': version,
'kdfParams': kdfParams.toJson(),
'encryptedData': encryptedData,
'encryptionNonce': encryptionNonce,
};
// Convert JSON to EnteExport object
static EnteAuthExport fromJson(Map<String, dynamic> json) => EnteAuthExport(
version: json['version'],
kdfParams: KDFParams.fromJson(json['kdfParams']),
encryptedData: json['encryptedData'],
encryptionNonce: json['encryptionNonce'],
);
}
// KDFParams is a class that holds the parameters for the KDF function.
// It is used to derive a key from a password.
class KDFParams {
final int memLimit;
final int opsLimit;
final String salt;
// Named constructor which can be used to specify each field individually
KDFParams({
required this.memLimit,
required this.opsLimit,
required this.salt,
});
// Convert KDFParams object to JSON
Map<String, dynamic> toJson() => {
'memLimit': memLimit,
'opsLimit': opsLimit,
'salt': salt,
};
// Convert JSON to KDFParams object
static KDFParams fromJson(Map<String, dynamic> json) => KDFParams(
memLimit: json['memLimit'],
opsLimit: json['opsLimit'],
salt: json['salt'],
);
}

View File

@@ -1,9 +1,12 @@
import 'dart:typed_data';
import 'package:ente_auth/models/key_attributes.dart';
import 'package:ente_auth/models/private_key_attributes.dart';
class KeyGenResult {
final KeyAttributes keyAttributes;
final PrivateKeyAttributes privateKeyAttributes;
final Uint8List loginKey;
KeyGenResult(this.keyAttributes, this.privateKeyAttributes);
KeyGenResult(this.keyAttributes, this.privateKeyAttributes, this.loginKey);
}

View File

@@ -0,0 +1,202 @@
//
// Generated code. Do not modify.
// source: googleauth.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:fixnum/fixnum.dart' as $fixnum;
import 'package:protobuf/protobuf.dart' as $pb;
// ignore: always_use_package_imports
import 'googleauth.pbenum.dart';
export 'googleauth.pbenum.dart';
class MigrationPayload_OtpParameters extends $pb.GeneratedMessage {
factory MigrationPayload_OtpParameters() => create();
MigrationPayload_OtpParameters._() : super();
factory MigrationPayload_OtpParameters.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory MigrationPayload_OtpParameters.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'MigrationPayload.OtpParameters', package: const $pb.PackageName(_omitMessageNames ? '' : 'googleauth'), createEmptyInstance: create)
..a<$core.List<$core.int>>(1, _omitFieldNames ? '' : 'secret', $pb.PbFieldType.OY)
..aOS(2, _omitFieldNames ? '' : 'name')
..aOS(3, _omitFieldNames ? '' : 'issuer')
..e<MigrationPayload_Algorithm>(4, _omitFieldNames ? '' : 'algorithm', $pb.PbFieldType.OE, defaultOrMaker: MigrationPayload_Algorithm.ALGORITHM_UNSPECIFIED, valueOf: MigrationPayload_Algorithm.valueOf, enumValues: MigrationPayload_Algorithm.values)
..e<MigrationPayload_DigitCount>(5, _omitFieldNames ? '' : 'digits', $pb.PbFieldType.OE, defaultOrMaker: MigrationPayload_DigitCount.DIGIT_COUNT_UNSPECIFIED, valueOf: MigrationPayload_DigitCount.valueOf, enumValues: MigrationPayload_DigitCount.values)
..e<MigrationPayload_OtpType>(6, _omitFieldNames ? '' : 'type', $pb.PbFieldType.OE, defaultOrMaker: MigrationPayload_OtpType.OTP_TYPE_UNSPECIFIED, valueOf: MigrationPayload_OtpType.valueOf, enumValues: MigrationPayload_OtpType.values)
..aInt64(7, _omitFieldNames ? '' : 'counter')
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
MigrationPayload_OtpParameters clone() => MigrationPayload_OtpParameters()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
MigrationPayload_OtpParameters copyWith(void Function(MigrationPayload_OtpParameters) updates) => super.copyWith((message) => updates(message as MigrationPayload_OtpParameters)) as MigrationPayload_OtpParameters;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static MigrationPayload_OtpParameters create() => MigrationPayload_OtpParameters._();
MigrationPayload_OtpParameters createEmptyInstance() => create();
static $pb.PbList<MigrationPayload_OtpParameters> createRepeated() => $pb.PbList<MigrationPayload_OtpParameters>();
@$core.pragma('dart2js:noInline')
static MigrationPayload_OtpParameters getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<MigrationPayload_OtpParameters>(create);
static MigrationPayload_OtpParameters? _defaultInstance;
@$pb.TagNumber(1)
$core.List<$core.int> get secret => $_getN(0);
@$pb.TagNumber(1)
set secret($core.List<$core.int> v) { $_setBytes(0, v); }
@$pb.TagNumber(1)
$core.bool hasSecret() => $_has(0);
@$pb.TagNumber(1)
void clearSecret() => clearField(1);
@$pb.TagNumber(2)
$core.String get name => $_getSZ(1);
@$pb.TagNumber(2)
set name($core.String v) { $_setString(1, v); }
@$pb.TagNumber(2)
$core.bool hasName() => $_has(1);
@$pb.TagNumber(2)
void clearName() => clearField(2);
@$pb.TagNumber(3)
$core.String get issuer => $_getSZ(2);
@$pb.TagNumber(3)
set issuer($core.String v) { $_setString(2, v); }
@$pb.TagNumber(3)
$core.bool hasIssuer() => $_has(2);
@$pb.TagNumber(3)
void clearIssuer() => clearField(3);
@$pb.TagNumber(4)
MigrationPayload_Algorithm get algorithm => $_getN(3);
@$pb.TagNumber(4)
set algorithm(MigrationPayload_Algorithm v) { setField(4, v); }
@$pb.TagNumber(4)
$core.bool hasAlgorithm() => $_has(3);
@$pb.TagNumber(4)
void clearAlgorithm() => clearField(4);
@$pb.TagNumber(5)
MigrationPayload_DigitCount get digits => $_getN(4);
@$pb.TagNumber(5)
set digits(MigrationPayload_DigitCount v) { setField(5, v); }
@$pb.TagNumber(5)
$core.bool hasDigits() => $_has(4);
@$pb.TagNumber(5)
void clearDigits() => clearField(5);
@$pb.TagNumber(6)
MigrationPayload_OtpType get type => $_getN(5);
@$pb.TagNumber(6)
set type(MigrationPayload_OtpType v) { setField(6, v); }
@$pb.TagNumber(6)
$core.bool hasType() => $_has(5);
@$pb.TagNumber(6)
void clearType() => clearField(6);
@$pb.TagNumber(7)
$fixnum.Int64 get counter => $_getI64(6);
@$pb.TagNumber(7)
set counter($fixnum.Int64 v) { $_setInt64(6, v); }
@$pb.TagNumber(7)
$core.bool hasCounter() => $_has(6);
@$pb.TagNumber(7)
void clearCounter() => clearField(7);
}
class MigrationPayload extends $pb.GeneratedMessage {
factory MigrationPayload() => create();
MigrationPayload._() : super();
factory MigrationPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory MigrationPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
static final $pb.BuilderInfo _i = $pb.BuilderInfo(_omitMessageNames ? '' : 'MigrationPayload', package: const $pb.PackageName(_omitMessageNames ? '' : 'googleauth'), createEmptyInstance: create)
..pc<MigrationPayload_OtpParameters>(1, _omitFieldNames ? '' : 'otpParameters', $pb.PbFieldType.PM, subBuilder: MigrationPayload_OtpParameters.create)
..a<$core.int>(2, _omitFieldNames ? '' : 'version', $pb.PbFieldType.O3)
..a<$core.int>(3, _omitFieldNames ? '' : 'batchSize', $pb.PbFieldType.O3)
..a<$core.int>(4, _omitFieldNames ? '' : 'batchIndex', $pb.PbFieldType.O3)
..a<$core.int>(5, _omitFieldNames ? '' : 'batchId', $pb.PbFieldType.O3)
..hasRequiredFields = false
;
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
MigrationPayload clone() => MigrationPayload()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
MigrationPayload copyWith(void Function(MigrationPayload) updates) => super.copyWith((message) => updates(message as MigrationPayload)) as MigrationPayload;
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static MigrationPayload create() => MigrationPayload._();
MigrationPayload createEmptyInstance() => create();
static $pb.PbList<MigrationPayload> createRepeated() => $pb.PbList<MigrationPayload>();
@$core.pragma('dart2js:noInline')
static MigrationPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<MigrationPayload>(create);
static MigrationPayload? _defaultInstance;
@$pb.TagNumber(1)
$core.List<MigrationPayload_OtpParameters> get otpParameters => $_getList(0);
@$pb.TagNumber(2)
$core.int get version => $_getIZ(1);
@$pb.TagNumber(2)
set version($core.int v) { $_setSignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasVersion() => $_has(1);
@$pb.TagNumber(2)
void clearVersion() => clearField(2);
@$pb.TagNumber(3)
$core.int get batchSize => $_getIZ(2);
@$pb.TagNumber(3)
set batchSize($core.int v) { $_setSignedInt32(2, v); }
@$pb.TagNumber(3)
$core.bool hasBatchSize() => $_has(2);
@$pb.TagNumber(3)
void clearBatchSize() => clearField(3);
@$pb.TagNumber(4)
$core.int get batchIndex => $_getIZ(3);
@$pb.TagNumber(4)
set batchIndex($core.int v) { $_setSignedInt32(3, v); }
@$pb.TagNumber(4)
$core.bool hasBatchIndex() => $_has(3);
@$pb.TagNumber(4)
void clearBatchIndex() => clearField(4);
@$pb.TagNumber(5)
$core.int get batchId => $_getIZ(4);
@$pb.TagNumber(5)
set batchId($core.int v) { $_setSignedInt32(4, v); }
@$pb.TagNumber(5)
$core.bool hasBatchId() => $_has(4);
@$pb.TagNumber(5)
void clearBatchId() => clearField(5);
}
const _omitFieldNames = $core.bool.fromEnvironment('protobuf.omit_field_names');
const _omitMessageNames = $core.bool.fromEnvironment('protobuf.omit_message_names');

View File

@@ -0,0 +1,72 @@
//
// Generated code. Do not modify.
// source: googleauth.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
class MigrationPayload_Algorithm extends $pb.ProtobufEnum {
static const MigrationPayload_Algorithm ALGORITHM_UNSPECIFIED = MigrationPayload_Algorithm._(0, _omitEnumNames ? '' : 'ALGORITHM_UNSPECIFIED');
static const MigrationPayload_Algorithm ALGORITHM_SHA1 = MigrationPayload_Algorithm._(1, _omitEnumNames ? '' : 'ALGORITHM_SHA1');
static const MigrationPayload_Algorithm ALGORITHM_SHA256 = MigrationPayload_Algorithm._(2, _omitEnumNames ? '' : 'ALGORITHM_SHA256');
static const MigrationPayload_Algorithm ALGORITHM_SHA512 = MigrationPayload_Algorithm._(3, _omitEnumNames ? '' : 'ALGORITHM_SHA512');
static const MigrationPayload_Algorithm ALGORITHM_MD5 = MigrationPayload_Algorithm._(4, _omitEnumNames ? '' : 'ALGORITHM_MD5');
static const $core.List<MigrationPayload_Algorithm> values = <MigrationPayload_Algorithm> [
ALGORITHM_UNSPECIFIED,
ALGORITHM_SHA1,
ALGORITHM_SHA256,
ALGORITHM_SHA512,
ALGORITHM_MD5,
];
static final $core.Map<$core.int, MigrationPayload_Algorithm> _byValue = $pb.ProtobufEnum.initByValue(values);
static MigrationPayload_Algorithm? valueOf($core.int value) => _byValue[value];
const MigrationPayload_Algorithm._($core.int v, $core.String n) : super(v, n);
}
class MigrationPayload_DigitCount extends $pb.ProtobufEnum {
static const MigrationPayload_DigitCount DIGIT_COUNT_UNSPECIFIED = MigrationPayload_DigitCount._(0, _omitEnumNames ? '' : 'DIGIT_COUNT_UNSPECIFIED');
static const MigrationPayload_DigitCount DIGIT_COUNT_SIX = MigrationPayload_DigitCount._(1, _omitEnumNames ? '' : 'DIGIT_COUNT_SIX');
static const MigrationPayload_DigitCount DIGIT_COUNT_EIGHT = MigrationPayload_DigitCount._(2, _omitEnumNames ? '' : 'DIGIT_COUNT_EIGHT');
static const $core.List<MigrationPayload_DigitCount> values = <MigrationPayload_DigitCount> [
DIGIT_COUNT_UNSPECIFIED,
DIGIT_COUNT_SIX,
DIGIT_COUNT_EIGHT,
];
static final $core.Map<$core.int, MigrationPayload_DigitCount> _byValue = $pb.ProtobufEnum.initByValue(values);
static MigrationPayload_DigitCount? valueOf($core.int value) => _byValue[value];
const MigrationPayload_DigitCount._($core.int v, $core.String n) : super(v, n);
}
class MigrationPayload_OtpType extends $pb.ProtobufEnum {
static const MigrationPayload_OtpType OTP_TYPE_UNSPECIFIED = MigrationPayload_OtpType._(0, _omitEnumNames ? '' : 'OTP_TYPE_UNSPECIFIED');
static const MigrationPayload_OtpType OTP_TYPE_HOTP = MigrationPayload_OtpType._(1, _omitEnumNames ? '' : 'OTP_TYPE_HOTP');
static const MigrationPayload_OtpType OTP_TYPE_TOTP = MigrationPayload_OtpType._(2, _omitEnumNames ? '' : 'OTP_TYPE_TOTP');
static const $core.List<MigrationPayload_OtpType> values = <MigrationPayload_OtpType> [
OTP_TYPE_UNSPECIFIED,
OTP_TYPE_HOTP,
OTP_TYPE_TOTP,
];
static final $core.Map<$core.int, MigrationPayload_OtpType> _byValue = $pb.ProtobufEnum.initByValue(values);
static MigrationPayload_OtpType? valueOf($core.int value) => _byValue[value];
const MigrationPayload_OtpType._($core.int v, $core.String n) : super(v, n);
}
const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names');

View File

@@ -0,0 +1,93 @@
//
// Generated code. Do not modify.
// source: googleauth.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types
// ignore_for_file: constant_identifier_names, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
import 'dart:convert' as $convert;
import 'dart:core' as $core;
import 'dart:typed_data' as $typed_data;
@$core.Deprecated('Use migrationPayloadDescriptor instead')
const MigrationPayload$json = {
'1': 'MigrationPayload',
'2': [
{'1': 'otp_parameters', '3': 1, '4': 3, '5': 11, '6': '.googleauth.MigrationPayload.OtpParameters', '10': 'otpParameters'},
{'1': 'version', '3': 2, '4': 1, '5': 5, '10': 'version'},
{'1': 'batch_size', '3': 3, '4': 1, '5': 5, '10': 'batchSize'},
{'1': 'batch_index', '3': 4, '4': 1, '5': 5, '10': 'batchIndex'},
{'1': 'batch_id', '3': 5, '4': 1, '5': 5, '10': 'batchId'},
],
'3': [MigrationPayload_OtpParameters$json],
'4': [MigrationPayload_Algorithm$json, MigrationPayload_DigitCount$json, MigrationPayload_OtpType$json],
};
@$core.Deprecated('Use migrationPayloadDescriptor instead')
const MigrationPayload_OtpParameters$json = {
'1': 'OtpParameters',
'2': [
{'1': 'secret', '3': 1, '4': 1, '5': 12, '10': 'secret'},
{'1': 'name', '3': 2, '4': 1, '5': 9, '10': 'name'},
{'1': 'issuer', '3': 3, '4': 1, '5': 9, '10': 'issuer'},
{'1': 'algorithm', '3': 4, '4': 1, '5': 14, '6': '.googleauth.MigrationPayload.Algorithm', '10': 'algorithm'},
{'1': 'digits', '3': 5, '4': 1, '5': 14, '6': '.googleauth.MigrationPayload.DigitCount', '10': 'digits'},
{'1': 'type', '3': 6, '4': 1, '5': 14, '6': '.googleauth.MigrationPayload.OtpType', '10': 'type'},
{'1': 'counter', '3': 7, '4': 1, '5': 3, '10': 'counter'},
],
};
@$core.Deprecated('Use migrationPayloadDescriptor instead')
const MigrationPayload_Algorithm$json = {
'1': 'Algorithm',
'2': [
{'1': 'ALGORITHM_UNSPECIFIED', '2': 0},
{'1': 'ALGORITHM_SHA1', '2': 1},
{'1': 'ALGORITHM_SHA256', '2': 2},
{'1': 'ALGORITHM_SHA512', '2': 3},
{'1': 'ALGORITHM_MD5', '2': 4},
],
};
@$core.Deprecated('Use migrationPayloadDescriptor instead')
const MigrationPayload_DigitCount$json = {
'1': 'DigitCount',
'2': [
{'1': 'DIGIT_COUNT_UNSPECIFIED', '2': 0},
{'1': 'DIGIT_COUNT_SIX', '2': 1},
{'1': 'DIGIT_COUNT_EIGHT', '2': 2},
],
};
@$core.Deprecated('Use migrationPayloadDescriptor instead')
const MigrationPayload_OtpType$json = {
'1': 'OtpType',
'2': [
{'1': 'OTP_TYPE_UNSPECIFIED', '2': 0},
{'1': 'OTP_TYPE_HOTP', '2': 1},
{'1': 'OTP_TYPE_TOTP', '2': 2},
],
};
/// Descriptor for `MigrationPayload`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List migrationPayloadDescriptor = $convert.base64Decode(
'ChBNaWdyYXRpb25QYXlsb2FkElEKDm90cF9wYXJhbWV0ZXJzGAEgAygLMiouZ29vZ2xlYXV0aC'
'5NaWdyYXRpb25QYXlsb2FkLk90cFBhcmFtZXRlcnNSDW90cFBhcmFtZXRlcnMSGAoHdmVyc2lv'
'bhgCIAEoBVIHdmVyc2lvbhIdCgpiYXRjaF9zaXplGAMgASgFUgliYXRjaFNpemUSHwoLYmF0Y2'
'hfaW5kZXgYBCABKAVSCmJhdGNoSW5kZXgSGQoIYmF0Y2hfaWQYBSABKAVSB2JhdGNoSWQargIK'
'DU90cFBhcmFtZXRlcnMSFgoGc2VjcmV0GAEgASgMUgZzZWNyZXQSEgoEbmFtZRgCIAEoCVIEbm'
'FtZRIWCgZpc3N1ZXIYAyABKAlSBmlzc3VlchJECglhbGdvcml0aG0YBCABKA4yJi5nb29nbGVh'
'dXRoLk1pZ3JhdGlvblBheWxvYWQuQWxnb3JpdGhtUglhbGdvcml0aG0SPwoGZGlnaXRzGAUgAS'
'gOMicuZ29vZ2xlYXV0aC5NaWdyYXRpb25QYXlsb2FkLkRpZ2l0Q291bnRSBmRpZ2l0cxI4CgR0'
'eXBlGAYgASgOMiQuZ29vZ2xlYXV0aC5NaWdyYXRpb25QYXlsb2FkLk90cFR5cGVSBHR5cGUSGA'
'oHY291bnRlchgHIAEoA1IHY291bnRlciJ5CglBbGdvcml0aG0SGQoVQUxHT1JJVEhNX1VOU1BF'
'Q0lGSUVEEAASEgoOQUxHT1JJVEhNX1NIQTEQARIUChBBTEdPUklUSE1fU0hBMjU2EAISFAoQQU'
'xHT1JJVEhNX1NIQTUxMhADEhEKDUFMR09SSVRITV9NRDUQBCJVCgpEaWdpdENvdW50EhsKF0RJ'
'R0lUX0NPVU5UX1VOU1BFQ0lGSUVEEAASEwoPRElHSVRfQ09VTlRfU0lYEAESFQoRRElHSVRfQ0'
'9VTlRfRUlHSFQQAiJJCgdPdHBUeXBlEhgKFE9UUF9UWVBFX1VOU1BFQ0lGSUVEEAASEQoNT1RQ'
'X1RZUEVfSE9UUBABEhEKDU9UUF9UWVBFX1RPVFAQAg==');

View File

@@ -0,0 +1,14 @@
//
// Generated code. Do not modify.
// source: googleauth.proto
//
// @dart = 2.12
// ignore_for_file: annotate_overrides, camel_case_types
// ignore_for_file: constant_identifier_names
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
export 'googleauth.pb.dart';

View File

@@ -1,3 +1,4 @@
import 'dart:convert';
import 'dart:math';
import 'package:collection/collection.dart';
@@ -10,6 +11,7 @@ class UserDetails {
final int sharedCollectionsCount;
final Subscription subscription;
final FamilyData? familyData;
final ProfileData? profileData;
UserDetails(
this.email,
@@ -18,6 +20,7 @@ class UserDetails {
this.sharedCollectionsCount,
this.subscription,
this.familyData,
this.profileData,
);
bool isPartOfFamily() {
@@ -59,8 +62,10 @@ class UserDetails {
(map['sharedCollectionsCount'] ?? 0) as int,
Subscription.fromMap(map['subscription']),
FamilyData.fromMap(map['familyData']),
ProfileData.fromJson(map['profileData']),
);
}
}
class FamilyMember {
@@ -80,7 +85,39 @@ class FamilyMember {
);
}
}
class ProfileData {
bool canDisableEmailMFA;
bool isEmailMFAEnabled;
bool isTwoFactorEnabled;
// Constructor with default values
ProfileData({
this.canDisableEmailMFA = false,
this.isEmailMFAEnabled = false,
this.isTwoFactorEnabled = false,
});
// Factory method to create ProfileData instance from JSON
factory ProfileData.fromJson(Map<String, dynamic>? json) {
if (json == null) null;
return ProfileData(
canDisableEmailMFA: json!['canDisableEmailMFA'] ?? false,
isEmailMFAEnabled: json['isEmailMFAEnabled'] ?? false,
isTwoFactorEnabled: json['isTwoFactorEnabled'] ?? false,
);
}
// Method to convert ProfileData instance to JSON
Map<String, dynamic> toJson() {
return {
'canDisableEmailMFA': canDisableEmailMFA,
'isEmailMFAEnabled': isEmailMFAEnabled,
'isTwoFactorEnabled': isTwoFactorEnabled,
};
}
String toJsonString() => json.encode(toJson());
}
class FamilyData {
final List<FamilyMember>? members;

View File

@@ -7,17 +7,23 @@ import 'package:ente_auth/ente_theme_data.dart';
import 'package:ente_auth/events/trigger_logout_event.dart';
import "package:ente_auth/l10n/l10n.dart";
import 'package:ente_auth/locale.dart';
import 'package:ente_auth/theme/text_style.dart';
import 'package:ente_auth/ui/account/email_entry_page.dart';
import 'package:ente_auth/ui/account/login_page.dart';
import 'package:ente_auth/ui/account/logout_dialog.dart';
import 'package:ente_auth/ui/account/password_entry_page.dart';
import 'package:ente_auth/ui/account/password_reentry_page.dart';
import 'package:ente_auth/ui/common/gradient_button.dart';
import 'package:ente_auth/ui/components/buttons/button_widget.dart';
import 'package:ente_auth/ui/components/models/button_result.dart';
import 'package:ente_auth/ui/home_page.dart';
import 'package:ente_auth/ui/settings/language_picker.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:ente_auth/utils/navigation_util.dart';
import 'package:ente_auth/utils/toast_util.dart';
import 'package:flutter/foundation.dart';
import "package:flutter/material.dart";
import 'package:local_auth/local_auth.dart';
class OnboardingPage extends StatefulWidget {
const OnboardingPage({Key? key}) : super(key: key);
@@ -103,15 +109,18 @@ class _OnboardingPageState extends State<OnboardingPage> {
const SizedBox(height: 4),
Text(
"Authenticator",
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
const SizedBox(height: 32),
Text(
l10n.onBoardingBody,
textAlign: TextAlign.center,
style:
Theme.of(context).textTheme.headline6!.copyWith(
Theme.of(context).textTheme.titleLarge!.copyWith(
color: Colors.white38,
// color: Theme.of(context)
// .colorScheme
// .mutedTextColor,
),
),
],
@@ -128,7 +137,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
const SizedBox(height: 4),
Container(
width: double.infinity,
padding: const EdgeInsets.fromLTRB(20, 12, 20, 28),
padding: const EdgeInsets.fromLTRB(20, 12, 20, 0),
child: Hero(
tag: "log_in",
child: ElevatedButton(
@@ -145,6 +154,23 @@ class _OnboardingPageState extends State<OnboardingPage> {
),
),
),
const SizedBox(height: 4),
Container(
width: double.infinity,
padding: const EdgeInsets.only(top: 20, bottom: 20),
child: GestureDetector(
onTap: _optForOfflineMode,
child: Center(
child: Text(
l10n.useOffline,
style: body.copyWith(
color:
Theme.of(context).colorScheme.mutedTextColor,
),
),
),
),
),
],
),
),
@@ -155,6 +181,36 @@ class _OnboardingPageState extends State<OnboardingPage> {
);
}
Future<void> _optForOfflineMode() async {
bool canCheckBio = await LocalAuthentication().canCheckBiometrics;
if(!canCheckBio) {
showToast(context, "Sorry, biometric authentication is not supported on this device.");
return;
}
final bool hasOptedBefore = Configuration.instance.hasOptedForOfflineMode();
ButtonResult? result;
if(!hasOptedBefore) {
result = await showChoiceActionSheet(
context,
title: context.l10n.warning,
body: context.l10n.offlineModeWarning,
secondButtonLabel: context.l10n.cancel,
firstButtonLabel: context.l10n.ok,
);
}
if (hasOptedBefore || result?.action == ButtonAction.first) {
await Configuration.instance.optForOfflineMode();
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return const HomePage();
},
),
);
}
}
void _navigateToSignUpPage() {
Widget page;
if (Configuration.instance.getEncryptedToken() == null) {
@@ -163,7 +219,9 @@ class _OnboardingPageState extends State<OnboardingPage> {
// No key
if (Configuration.instance.getKeyAttributes() == null) {
// Never had a key
page = const PasswordEntryPage();
page = const PasswordEntryPage(
mode: PasswordEntryMode.set,
);
} else if (Configuration.instance.getKey() == null) {
// Yet to decrypt the key
page = const PasswordReentryPage();
@@ -189,7 +247,9 @@ class _OnboardingPageState extends State<OnboardingPage> {
// No key
if (Configuration.instance.getKeyAttributes() == null) {
// Never had a key
page = const PasswordEntryPage();
page = const PasswordEntryPage(
mode: PasswordEntryMode.set,
);
} else if (Configuration.instance.getKey() == null) {
// Yet to decrypt the key
page = const PasswordReentryPage();

View File

@@ -10,30 +10,27 @@ class SetupEnterSecretKeyPage extends StatefulWidget {
SetupEnterSecretKeyPage({this.code, Key? key}) : super(key: key);
@override
State<SetupEnterSecretKeyPage> createState() =>
_SetupEnterSecretKeyPageState();
State<SetupEnterSecretKeyPage> createState() => _SetupEnterSecretKeyPageState();
}
class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
late TextEditingController _issuerController;
late TextEditingController _accountController;
late TextEditingController _secretController;
late bool _secretKeyObscured;
@override
void initState() {
_issuerController = TextEditingController(
text: widget.code != null
? Uri.decodeFull(widget.code!.issuer).trim()
: null,
text: widget.code != null ? safeDecode(widget.code!.issuer).trim() : null,
);
_accountController = TextEditingController(
text: widget.code != null
? Uri.decodeFull(widget.code!.account).trim()
: null,
text: widget.code != null ? safeDecode(widget.code!.account).trim() : null,
);
_secretController = TextEditingController(
text: widget.code != null ? widget.code!.secret : null,
);
_secretKeyObscured = widget.code != null;
super.initState();
}
@@ -77,7 +74,18 @@ class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
},
decoration: InputDecoration(
hintText: l10n.codeSecretKeyHint,
suffixIcon: IconButton(
onPressed: () {
setState(() {
_secretKeyObscured = !_secretKeyObscured;
});
},
icon: _secretKeyObscured
? const Icon(Icons.visibility_off_rounded)
: const Icon(Icons.visibility_rounded),
),
),
obscureText: _secretKeyObscured,
controller: _secretController,
),
const SizedBox(
@@ -118,8 +126,7 @@ class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
try {
final account = _accountController.text.trim();
final issuer = _issuerController.text.trim();
final secret =
_secretController.text.trim().replaceAll(' ', '');
final secret = _secretController.text.trim().replaceAll(' ', '');
final Code newCode = widget.code == null
? Code.fromAccountAndSecret(
account,
@@ -132,7 +139,7 @@ class _SetupEnterSecretKeyPageState extends State<SetupEnterSecretKeyPage> {
secret: secret,
);
// Verify the validity of the code
getTotp(newCode);
getOTP(newCode);
Navigator.of(context).pop(newCode);
} catch (e) {
_showIncorrectDetailsDialog(context);

View File

@@ -0,0 +1,100 @@
import 'dart:math';
import "package:ente_auth/l10n/l10n.dart";
import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import "package:flutter/material.dart";
import 'package:qr_flutter/qr_flutter.dart';
class ViewQrPage extends StatelessWidget {
final Code? code;
ViewQrPage({this.code, Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
final double qrSize = min(screenWidth - 80, 300.0);
final enteTextTheme = getEnteTextTheme(context);
final l10n = context.l10n;
return Scaffold(
appBar: AppBar(
title: Text(l10n.qrCode),
),
body: SafeArea(
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 40.0, horizontal: 40),
child: Column(
children: [
QrImage(
data: code!.rawData,
foregroundColor: Theme.of(context).colorScheme.onBackground,
version: QrVersions.auto,
size: qrSize,
),
const SizedBox(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
l10n.account,
style: enteTextTheme.largeMuted,
),
const SizedBox(
width: 10,
),
Text(
code?.account ?? '',
style: enteTextTheme.largeBold,
),
],
),
const SizedBox(
height: 4,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
l10n.codeIssuerHint,
style: enteTextTheme.largeMuted,
),
const SizedBox(
width: 10,
),
Text(
code?.issuer ?? '',
style: enteTextTheme.largeBold,
),
],
),
const SizedBox(
height: 80,
),
SizedBox(
width: 400,
child: OutlinedButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 4,
),
child: Text(l10n.back),
),
),
)
],
),
),
),
),
);
}
}

View File

@@ -15,18 +15,29 @@ import 'package:ente_auth/models/authenticator/auth_key.dart';
import 'package:ente_auth/models/authenticator/entity_result.dart';
import 'package:ente_auth/models/authenticator/local_auth_entity.dart';
import 'package:ente_auth/store/authenticator_db.dart';
import 'package:ente_auth/store/offline_authenticator_db.dart';
import 'package:ente_auth/utils/crypto_util.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_sodium/flutter_sodium.dart';
import 'package:logging/logging.dart';
import 'package:shared_preferences/shared_preferences.dart';
enum AccountMode {
online,
offline,
}
extension on AccountMode {
bool get isOnline => this == AccountMode.online;
bool get isOffline => this == AccountMode.offline;
}
class AuthenticatorService {
final _logger = Logger((AuthenticatorService).toString());
final _config = Configuration.instance;
late SharedPreferences _prefs;
late AuthenticatorGateway _gateway;
late AuthenticatorDB _db;
late OfflineAuthenticatorDB _offlineDb;
final String _lastEntitySyncTime = "lastEntitySyncTime";
AuthenticatorService._privateConstructor();
@@ -34,25 +45,34 @@ class AuthenticatorService {
static final AuthenticatorService instance =
AuthenticatorService._privateConstructor();
AccountMode getAccountMode() {
return Configuration.instance.hasOptedForOfflineMode() &&
!Configuration.instance.hasConfiguredAccount()
? AccountMode.offline
: AccountMode.online;
}
Future<void> init() async {
_prefs = await SharedPreferences.getInstance();
_db = AuthenticatorDB.instance;
_offlineDb = OfflineAuthenticatorDB.instance;
_gateway = AuthenticatorGateway(Network.instance.getDio(), _config);
if (Configuration.instance.hasConfiguredAccount()) {
unawaited(sync());
unawaited(onlineSync());
}
Bus.instance.on<SignedInEvent>().listen((event) {
unawaited(sync());
unawaited(onlineSync());
});
}
Future<List<EntityResult>> getEntities() async {
final List<LocalAuthEntity> result = await _db.getAll();
Future<List<EntityResult>> getEntities(AccountMode mode) async {
final List<LocalAuthEntity> result =
mode.isOnline ? await _db.getAll() : await _offlineDb.getAll();
final List<EntityResult> entities = [];
if (result.isEmpty) {
return entities;
}
final key = await getOrCreateAuthDataKey();
final key = await getOrCreateAuthDataKey(mode);
for (LocalAuthEntity e in result) {
try {
final decryptedValue = await CryptoUtil.decryptChaCha(
@@ -75,17 +95,23 @@ class AuthenticatorService {
return entities;
}
Future<int> addEntry(String plainText, bool shouldSync) async {
var key = await getOrCreateAuthDataKey();
Future<int> addEntry(
String plainText,
bool shouldSync,
AccountMode accountMode,
) async {
var key = await getOrCreateAuthDataKey(accountMode);
final encryptedKeyData = await CryptoUtil.encryptChaCha(
utf8.encode(plainText) as Uint8List,
key,
);
String encryptedData = Sodium.bin2base64(encryptedKeyData.encryptedData!);
String header = Sodium.bin2base64(encryptedKeyData.header!);
final insertedID = await _db.insert(encryptedData, header);
final insertedID = accountMode.isOnline
? await _db.insert(encryptedData, header)
: await _offlineDb.insert(encryptedData, header);
if (shouldSync) {
unawaited(sync());
unawaited(onlineSync());
}
return insertedID;
}
@@ -94,45 +120,60 @@ class AuthenticatorService {
int generatedID,
String plainText,
bool shouldSync,
AccountMode accountMode,
) async {
var key = await getOrCreateAuthDataKey();
var key = await getOrCreateAuthDataKey(accountMode);
final encryptedKeyData = await CryptoUtil.encryptChaCha(
utf8.encode(plainText) as Uint8List,
key,
);
String encryptedData = Sodium.bin2base64(encryptedKeyData.encryptedData!);
String header = Sodium.bin2base64(encryptedKeyData.header!);
final int affectedRows =
await _db.updateEntry(generatedID, encryptedData, header);
final int affectedRows = accountMode.isOnline
? await _db.updateEntry(generatedID, encryptedData, header)
: await _offlineDb.updateEntry(generatedID, encryptedData, header);
assert(
affectedRows == 1,
"updateEntry should have updated exactly one row",
);
if (shouldSync) {
unawaited(sync());
unawaited(onlineSync());
}
}
Future<void> deleteEntry(int genID) async {
LocalAuthEntity? result = await _db.getEntryByID(genID);
Future<void> deleteEntry(int genID, AccountMode accountMode) async {
LocalAuthEntity? result = accountMode.isOnline
? await _db.getEntryByID(genID)
: await _offlineDb.getEntryByID(genID);
if (result == null) {
_logger.info("No entry found for given id");
return;
}
if (result.id != null) {
if (result.id != null && accountMode.isOnline) {
await _gateway.deleteEntity(result.id!);
} else {
debugPrint("Skipping delete since account mode is offline");
}
if(accountMode.isOnline) {
await _db.deleteByIDs(generatedIDs: [genID]);
} else {
await _offlineDb.deleteByIDs(generatedIDs: [genID]);
}
await _db.deleteByIDs(generatedIDs: [genID]);
}
Future<void> sync() async {
Future<bool> onlineSync() async {
try {
if(getAccountMode().isOffline) {
debugPrint("Skipping sync since account mode is offline");
return false;
}
_logger.info("Sync");
await _remoteToLocalSync();
_logger.info("remote fetch completed");
await _localToRemoteSync();
_logger.info("local push completed");
Bus.instance.fire(CodesUpdatedEvent());
return true;
} on UnauthorizedError {
if ((await _db.removeSyncedData()) > 0) {
Bus.instance.fire(CodesUpdatedEvent());
@@ -140,8 +181,10 @@ class AuthenticatorService {
debugPrint("Firing logout event");
Bus.instance.fire(TriggerLogoutEvent());
return false;
} catch (e) {
_logger.severe("Failed to sync with remote", e);
return false;
}
}
@@ -209,7 +252,10 @@ class AuthenticatorService {
}
}
Future<Uint8List> getOrCreateAuthDataKey() async {
Future<Uint8List> getOrCreateAuthDataKey(AccountMode mode) async {
if(mode.isOffline) {
return _config.getOfflineSecretKey()!;
}
if (_config.getAuthSecretKey() != null) {
return _config.getAuthSecretKey()!;
}
@@ -217,7 +263,7 @@ class AuthenticatorService {
final AuthKey response = await _gateway.getKey();
final authKey = CryptoUtil.decryptSync(
Sodium.base642bin(response.encryptedKey),
_config.getKey(),
_config.getKey()!,
Sodium.base642bin(response.header),
);
await _config.setAuthSecretKey(Sodium.bin2base64(authKey));

View File

@@ -1,3 +1,5 @@
import 'package:ente_auth/core/event_bus.dart';
import 'package:ente_auth/events/icons_changed_event.dart';
import 'package:shared_preferences/shared_preferences.dart';
class PreferenceService {
@@ -8,6 +10,8 @@ class PreferenceService {
late final SharedPreferences _prefs;
static const kHasShownCoachMarkKey = "has_shown_coach_mark";
static const kShouldShowLargeIconsKey = "should_show_large_icons";
static const kShouldAutoFocusOnSearchBar = "should_auto_focus_on_search_bar";
Future<void> init() async {
_prefs = await SharedPreferences.getInstance();
@@ -24,4 +28,30 @@ class PreferenceService {
Future<void> setHasShownCoachMark(bool value) {
return _prefs.setBool(kHasShownCoachMarkKey, value);
}
bool shouldShowLargeIcons() {
if (_prefs.containsKey(kShouldShowLargeIconsKey)) {
return _prefs.getBool(kShouldShowLargeIconsKey)!;
} else {
return false;
}
}
Future<void> setShowLargeIcons(bool value) async {
await _prefs.setBool(kShouldShowLargeIconsKey, value);
Bus.instance.fire(IconsChangedEvent());
}
bool shouldAutoFocusOnSearchBar() {
if (_prefs.containsKey(kShouldAutoFocusOnSearchBar)) {
return _prefs.getBool(kShouldAutoFocusOnSearchBar)!;
} else {
return false;
}
}
Future<void> setAutoFocusOnSearchBar(bool value) async {
await _prefs.setBool(kShouldAutoFocusOnSearchBar, value);
Bus.instance.fire(IconsChangedEvent());
}
}

View File

@@ -5,16 +5,18 @@ import 'dart:io';
import 'package:ente_auth/core/constants.dart';
import 'package:ente_auth/core/network.dart';
import 'package:ente_auth/services/notification_service.dart';
import 'package:flutter/foundation.dart';
import 'package:logging/logging.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:tuple/tuple.dart';
import 'package:url_launcher/url_launcher_string.dart';
class UpdateService {
UpdateService._privateConstructor();
static final UpdateService instance = UpdateService._privateConstructor();
static const kUpdateAvailableShownTimeKey = "update_available_shown_time_key";
static const String flavor = String.fromEnvironment('app.flavor');
LatestVersionInfo? _latestVersion;
final _logger = Logger("UpdateService");
@@ -87,11 +89,47 @@ class UpdateService {
return LatestVersionInfo.fromMap(response.data["latestVersion"]);
}
bool isIndependent() {
if (Platform.isIOS) {
return false;
// getRateDetails returns details about the place
Tuple2<String, String> getRateDetails() {
// Note: in auth, currently we don't have a way to identify if the
// app was installed from play store, f-droid or github based on pkg name
if (Platform.isAndroid) {
if(flavor == "playstore") {
return const Tuple2(
"Play Store",
"market://details??id=io.ente.auth",
);
}
return const Tuple2(
"AlternativeTo",
"https://alternativeto.net/software/ente-authenticator/about/",
);
}
return kDebugMode || _packageInfo.packageName.endsWith("independent");
return const Tuple2(
"App Store",
"https://apps.apple.com/in/app/ente-photos/id6444121398",
);
}
Future<void> launchReviewUrl() async {
final String url = getRateDetails().item2;
try {
await launchUrlString(url, mode: LaunchMode.externalApplication);
} catch (e) {
_logger.severe("Failed top open launch url $url", e);
// Fall back if we fail to open play-store market app on android
if (Platform.isAndroid && url.startsWith("market://")) {
launchUrlString(
"https://play.google.com/store/apps/details?id=io"
".ente.auth",
mode: LaunchMode.externalApplication,
).ignore();
}
}
}
bool isIndependent() {
return flavor == "independent" || _packageInfo.packageName.endsWith("independent");
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,13 @@
import 'dart:convert';
import 'package:collection/collection.dart';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/core/event_bus.dart';
import 'package:ente_auth/events/codes_updated_event.dart';
import 'package:ente_auth/models/authenticator/entity_result.dart';
import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/services/authenticator_service.dart';
import 'package:ente_auth/store/offline_authenticator_db.dart';
import 'package:logging/logging.dart';
class CodeStore {
@@ -19,9 +22,10 @@ class CodeStore {
_authenticatorService = AuthenticatorService.instance;
}
Future<List<Code>> getAllCodes() async {
Future<List<Code>> getAllCodes({AccountMode? accountMode}) async {
final mode = accountMode ?? _authenticatorService.getAccountMode();
final List<EntityResult> entities =
await _authenticatorService.getEntities();
await _authenticatorService.getEntities(mode);
final List<Code> codes = [];
for (final entity in entities) {
final decodeJson = jsonDecode(entity.rawData);
@@ -33,47 +37,129 @@ class CodeStore {
// sort codes by issuer,account
codes.sort((a, b) {
final issuerComparison = a.issuer.compareTo(b.issuer);
final issuerComparison = compareAsciiLowerCaseNatural(a.issuer, b.issuer);
if (issuerComparison != 0) {
return issuerComparison;
}
return a.account.compareTo(b.account);
return compareAsciiLowerCaseNatural(a.account, b.account);
});
return codes;
}
Future<void> addCode(
Future<AddResult> addCode(
Code code, {
bool shouldSync = true,
AccountMode? accountMode,
}) async {
final codes = await getAllCodes();
final mode = accountMode ?? _authenticatorService.getAccountMode();
final codes = await getAllCodes(accountMode: mode);
bool isExistingCode = false;
for (final existingCode in codes) {
if (existingCode == code) {
_logger.info("Found duplicate code, skipping add");
return;
return AddResult.duplicate;
} else if (existingCode.generatedID == code.generatedID) {
isExistingCode = true;
break;
}
}
late AddResult result;
if (isExistingCode) {
result = AddResult.updateCode;
await _authenticatorService.updateEntry(
code.generatedID!,
jsonEncode(code.rawData),
shouldSync,
mode,
);
} else {
result = AddResult.newCode;
code.generatedID = await _authenticatorService.addEntry(
jsonEncode(code.rawData),
shouldSync,
mode,
);
}
Bus.instance.fire(CodesUpdatedEvent());
return result;
}
Future<void> removeCode(Code code) async {
await _authenticatorService.deleteEntry(code.generatedID!);
Future<void> removeCode(Code code, {AccountMode? accountMode}) async {
final mode = accountMode ?? _authenticatorService.getAccountMode();
await _authenticatorService.deleteEntry(code.generatedID!, mode);
Bus.instance.fire(CodesUpdatedEvent());
}
bool _isOfflineImportRunning = false;
Future<void> importOfflineCodes() async {
if(_isOfflineImportRunning) {
return;
}
_isOfflineImportRunning = true;
Logger logger = Logger('importOfflineCodes');
try {
Configuration config = Configuration.instance;
if (!config.hasConfiguredAccount() ||
!config.hasOptedForOfflineMode() ||
config.getOfflineSecretKey() == null) {
return;
}
logger.info('start import');
List<Code> offlineCodes = await CodeStore.instance
.getAllCodes(accountMode: AccountMode.offline);
if (offlineCodes.isEmpty) {
return;
}
bool isOnlineSyncDone = await AuthenticatorService.instance.onlineSync();
if (!isOnlineSyncDone) {
logger.info("skip as online sync is not done");
return;
}
final List<Code> onlineCodes =
await CodeStore.instance.getAllCodes(accountMode: AccountMode.online);
logger.info(
'importing ${offlineCodes.length} offline codes with ${onlineCodes.length} online codes',
);
for (Code eachCode in offlineCodes) {
bool alreadyPresent = onlineCodes.any(
(oc) =>
oc.issuer == eachCode.issuer &&
oc.account == eachCode.account &&
oc.secret == eachCode.secret,
);
int? generatedID = eachCode.generatedID!;
logger.info(
'importingCode: genID ${eachCode.generatedID} & isAlreadyPresent $alreadyPresent',
);
if (!alreadyPresent) {
// Avoid conflict with generatedID of online codes
eachCode.generatedID = null;
final AddResult result = await CodeStore.instance.addCode(
eachCode,
accountMode: AccountMode.online,
shouldSync: false,
);
logger.info(
'importedCode: genID ${eachCode.generatedID} result: ${result.name}',
);
}
await OfflineAuthenticatorDB.instance.deleteByIDs(
generatedIDs: [generatedID],
);
}
AuthenticatorService.instance.onlineSync().ignore();
} catch (e, s) {
_logger.severe("error while importing offline codes", e, s);
} finally {
_isOfflineImportRunning = false;
}
}
}
enum AddResult {
newCode,
duplicate,
updateCode,
}

View File

@@ -0,0 +1,170 @@
import 'dart:async';
import 'dart:io';
import 'package:ente_auth/models/authenticator/auth_entity.dart';
import 'package:ente_auth/models/authenticator/local_auth_entity.dart';
import 'package:flutter/foundation.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
import 'package:sqflite/sqflite.dart';
class OfflineAuthenticatorDB {
static const _databaseName = "ente.offline_authenticator.db";
static const _databaseVersion = 1;
static const entityTable = 'entities';
OfflineAuthenticatorDB._privateConstructor();
static final OfflineAuthenticatorDB instance = OfflineAuthenticatorDB._privateConstructor();
static Future<Database>? _dbFuture;
Future<Database> get database async {
_dbFuture ??= _initDatabase();
return _dbFuture!;
}
Future<Database> _initDatabase() async {
final Directory documentsDirectory =
await getApplicationDocumentsDirectory();
final String path = join(documentsDirectory.path, _databaseName);
debugPrint(path);
return await openDatabase(
path,
version: _databaseVersion,
onCreate: _onCreate,
);
}
Future _onCreate(Database db, int version) async {
await db.execute(
'''
CREATE TABLE $entityTable (
_generatedID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
id TEXT,
encryptedData TEXT NOT NULL,
header TEXT NOT NULL,
createdAt INTEGER NOT NULL,
updatedAt INTEGER NOT NULL,
shouldSync INTEGER DEFAULT 0,
UNIQUE(id)
);
''',
);
}
Future<int> insert(String encData, String header) async {
final db = await instance.database;
final int timeInMicroSeconds = DateTime.now().microsecondsSinceEpoch;
final insertedID = await db.insert(
entityTable,
{
"encryptedData": encData,
"header": header,
"shouldSync": 1,
"createdAt": timeInMicroSeconds,
"updatedAt": timeInMicroSeconds,
},
);
return insertedID;
}
Future<int> updateEntry(
int generatedID,
String encData,
String header,
) async {
final db = await instance.database;
final int timeInMicroSeconds = DateTime.now().microsecondsSinceEpoch;
int affectedRows = await db.update(
entityTable,
{
"encryptedData": encData,
"header": header,
"shouldSync": 1,
"updatedAt": timeInMicroSeconds,
},
where: '_generatedID = ?',
whereArgs: [generatedID],
);
return affectedRows;
}
Future<void> insertOrReplace(List<AuthEntity> authEntities) async {
final db = await instance.database;
final batch = db.batch();
for (AuthEntity authEntity in authEntities) {
final insertRow = authEntity.toMap();
insertRow.remove('isDeleted');
insertRow.putIfAbsent('shouldSync', () => 0);
batch.insert(
entityTable,
insertRow,
conflictAlgorithm: ConflictAlgorithm.replace,
);
}
await batch.commit(noResult: true);
}
Future<void> updateLocalEntity(LocalAuthEntity localAuthEntity) async {
final db = await instance.database;
await db.update(
entityTable,
localAuthEntity.toMap(),
where: '_generatedID = ?',
whereArgs: [localAuthEntity.generatedID],
conflictAlgorithm: ConflictAlgorithm.replace,
);
}
Future<LocalAuthEntity?> getEntryByID(int genID) async {
final db = await instance.database;
final rows = await db
.query(entityTable, where: '_generatedID = ?', whereArgs: [genID]);
final listOfAuthEntities = _convertRows(rows);
if (listOfAuthEntities.isEmpty) {
return null;
} else {
return listOfAuthEntities.first;
}
}
Future<List<LocalAuthEntity>> getAll() async {
final db = await instance.database;
final rows = await db.rawQuery("SELECT * from $entityTable");
return _convertRows(rows);
}
// deleteByID will prefer generated id if both ids are passed during deletion
Future<void> deleteByIDs({List<int>? generatedIDs, List<String>? ids}) async {
final db = await instance.database;
final batch = db.batch();
const whereGenID = '_generatedID = ?';
const whereID = 'id = ?';
if (generatedIDs != null) {
for (int genId in generatedIDs) {
batch.delete(entityTable, where: whereGenID, whereArgs: [genId]);
}
}
if (ids != null) {
for (String id in ids) {
batch.delete(entityTable, where: whereID, whereArgs: [id]);
}
}
final result = await batch.commit();
debugPrint("Done");
}
Future<void> clearTable() async {
final db = await instance.database;
await db.delete(entityTable);
}
List<LocalAuthEntity> _convertRows(List<Map<String, dynamic>> rows) {
final keys = <LocalAuthEntity>[];
for (final row in rows) {
keys.add(LocalAuthEntity.fromMap(row));
}
return keys;
}
}

View File

@@ -5,6 +5,18 @@ const FontWeight _regularWeight = FontWeight.w500;
const FontWeight _boldWeight = FontWeight.w600;
const String _fontFamily = 'Inter';
const TextStyle brandStyleSmall = TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Montserrat',
fontSize: 21,
);
const TextStyle brandStyleMedium = TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Montserrat',
fontSize: 24,
);
const TextStyle h1 = TextStyle(
fontSize: 48,
height: 48 / 28,
@@ -31,7 +43,7 @@ const TextStyle large = TextStyle(
);
const TextStyle body = TextStyle(
fontSize: 16,
height: 19.4 / 16.0,
height: 20 / 16.0,
fontWeight: _regularWeight,
fontFamily: _fontFamily,
);
@@ -71,6 +83,29 @@ class EnteTextTheme {
final TextStyle miniBold;
final TextStyle tiny;
final TextStyle tinyBold;
final TextStyle brandSmall;
final TextStyle brandMedium;
// textMuted variants
final TextStyle h1Muted;
final TextStyle h2Muted;
final TextStyle h3Muted;
final TextStyle largeMuted;
final TextStyle bodyMuted;
final TextStyle smallMuted;
final TextStyle miniMuted;
final TextStyle miniBoldMuted;
final TextStyle tinyMuted;
// textFaint variants
final TextStyle h1Faint;
final TextStyle h2Faint;
final TextStyle h3Faint;
final TextStyle largeFaint;
final TextStyle bodyFaint;
final TextStyle smallFaint;
final TextStyle miniFaint;
final TextStyle tinyFaint;
const EnteTextTheme({
required this.h1,
@@ -89,13 +124,45 @@ class EnteTextTheme {
required this.miniBold,
required this.tiny,
required this.tinyBold,
required this.brandSmall,
required this.brandMedium,
required this.h1Muted,
required this.h2Muted,
required this.h3Muted,
required this.largeMuted,
required this.bodyMuted,
required this.smallMuted,
required this.miniMuted,
required this.miniBoldMuted,
required this.tinyMuted,
required this.h1Faint,
required this.h2Faint,
required this.h3Faint,
required this.largeFaint,
required this.bodyFaint,
required this.smallFaint,
required this.miniFaint,
required this.tinyFaint,
});
}
EnteTextTheme lightTextTheme = _buildEnteTextStyle(textBaseLight);
EnteTextTheme darkTextTheme = _buildEnteTextStyle(textBaseDark);
EnteTextTheme lightTextTheme = _buildEnteTextStyle(
textBaseLight,
textMutedLight,
textFaintLight,
);
EnteTextTheme _buildEnteTextStyle(Color color) {
EnteTextTheme darkTextTheme = _buildEnteTextStyle(
textBaseDark,
textMutedDark,
textFaintDark,
);
EnteTextTheme _buildEnteTextStyle(
Color color,
Color textMuted,
Color textFaint,
) {
return EnteTextTheme(
h1: h1.copyWith(color: color),
h1Bold: h1.copyWith(color: color, fontWeight: _boldWeight),
@@ -113,5 +180,24 @@ EnteTextTheme _buildEnteTextStyle(Color color) {
miniBold: mini.copyWith(color: color, fontWeight: _boldWeight),
tiny: tiny.copyWith(color: color),
tinyBold: tiny.copyWith(color: color, fontWeight: _boldWeight),
brandSmall: brandStyleSmall.copyWith(color: color),
brandMedium: brandStyleMedium.copyWith(color: color),
h1Muted: h1.copyWith(color: textMuted),
h2Muted: h2.copyWith(color: textMuted),
h3Muted: h3.copyWith(color: textMuted),
largeMuted: large.copyWith(color: textMuted),
bodyMuted: body.copyWith(color: textMuted),
smallMuted: small.copyWith(color: textMuted),
miniMuted: mini.copyWith(color: textMuted),
miniBoldMuted: mini.copyWith(color: textMuted, fontWeight: _boldWeight),
tinyMuted: tiny.copyWith(color: textMuted),
h1Faint: h1.copyWith(color: textFaint),
h2Faint: h2.copyWith(color: textFaint),
h3Faint: h3.copyWith(color: textFaint),
largeFaint: large.copyWith(color: textFaint),
bodyFaint: body.copyWith(color: textFaint),
smallFaint: small.copyWith(color: textFaint),
miniFaint: mini.copyWith(color: textFaint),
tinyFaint: tiny.copyWith(color: textFaint),
);
}

View File

@@ -48,7 +48,7 @@ class DeleteAccountPage extends StatelessWidget {
Center(
child: Text(
l10n.deleteAccountQuery,
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
),
const SizedBox(
@@ -67,7 +67,7 @@ class DeleteAccountPage extends StatelessWidget {
text: ", maybe there is a way we can help.",
),
],
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
),
const SizedBox(

View File

@@ -135,13 +135,13 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
child: Text(
context.l10n.createNewAccount,
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
),
Padding(
padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
child: TextFormField(
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
autofillHints: const [AutofillHints.email],
decoration: InputDecoration(
fillColor: _emailIsValid ? _validFieldValueColor : null,
@@ -372,11 +372,10 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
child: StyledText(
text: context.l10n.signUpTerms,
style:
Theme.of(context).textTheme.subtitle1!.copyWith(fontSize: 12),
Theme.of(context).textTheme.titleMedium!.copyWith(fontSize: 12),
tags: {
'u-terms': StyledTextActionTag(
(String? text, Map<String?, String?> attrs) => {
Navigator.of(context).push(
(String? text, Map<String?, String?> attrs) => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return WebPage(
@@ -385,15 +384,13 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
);
},
),
)
},
),
style: const TextStyle(
decoration: TextDecoration.underline,
),
),
'u-policy': StyledTextActionTag(
(String? text, Map<String?, String?> attrs) => {
Navigator.of(context).push(
(String? text, Map<String?, String?> attrs) => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return WebPage(
@@ -402,8 +399,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
);
},
),
)
},
),
style: const TextStyle(
decoration: TextDecoration.underline,
),
@@ -439,11 +435,10 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
child: StyledText(
text: context.l10n.ackPasswordLostWarning,
style:
Theme.of(context).textTheme.subtitle1!.copyWith(fontSize: 12),
Theme.of(context).textTheme.titleMedium!.copyWith(fontSize: 12),
tags: {
'underline': StyledTextActionTag(
(String? text, Map<String?, String?> attrs) => {
Navigator.of(context).push(
(String? text, Map<String?, String?> attrs) => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return WebPage(
@@ -452,8 +447,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
);
},
),
)
},
),
style: const TextStyle(
decoration: TextDecoration.underline,
),

View File

@@ -1,10 +1,14 @@
import 'package:email_validator/email_validator.dart';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/core/errors.dart';
import "package:ente_auth/l10n/l10n.dart";
import 'package:ente_auth/models/api/user/srp.dart';
import 'package:ente_auth/services/user_service.dart';
import 'package:ente_auth/ui/account/login_pwd_verification_page.dart';
import 'package:ente_auth/ui/common/dynamic_fab.dart';
import 'package:ente_auth/ui/common/web_page.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import "package:styled_text/styled_text.dart";
class LoginPage extends StatefulWidget {
@@ -19,6 +23,7 @@ class _LoginPageState extends State<LoginPage> {
bool _emailIsValid = false;
String? _email;
Color? _emailInputFieldColor;
final Logger _logger = Logger('_LoginPageState');
@override
void initState() {
@@ -55,10 +60,32 @@ class _LoginPageState extends State<LoginPage> {
isKeypadOpen: isKeypadOpen,
isFormValid: _emailIsValid,
buttonText: context.l10n.logInLabel,
onPressedFunction: () {
onPressedFunction: () async {
UserService.instance.setEmail(_email!);
UserService.instance
.sendOtt(context, _email!, isCreateAccountScreen: false);
SrpAttributes? attr;
bool isEmailVerificationEnabled = true;
try {
attr = await UserService.instance.getSrpAttributes(_email!);
isEmailVerificationEnabled = attr.isEmailMFAEnabled;
} catch (e) {
if (e is! SrpSetupNotCompleteError) {
_logger.severe('Error getting SRP attributes', e);
}
}
if (attr != null && !isEmailVerificationEnabled) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return LoginPasswordVerificationPage(
srpAttributes: attr!,
);
},
),
);
} else {
await UserService.instance
.sendOtt(context, _email!, isCreateAccountScreen: false);
}
FocusScope.of(context).unfocus();
},
),
@@ -80,7 +107,7 @@ class _LoginPageState extends State<LoginPage> {
const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
child: Text(
l10n.welcomeBack,
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
),
Padding(
@@ -145,12 +172,11 @@ class _LoginPageState extends State<LoginPage> {
text: context.l10n.loginTerms,
style: Theme.of(context)
.textTheme
.subtitle1!
.titleMedium!
.copyWith(fontSize: 12),
tags: {
'u-terms': StyledTextActionTag(
(String? text, Map<String?, String?> attrs) => {
Navigator.of(context).push(
(String? text, Map<String?, String?> attrs) => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return WebPage(
@@ -159,15 +185,13 @@ class _LoginPageState extends State<LoginPage> {
);
},
),
)
},
),
style: const TextStyle(
decoration: TextDecoration.underline,
),
),
'u-policy': StyledTextActionTag(
(String? text, Map<String?, String?> attrs) => {
Navigator.of(context).push(
(String? text, Map<String?, String?> attrs) => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return WebPage(
@@ -176,8 +200,7 @@ class _LoginPageState extends State<LoginPage> {
);
},
),
)
},
),
style: const TextStyle(
decoration: TextDecoration.underline,
),

View File

@@ -0,0 +1,232 @@
import 'package:ente_auth/core/configuration.dart';
import "package:ente_auth/l10n/l10n.dart";
import "package:ente_auth/models/api/user/srp.dart";
import "package:ente_auth/services/user_service.dart";
import "package:ente_auth/theme/ente_theme.dart";
import 'package:ente_auth/ui/common/dynamic_fab.dart';
import "package:ente_auth/utils/dialog_util.dart";
import 'package:flutter/material.dart';
import "package:logging/logging.dart";
// LoginPasswordVerificationPage is a page that allows the user to enter their password to verify their identity.
// If the password is correct, then the user is either directed to
// PasswordReentryPage (if the user has not yet set up 2FA) or TwoFactorAuthenticationPage (if the user has set up 2FA).
// In the PasswordReentryPage, the password is auto-filled based on the
// volatile password.
class LoginPasswordVerificationPage extends StatefulWidget {
final SrpAttributes srpAttributes;
const LoginPasswordVerificationPage({Key? key, required this.srpAttributes}) : super(key: key);
@override
State<LoginPasswordVerificationPage> createState() => _LoginPasswordVerificationPageState();
}
class _LoginPasswordVerificationPageState extends
State<LoginPasswordVerificationPage> {
final _logger = Logger((_LoginPasswordVerificationPageState).toString());
final _passwordController = TextEditingController();
final FocusNode _passwordFocusNode = FocusNode();
String? email;
bool _passwordInFocus = false;
bool _passwordVisible = false;
@override
void initState() {
super.initState();
email = Configuration.instance.getEmail();
_passwordFocusNode.addListener(() {
setState(() {
_passwordInFocus = _passwordFocusNode.hasFocus;
});
});
}
@override
Widget build(BuildContext context) {
final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;
FloatingActionButtonLocation? fabLocation() {
if (isKeypadOpen) {
return null;
} else {
return FloatingActionButtonLocation.centerFloat;
}
}
return Scaffold(
resizeToAvoidBottomInset: isKeypadOpen,
appBar: AppBar(
elevation: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back),
color: Theme.of(context).iconTheme.color,
onPressed: () {
Navigator.of(context).pop();
},
),
),
body: _getBody(),
floatingActionButton: DynamicFAB(
key: const ValueKey("verifyPasswordButton"),
isKeypadOpen: isKeypadOpen,
isFormValid: _passwordController.text.isNotEmpty,
buttonText: context.l10n.logInLabel,
onPressedFunction: () async {
FocusScope.of(context).unfocus();
await UserService.instance.verifyEmailViaPassword(context, widget
.srpAttributes,
_passwordController.text,);
},
),
floatingActionButtonLocation: fabLocation(),
floatingActionButtonAnimator: NoScalingAnimation(),
);
}
Widget _getBody() {
return Column(
children: [
Expanded(
child: AutofillGroup(
child: ListView(
children: [
Padding(
padding:
const EdgeInsets.only(top: 30, left: 20, right: 20),
child: Text(
context.l10n.enterPassword,
style: Theme.of(context).textTheme.headlineMedium,
),
),
Padding(
padding: const EdgeInsets.only(bottom: 30, left: 22, right:
20,),
child: Text(email ?? '', style: getEnteTextTheme(context).smallMuted,),
),
Visibility(
// hidden textForm for suggesting auto-fill service for saving
// password
visible: false,
child: TextFormField(
autofillHints: const [
AutofillHints.email,
],
autocorrect: false,
keyboardType: TextInputType.emailAddress,
initialValue: email,
textInputAction: TextInputAction.next,
),
),
Padding(
padding: const EdgeInsets.fromLTRB(20, 24, 20, 0),
child: TextFormField(
key: const ValueKey("passwordInputField"),
autofillHints: const [AutofillHints.password],
decoration: InputDecoration(
hintText: context.l10n.enterYourPasswordHint,
filled: true,
contentPadding: const EdgeInsets.all(20),
border: UnderlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(6),
),
suffixIcon: _passwordInFocus
? IconButton(
icon: Icon(
_passwordVisible
? Icons.visibility
: Icons.visibility_off,
color: Theme.of(context).iconTheme.color,
size: 20,
),
onPressed: () {
setState(() {
_passwordVisible = !_passwordVisible;
});
},
)
: null,
),
style: const TextStyle(
fontSize: 14,
),
controller: _passwordController,
autofocus: true,
autocorrect: false,
obscureText: !_passwordVisible,
keyboardType: TextInputType.visiblePassword,
focusNode: _passwordFocusNode,
onChanged: (_) {
setState(() {});
},
),
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 18),
child: Divider(
thickness: 1,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () async {
await UserService.instance
.sendOtt(context, email!,
isResetPasswordScreen: true,);
},
child: Center(
child: Text(
context.l10n.forgotPassword,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontSize: 14,
decoration: TextDecoration.underline,
),
),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () async {
final dialog = createProgressDialog(
context,
context.l10n.pleaseWait,
);
await dialog.show();
await Configuration.instance.logout();
await dialog.hide();
Navigator.of(context)
.popUntil((route) => route.isFirst);
},
child: Center(
child: Text(
context.l10n.changeEmail,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontSize: 14,
decoration: TextDecoration.underline,
),
),
),
),
],
),
)
],
),
),
),
],
);
}
}

View File

@@ -42,6 +42,7 @@ Future<void> autoLogoutAlert(BuildContext context) async {
);
await showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return alert;
},

View File

@@ -10,11 +10,13 @@ class OTTVerificationPage extends StatefulWidget {
final String email;
final bool isChangeEmail;
final bool isCreateAccountScreen;
final bool isResetPasswordScreen;
const OTTVerificationPage(
this.email, {
this.isChangeEmail = false,
this.isCreateAccountScreen = false,
this.isResetPasswordScreen = false,
Key? key,
}) : super(key: key);
@@ -66,8 +68,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
body: _getBody(),
floatingActionButton: DynamicFAB(
isKeypadOpen: isKeypadOpen,
isFormValid: !(_verificationCodeController.text == null ||
_verificationCodeController.text.isEmpty),
isFormValid: !(_verificationCodeController.text.isEmpty),
buttonText: l10n.verify,
onPressedFunction: () {
if (widget.isChangeEmail) {
@@ -78,7 +79,8 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
);
} else {
UserService.instance
.verifyEmail(context, _verificationCodeController.text);
.verifyEmail(context, _verificationCodeController.text,
isResettingPasswordScreen: widget.isResetPasswordScreen,);
}
FocusScope.of(context).unfocus();
},
@@ -99,7 +101,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
padding: const EdgeInsets.fromLTRB(20, 30, 20, 15),
child: Text(
l10n.verifyEmail,
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
),
Padding(
@@ -116,7 +118,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
text: l10n.weHaveSendEmailTo(widget.email),
style: Theme.of(context)
.textTheme
.subtitle1!
.titleMedium!
.copyWith(fontSize: 14),
tags: {
'green': StyledTextTag(
@@ -129,13 +131,21 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
},
),
),
Text(
l10n.checkInboxAndSpamFolder,
style: Theme.of(context)
.textTheme
.subtitle1!
.copyWith(fontSize: 14),
),
widget.isResetPasswordScreen
? Text(
l10n.toResetVerifyEmail,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(fontSize: 14),
)
: Text(
l10n.checkInboxAndSpamFolder,
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(fontSize: 14),
),
],
),
),
@@ -149,7 +159,7 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
Padding(
padding: const EdgeInsets.fromLTRB(20, 16, 20, 16),
child: TextFormField(
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
decoration: InputDecoration(
filled: true,
hintText: l10n.tapToEnterCode,
@@ -182,11 +192,13 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {
context,
widget.email,
isCreateAccountScreen: widget.isCreateAccountScreen,
isChangeEmail: widget.isChangeEmail,
isResetPasswordScreen: widget.isResetPasswordScreen,
);
},
child: Text(
l10n.resendEmail,
style: Theme.of(context).textTheme.subtitle1!.copyWith(
style: Theme.of(context).textTheme.titleMedium!.copyWith(
fontSize: 14,
decoration: TextDecoration.underline,
),

View File

@@ -1,5 +1,6 @@
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/key_gen_result.dart';
import 'package:ente_auth/services/user_service.dart';
import 'package:ente_auth/ui/account/recovery_key_page.dart';
import 'package:ente_auth/ui/common/dynamic_fab.dart';
@@ -23,7 +24,7 @@ enum PasswordEntryMode {
class PasswordEntryPage extends StatefulWidget {
final PasswordEntryMode mode;
const PasswordEntryPage({this.mode = PasswordEntryMode.set, Key? key})
const PasswordEntryPage({required this.mode, Key? key})
: super(key: key);
@override
@@ -152,7 +153,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
child: Text(
buttonTextAndHeading,
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
),
Padding(
@@ -164,7 +165,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
textAlign: TextAlign.start,
style: Theme.of(context)
.textTheme
.subtitle1!
.titleMedium!
.copyWith(fontSize: 14),
),
),
@@ -175,11 +176,11 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
text: context.l10n.passwordWarning,
style: Theme.of(context)
.textTheme
.subtitle1!
.titleMedium!
.copyWith(fontSize: 14),
tags: {
'underline': StyledTextTag(
style: Theme.of(context).textTheme.subtitle1!.copyWith(
style: Theme.of(context).textTheme.titleMedium!.copyWith(
fontSize: 14,
decoration: TextDecoration.underline,
),
@@ -355,7 +356,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
child: RichText(
text: TextSpan(
text: context.l10n.howItWorks,
style: Theme.of(context).textTheme.subtitle1!.copyWith(
style: Theme.of(context).textTheme.titleMedium!.copyWith(
fontSize: 14,
decoration: TextDecoration.underline,
),
@@ -377,9 +378,9 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
createProgressDialog(context, context.l10n.generatingEncryptionKeys);
await dialog.show();
try {
final keyAttributes = await Configuration.instance
.updatePassword(_passwordController1.text);
await UserService.instance.updateKeyAttributes(keyAttributes);
final result = await Configuration.instance
.getAttributesForNewPassword(_passwordController1.text);
await UserService.instance.updateKeyAttributes(result.item1, result.item2);
await dialog.hide();
showShortToast(context, context.l10n.passwordChangedSuccessfully);
Navigator.of(context).pop();
@@ -399,7 +400,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
createProgressDialog(context, l10n.generatingEncryptionKeysTitle);
await dialog.show();
try {
final result = await Configuration.instance.generateKey(password);
final KeyGenResult result = await Configuration.instance.generateKey(password);
Configuration.instance.setVolatilePassword(null);
await dialog.hide();
onDone() async {
@@ -408,6 +409,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
try {
await UserService.instance.setAttributes(result);
await dialog.hide();
Configuration.instance.setVolatilePassword(null);
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {

View File

@@ -1,12 +1,15 @@
import 'dart:async';
import 'dart:typed_data';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/core/errors.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/services/user_service.dart';
import 'package:ente_auth/ui/account/recovery_page.dart';
import 'package:ente_auth/ui/common/dynamic_fab.dart';
import 'package:ente_auth/ui/components/buttons/button_widget.dart';
import 'package:ente_auth/ui/home_page.dart';
import 'package:ente_auth/utils/crypto_util.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:ente_auth/utils/email_util.dart';
import 'package:flutter/material.dart';
@@ -26,11 +29,20 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
String? email;
bool _passwordInFocus = false;
bool _passwordVisible = false;
String? _volatilePassword;
@override
void initState() {
super.initState();
email = Configuration.instance.getEmail();
_volatilePassword = Configuration.instance.getVolatilePassword();
if (_volatilePassword != null) {
_passwordController.text = _volatilePassword!;
Future.delayed(
Duration.zero,
() => verifyPassword(_volatilePassword!),
);
}
_passwordFocusNode.addListener(() {
setState(() {
_passwordInFocus = _passwordFocusNode.hasFocus;
@@ -64,68 +76,13 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
),
body: _getBody(),
floatingActionButton: DynamicFAB(
key: const ValueKey("verifyPasswordButton"),
isKeypadOpen: isKeypadOpen,
isFormValid: _passwordController.text.isNotEmpty,
buttonText: context.l10n.verifyPassword,
onPressedFunction: () async {
FocusScope.of(context).unfocus();
final dialog = createProgressDialog(context, context.l10n.pleaseWait);
await dialog.show();
try {
await Configuration.instance.decryptAndSaveSecrets(
_passwordController.text,
Configuration.instance.getKeyAttributes()!,
);
} on KeyDerivationError catch (e, s) {
_logger.severe("Password verification failed", e, s);
await dialog.hide();
final dialogChoice = await showChoiceDialog(
context,
title: context.l10n.recreatePasswordTitle,
body: context.l10n.recreatePasswordBody,
firstButtonLabel: context.l10n.useRecoveryKey,
);
if (dialogChoice!.action == ButtonAction.first) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return const RecoveryPage();
},
),
);
}
return;
} catch (e, s) {
_logger.severe("Password verification failed", e, s);
await dialog.hide();
final dialogChoice = await showChoiceDialog(
context,
title: context.l10n.incorrectPasswordTitle,
body: context.l10n.pleaseTryAgain,
firstButtonLabel: context.l10n.contactSupport,
secondButtonLabel: context.l10n.ok,
);
if (dialogChoice!.action == ButtonAction.first) {
await sendLogs(
context,
context.l10n.contactSupport,
"support@ente.io",
postShare: () {},
);
}
return;
}
await dialog.hide();
unawaited(
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
return const HomePage();
},
),
(route) => false,
),
);
await verifyPassword(_passwordController.text);
},
),
floatingActionButtonLocation: fabLocation(),
@@ -133,6 +90,90 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
);
}
Future<void> verifyPassword(String password) async {
FocusScope.of(context).unfocus();
final dialog =
createProgressDialog(context, context.l10n.pleaseWait);
await dialog.show();
try {
final kek = await Configuration.instance.decryptSecretsAndGetKeyEncKey(
password,
Configuration.instance.getKeyAttributes()!,
);
_registerSRPForExistingUsers(kek).ignore();
} on KeyDerivationError catch (e, s) {
_logger.severe("Password verification failed", e, s);
await dialog.hide();
final dialogChoice = await showChoiceDialog(
context,
title: context.l10n.recreatePasswordTitle,
body: context.l10n.recreatePasswordBody,
firstButtonLabel: context.l10n.useRecoveryKey,
);
if (dialogChoice!.action == ButtonAction.first) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return const RecoveryPage();
},
),
);
}
return;
} catch (e, s) {
_logger.severe("Password verification failed", e, s);
await dialog.hide();
final dialogChoice = await showChoiceDialog(
context,
title: context.l10n.incorrectPasswordTitle,
body: context.l10n.pleaseTryAgain,
firstButtonLabel: context.l10n.contactSupport,
secondButtonLabel: context.l10n.ok,
);
if (dialogChoice!.action == ButtonAction.first) {
await sendLogs(
context,
context.l10n.contactSupport,
"support@ente.io",
postShare: () {},
);
}
return;
}
await dialog.hide();
Configuration.instance.setVolatilePassword(null);
unawaited(
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
return const HomePage();
},
),
(route) => false,
),
);
}
Future<void> _registerSRPForExistingUsers(Uint8List key) async {
bool shouldSetupSRP = false;
try {
// ignore: unused_local_variable
final attr = await UserService.instance.getSrpAttributes(email!);
} on SrpSetupNotCompleteError {
shouldSetupSRP = true;
} catch (e, s) {
_logger.severe("error while fetching attr", e, s);
}
if (shouldSetupSRP) {
try {
final Uint8List loginKey = await CryptoUtil.deriveLoginKey(key);
await UserService.instance.registerOrUpdateSrp(loginKey);
} catch (e, s) {
_logger.severe("error while setting up srp for existing users", e, s);
}
}
}
Widget _getBody() {
return Column(
children: [
@@ -142,10 +183,10 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
children: [
Padding(
padding:
const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
child: Text(
context.l10n.welcomeBack,
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
),
Visibility(
@@ -165,6 +206,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
Padding(
padding: const EdgeInsets.fromLTRB(20, 24, 20, 0),
child: TextFormField(
key: const ValueKey("passwordInputField"),
autofillHints: const [AutofillHints.password],
decoration: InputDecoration(
hintText: context.l10n.enterYourPasswordHint,
@@ -176,19 +218,19 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
),
suffixIcon: _passwordInFocus
? IconButton(
icon: Icon(
_passwordVisible
? Icons.visibility
: Icons.visibility_off,
color: Theme.of(context).iconTheme.color,
size: 20,
),
onPressed: () {
setState(() {
_passwordVisible = !_passwordVisible;
});
},
)
icon: Icon(
_passwordVisible
? Icons.visibility
: Icons.visibility_off,
color: Theme.of(context).iconTheme.color,
size: 20,
),
onPressed: () {
setState(() {
_passwordVisible = !_passwordVisible;
});
},
)
: null,
),
style: const TextStyle(
@@ -230,11 +272,13 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
child: Center(
child: Text(
context.l10n.forgotPassword,
style:
Theme.of(context).textTheme.subtitle1!.copyWith(
fontSize: 14,
decoration: TextDecoration.underline,
),
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontSize: 14,
decoration: TextDecoration.underline,
),
),
),
),
@@ -254,11 +298,13 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
child: Center(
child: Text(
context.l10n.changeEmail,
style:
Theme.of(context).textTheme.subtitle1!.copyWith(
fontSize: 14,
decoration: TextDecoration.underline,
),
style: Theme.of(context)
.textTheme
.titleMedium!
.copyWith(
fontSize: 14,
decoration: TextDecoration.underline,
),
),
),
),

View File

@@ -103,14 +103,14 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
? const SizedBox.shrink()
: Text(
widget.title ?? context.l10n.recoveryKey,
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
Padding(
padding: EdgeInsets.all(widget.showAppBar! ? 0 : 12),
),
Text(
widget.text ?? context.l10n.recoveryKeyOnForgotPassword,
style: Theme.of(context).textTheme.subtitle1,
style: Theme.of(context).textTheme.titleMedium,
),
const Padding(padding: EdgeInsets.only(top: 24)),
DottedBorder(
@@ -164,7 +164,7 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
child: Text(
recoveryKey,
style:
Theme.of(context).textTheme.bodyText1,
Theme.of(context).textTheme.bodyLarge,
),
),
),
@@ -177,7 +177,7 @@ class _RecoveryKeyPageState extends State<RecoveryKeyPage> {
child: Text(
widget.subText ??
context.l10n.recoveryKeySaveDescription,
style: Theme.of(context).textTheme.bodyText1,
style: Theme.of(context).textTheme.bodyLarge,
),
),
Expanded(

View File

@@ -88,7 +88,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
child: Text(
'Forgot password',
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
),
Padding(
@@ -140,7 +140,7 @@ class _RecoveryPageState extends State<RecoveryPage> {
child: Text(
"No recovery key?",
style:
Theme.of(context).textTheme.subtitle1!.copyWith(
Theme.of(context).textTheme.titleMedium!.copyWith(
fontSize: 14,
decoration: TextDecoration.underline,
),

View File

@@ -0,0 +1,216 @@
import "dart:convert";
import "dart:typed_data";
import 'package:ente_auth/core/configuration.dart';
import "package:ente_auth/l10n/l10n.dart";
import "package:ente_auth/theme/ente_theme.dart";
import 'package:ente_auth/ui/common/dynamic_fab.dart';
import "package:ente_auth/utils/crypto_util.dart";
import "package:ente_auth/utils/dialog_util.dart";
import 'package:flutter/material.dart';
import "package:flutter_sodium/flutter_sodium.dart";
import "package:logging/logging.dart";
typedef OnPasswordVerifiedFn = Future<void> Function(Uint8List bytes);
class RequestPasswordVerificationPage extends StatefulWidget {
final OnPasswordVerifiedFn onPasswordVerified;
final Function? onPasswordError;
const RequestPasswordVerificationPage(
{super.key, required this.onPasswordVerified, this.onPasswordError,});
@override
State<RequestPasswordVerificationPage> createState() =>
_RequestPasswordVerificationPageState();
}
class _RequestPasswordVerificationPageState
extends State<RequestPasswordVerificationPage> {
final _logger = Logger((_RequestPasswordVerificationPageState).toString());
final _passwordController = TextEditingController();
final FocusNode _passwordFocusNode = FocusNode();
String? email;
bool _passwordInFocus = false;
bool _passwordVisible = false;
@override
void initState() {
super.initState();
email = Configuration.instance.getEmail();
_passwordFocusNode.addListener(() {
setState(() {
_passwordInFocus = _passwordFocusNode.hasFocus;
});
});
}
@override
Widget build(BuildContext context) {
final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;
FloatingActionButtonLocation? fabLocation() {
if (isKeypadOpen) {
return null;
} else {
return FloatingActionButtonLocation.centerFloat;
}
}
return Scaffold(
resizeToAvoidBottomInset: isKeypadOpen,
appBar: AppBar(
elevation: 0,
leading: IconButton(
icon: const Icon(Icons.arrow_back),
color: Theme.of(context).iconTheme.color,
onPressed: () {
Navigator.of(context).pop();
},
),
),
body: _getBody(),
floatingActionButton: DynamicFAB(
key: const ValueKey("verifyPasswordButton"),
isKeypadOpen: isKeypadOpen,
isFormValid: _passwordController.text.isNotEmpty,
buttonText: context.l10n.verifyPassword,
onPressedFunction: () async {
FocusScope.of(context).unfocus();
final dialog = createProgressDialog(context, context.l10n.pleaseWait);
dialog.show();
try {
final attributes = Configuration.instance.getKeyAttributes()!;
final Uint8List keyEncryptionKey = await CryptoUtil.deriveKey(
utf8.encode(_passwordController.text) as Uint8List,
Sodium.base642bin(attributes.kekSalt),
attributes.memLimit,
attributes.opsLimit,
);
CryptoUtil.decryptSync(
Sodium.base642bin(attributes.encryptedKey),
keyEncryptionKey,
Sodium.base642bin(attributes.keyDecryptionNonce),
);
dialog.show();
// pop
await widget.onPasswordVerified(keyEncryptionKey);
dialog.hide();
Navigator.of(context).pop(true);
} catch (e, s) {
_logger.severe("Error while verifying password", e, s);
dialog.hide();
if (widget.onPasswordError != null) {
widget.onPasswordError!();
} else {
showErrorDialog(
context,
context.l10n.incorrectPasswordTitle,
context.l10n.pleaseTryAgain,
);
}
}
},
),
floatingActionButtonLocation: fabLocation(),
floatingActionButtonAnimator: NoScalingAnimation(),
);
}
Widget _getBody() {
return Column(
children: [
Expanded(
child: AutofillGroup(
child: ListView(
children: [
Padding(
padding: const EdgeInsets.only(top: 30, left: 20, right: 20),
child: Text(
context.l10n.enterPassword,
style: Theme.of(context).textTheme.headlineMedium,
),
),
Padding(
padding: const EdgeInsets.only(
bottom: 30,
left: 22,
right: 20,
),
child: Text(
email ?? '',
style: getEnteTextTheme(context).smallMuted,
),
),
Visibility(
// hidden textForm for suggesting auto-fill service for saving
// password
visible: false,
child: TextFormField(
autofillHints: const [
AutofillHints.email,
],
autocorrect: false,
keyboardType: TextInputType.emailAddress,
initialValue: email,
textInputAction: TextInputAction.next,
),
),
Padding(
padding: const EdgeInsets.fromLTRB(20, 24, 20, 0),
child: TextFormField(
key: const ValueKey("passwordInputField"),
autofillHints: const [AutofillHints.password],
decoration: InputDecoration(
hintText: context.l10n.enterYourPasswordHint,
filled: true,
contentPadding: const EdgeInsets.all(20),
border: UnderlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(6),
),
suffixIcon: _passwordInFocus
? IconButton(
icon: Icon(
_passwordVisible
? Icons.visibility
: Icons.visibility_off,
color: Theme.of(context).iconTheme.color,
size: 20,
),
onPressed: () {
setState(() {
_passwordVisible = !_passwordVisible;
});
},
)
: null,
),
style: const TextStyle(
fontSize: 14,
),
controller: _passwordController,
autofocus: true,
autocorrect: false,
obscureText: !_passwordVisible,
keyboardType: TextInputType.visiblePassword,
focusNode: _passwordFocusNode,
onChanged: (_) {
setState(() {});
},
),
),
const Padding(
padding: EdgeInsets.symmetric(vertical: 18),
child: Divider(
thickness: 1,
),
),
],
),
),
),
],
);
}
}

View File

@@ -162,7 +162,7 @@ class _SessionsPageState extends State<SessionsPage> {
const Padding(padding: EdgeInsets.all(8)),
Text(
session.ua,
style: Theme.of(context).textTheme.caption,
style: Theme.of(context).textTheme.bodySmall,
),
],
),

View File

@@ -1,12 +1,17 @@
import 'dart:async';
import 'package:clipboard/clipboard.dart';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/ente_theme_data.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/onboarding/view/setup_enter_secret_key_page.dart';
import 'package:ente_auth/onboarding/view/view_qr_page.dart';
import 'package:ente_auth/services/preference_service.dart';
import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/ui/code_timer_progress.dart';
import 'package:ente_auth/ui/utils/icon_utils.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:ente_auth/utils/toast_util.dart';
import 'package:ente_auth/utils/totp_util.dart';
import 'package:flutter/material.dart';
@@ -27,20 +32,25 @@ class _CodeWidgetState extends State<CodeWidget> {
final ValueNotifier<String> _currentCode = ValueNotifier<String>("");
final ValueNotifier<String> _nextCode = ValueNotifier<String>("");
final Logger logger = Logger("_CodeWidgetState");
bool _isInitialized = false;
late bool hasConfiguredAccount;
late bool _shouldShowLargeIcon;
@override
void initState() {
super.initState();
_currentCode.value = _getTotp();
_nextCode.value = _getNextTotp();
_everySecondTimer =
Timer.periodic(const Duration(milliseconds: 500), (Timer t) {
String newCode = _getTotp();
String newCode = _getCurrentOTP();
if (newCode != _currentCode.value) {
_currentCode.value = newCode;
_nextCode.value = _getNextTotp();
if (widget.code.type == Type.totp) {
_nextCode.value = _getNextTotp();
}
}
});
hasConfiguredAccount = Configuration.instance.hasConfiguredAccount();
}
@override
@@ -53,14 +63,40 @@ class _CodeWidgetState extends State<CodeWidget> {
@override
Widget build(BuildContext context) {
_shouldShowLargeIcon = PreferenceService.instance.shouldShowLargeIcons();
if (!_isInitialized) {
_currentCode.value = _getCurrentOTP();
if (widget.code.type == Type.totp) {
_nextCode.value = _getNextTotp();
}
_isInitialized = true;
}
final l10n = context.l10n;
return Container(
margin: const EdgeInsets.only(left: 16, right: 16, bottom: 8, top: 8),
child: Slidable(
key: ValueKey(widget.code.hashCode),
endActionPane: ActionPane(
extentRatio: 0.60,
motion: const ScrollMotion(),
children: [
const SizedBox(
width: 4,
),
SlidableAction(
onPressed: _onShowQrPressed,
backgroundColor: Colors.grey.withOpacity(0.1),
borderRadius: const BorderRadius.all(Radius.circular(12.0)),
foregroundColor:
Theme.of(context).colorScheme.inverseBackgroundColor,
icon: Icons.qr_code_2_outlined,
label: "QR",
padding: const EdgeInsets.only(left: 4, right: 0),
spacing: 8,
),
const SizedBox(
width: 4,
),
SlidableAction(
onPressed: _onEditPressed,
backgroundColor: Colors.grey.withOpacity(0.1),
@@ -87,122 +123,23 @@ class _CodeWidgetState extends State<CodeWidget> {
),
],
),
child: Container(
margin: const EdgeInsets.only(right: 10),
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Container(
color: Theme.of(context).colorScheme.codeCardBackgroundColor,
child: Material(
color: Colors.transparent,
child: InkWell(
customBorder: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
onTap: () {
_copyToClipboard();
},
onLongPress: () {
_copyToClipboard();
},
child: SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
CodeTimerProgress(
period: widget.code.period,
),
const SizedBox(
height: 16,
),
Padding(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
safeDecode(widget.code.issuer).trim(),
style:
Theme.of(context).textTheme.headline6,
),
const SizedBox(height: 2),
Text(
safeDecode(widget.code.account).trim(),
style: Theme.of(context)
.textTheme
.caption
?.copyWith(
fontSize: 12,
color: Colors.grey,
),
),
],
),
widget.code.hasSynced != null &&
widget.code.hasSynced!
? Container()
: const Icon(
Icons.sync_disabled,
size: 20,
color: Colors.amber,
),
],
),
),
const SizedBox(height: 4),
Container(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: ValueListenableBuilder<String>(
valueListenable: _currentCode,
builder: (context, value, child) {
return Text(
value,
style: const TextStyle(fontSize: 24),
);
},
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
l10n.nextTotpTitle,
style: Theme.of(context).textTheme.caption,
),
ValueListenableBuilder<String>(
valueListenable: _nextCode,
builder: (context, value, child) {
return Text(
value,
style: const TextStyle(
fontSize: 18,
color: Colors.grey,
),
);
},
),
],
),
],
),
),
const SizedBox(
height: 20,
),
],
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(8),
child: Container(
color: Theme.of(context).colorScheme.codeCardBackgroundColor,
child: Material(
color: Colors.transparent,
child: InkWell(
customBorder: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
onTap: () {
_copyToClipboard();
},
onLongPress: () {
_copyToClipboard();
},
child: _getCardContents(l10n),
),
),
),
@@ -211,11 +148,192 @@ class _CodeWidgetState extends State<CodeWidget> {
);
}
Widget _getCardContents(AppLocalizations l10n) {
return SizedBox(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (widget.code.type == Type.totp)
CodeTimerProgress(
period: widget.code.period,
),
const SizedBox(
height: 16,
),
Row(
children: [
_shouldShowLargeIcon ? _getIcon() : const SizedBox.shrink(),
Expanded(
child: Column(
children: [
_getTopRow(),
const SizedBox(height: 4),
_getBottomRow(l10n),
],
),
),
],
),
const SizedBox(
height: 20,
),
],
),
);
}
Widget _getBottomRow(AppLocalizations l10n) {
return Container(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: ValueListenableBuilder<String>(
valueListenable: _currentCode,
builder: (context, value, child) {
return Material(
type: MaterialType.transparency,
child: Text(
_getFormattedCode(value),
style: const TextStyle(fontSize: 24),
),
);
},
),
),
widget.code.type == Type.totp
? GestureDetector(
onTap: () {
_copyNextToClipboard();
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
l10n.nextTotpTitle,
style: Theme.of(context).textTheme.bodySmall,
),
ValueListenableBuilder<String>(
valueListenable: _nextCode,
builder: (context, value, child) {
return Material(
type: MaterialType.transparency,
child: Text(
_getFormattedCode(value),
style: const TextStyle(
fontSize: 18,
color: Colors.grey,
),
),
);
},
),
],
),
)
: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
l10n.nextTotpTitle,
style: Theme.of(context).textTheme.bodySmall,
),
InkWell(
onTap: _onNextHotpTapped,
child: const Icon(
Icons.forward_outlined,
size: 32,
color: Colors.grey,
),
),
],
),
],
),
);
}
Widget _getTopRow() {
return Padding(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
safeDecode(widget.code.issuer).trim(),
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(height: 2),
Text(
safeDecode(widget.code.account).trim(),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
fontSize: 12,
color: Colors.grey,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
(widget.code.hasSynced != null && widget.code.hasSynced!) ||
!hasConfiguredAccount
? const SizedBox.shrink()
: const Icon(
Icons.sync_disabled,
size: 20,
color: Colors.amber,
),
const SizedBox(width: 12),
_shouldShowLargeIcon ? const SizedBox.shrink() : _getIcon(),
],
),
],
),
);
}
Widget _getIcon() {
return Padding(
padding: _shouldShowLargeIcon
? const EdgeInsets.only(left: 16)
: const EdgeInsets.all(0),
child: IconUtils.instance.getIcon(
safeDecode(widget.code.issuer).trim(),
width: _shouldShowLargeIcon ? 42 : 24,
),
);
}
void _copyToClipboard() {
FlutterClipboard.copy(_getTotp())
FlutterClipboard.copy(_getCurrentOTP())
.then((value) => showToast(context, context.l10n.copiedToClipboard));
}
void _copyNextToClipboard() {
FlutterClipboard.copy(_getNextTotp()).then(
(value) => showToast(context, context.l10n.copiedNextToClipboard),
);
}
void _onNextHotpTapped() {
if (widget.code.type == Type.hotp) {
CodeStore.instance
.addCode(
widget.code.copyWith(counter: widget.code.counter + 1),
shouldSync: true,
)
.ignore();
}
}
Future<void> _onEditPressed(_) async {
final Code? code = await Navigator.of(context).push(
MaterialPageRoute(
@@ -229,66 +347,34 @@ class _CodeWidgetState extends State<CodeWidget> {
}
}
void _onDeletePressed(_) {
Future<void> _onShowQrPressed(_) async {
// ignore: unused_local_variable
final Code? code = await Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return ViewQrPage(code: widget.code);
},
),
);
}
void _onDeletePressed(_) async {
final l10n = context.l10n;
final AlertDialog alert = AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
title: Text(
l10n.deleteCodeTitle,
style: Theme.of(context).textTheme.headline6,
),
content: Text(
l10n.deleteCodeMessage,
),
actions: [
TextButton(
child: Text(
l10n.delete,
style: const TextStyle(
color: Colors.red,
),
),
onPressed: () {
CodeStore.instance.removeCode(widget.code);
Navigator.of(context, rootNavigator: true).pop('dialog');
},
),
TextButton(
child: Text(
l10n.cancel,
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
),
),
onPressed: () {
Navigator.of(context, rootNavigator: true).pop('dialog');
},
),
],
);
showDialog(
context: context,
builder: (BuildContext context) {
return alert;
await showChoiceActionSheet(
context,
title: l10n.deleteCodeTitle,
body: l10n.deleteCodeMessage,
firstButtonLabel: l10n.delete,
isCritical: true,
firstButtonOnTap: () async {
await CodeStore.instance.removeCode(widget.code);
},
barrierColor: Colors.black12,
);
}
String safeDecode(String value) {
String _getCurrentOTP() {
try {
return Uri.decodeComponent(value);
} catch (e) {
// note: don't log the value, it might contain sensitive information
logger.severe("Failed to decode", e);
return value;
}
}
String _getTotp() {
try {
return getTotp(widget.code);
return getOTP(widget.code);
} catch (e) {
return context.l10n.error;
}
@@ -296,9 +382,17 @@ class _CodeWidgetState extends State<CodeWidget> {
String _getNextTotp() {
try {
assert(widget.code.type == Type.totp);
return getNextTotp(widget.code);
} catch (e) {
return context.l10n.error;
}
}
String _getFormattedCode(String code) {
if (code.length == 6) {
return code.substring(0, 3) + " " + code.substring(3, 6);
}
return code;
}
}

View File

@@ -16,7 +16,7 @@ class BottomShadowWidget extends StatelessWidget {
color: Colors.transparent,
boxShadow: [
BoxShadow(
color: shadowColor ?? Theme.of(context).backgroundColor,
color: shadowColor ?? Theme.of(context).colorScheme.background,
spreadRadius: 42,
blurRadius: 42,
offset: Offset(0, offsetDy), // changes position of shadow

View File

@@ -26,7 +26,7 @@ class DynamicFAB extends StatelessWidget {
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Theme.of(context).backgroundColor,
color: Theme.of(context).colorScheme.background,
spreadRadius: 200,
blurRadius: 100,
offset: const Offset(0, 230),

View File

@@ -6,10 +6,10 @@ PopupMenuButton<dynamic> reportBugPopupMenu(BuildContext context) {
itemBuilder: (context) {
final List<PopupMenuItem> items = [];
items.add(
PopupMenuItem(
const PopupMenuItem(
value: 1,
child: Row(
children: const [
children: [
Text("Contact support"),
],
),

View File

@@ -73,19 +73,22 @@ class DialogWidget extends StatelessWidget {
boxShadow: shadowFloatLight,
borderRadius: const BorderRadius.all(Radius.circular(8)),
),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ContentContainer(
title: title,
body: body,
icon: icon,
),
const SizedBox(height: 36),
Actions(buttons),
],
child: Material(
color: Colors.transparent,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ContentContainer(
title: title,
body: body,
icon: icon,
),
const SizedBox(height: 36),
Actions(buttons),
],
),
),
),
);

View File

@@ -1,75 +1,120 @@
import 'package:ente_auth/ente_theme_data.dart';
import "package:ente_auth/ente_theme_data.dart";
import 'package:ente_auth/theme/colors.dart';
import "package:ente_auth/theme/ente_theme.dart";
import 'package:ente_auth/theme/text_style.dart';
import 'package:ente_auth/ui/components/buttons/icon_button_widget.dart';
import 'package:flutter/material.dart';
class NotificationWarningWidget extends StatelessWidget {
final IconData warningIcon;
// CreateNotificationType enum
enum NotificationType {
warning,
banner,
notice,
}
class NotificationWidget extends StatelessWidget {
final IconData startIcon;
final IconData actionIcon;
final String text;
final String? subText;
final GestureTapCallback onTap;
final NotificationType type;
const NotificationWarningWidget({
const NotificationWidget({
Key? key,
required this.warningIcon,
required this.startIcon,
required this.actionIcon,
required this.text,
required this.onTap,
this.subText,
this.type = NotificationType.warning,
}) : super(key: key);
@override
Widget build(BuildContext context) {
EnteColorScheme colorScheme = getEnteColorScheme(context);
EnteTextTheme textTheme = getEnteTextTheme(context);
TextStyle mainTextStyle = darkTextTheme.bodyBold;
TextStyle subTextStyle = darkTextTheme.miniMuted;
LinearGradient? backgroundGradient;
Color? backgroundColor;
EnteColorScheme strokeColorScheme = darkScheme;
List<BoxShadow>? boxShadow;
switch (type) {
case NotificationType.warning:
backgroundColor = warning500;
break;
case NotificationType.banner:
colorScheme = getEnteColorScheme(context);
textTheme = getEnteTextTheme(context);
backgroundColor = colorScheme.backgroundElevated2;
mainTextStyle = textTheme.bodyBold;
subTextStyle = textTheme.miniMuted;
strokeColorScheme = colorScheme;
boxShadow = [
BoxShadow(color: Colors.black.withOpacity(0.25), blurRadius: 1),
];
break;
case NotificationType.notice:
backgroundColor = colorScheme.backgroundElevated2;
mainTextStyle = textTheme.bodyBold;
subTextStyle = textTheme.miniMuted;
strokeColorScheme = colorScheme;
boxShadow = Theme.of(context).colorScheme.enteTheme.shadowMenu;
break;
}
return Center(
child: GestureDetector(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12),
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(8),
),
boxShadow: Theme.of(context).colorScheme.enteTheme.shadowMenu,
color: warning500,
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(8),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(
warningIcon,
size: 36,
color: Colors.white,
),
const SizedBox(width: 12),
Flexible(
child: Text(
text,
style: darkTextTheme.bodyBold,
textAlign: TextAlign.left,
),
),
const SizedBox(width: 12),
ClipOval(
child: Material(
color: fillFaintDark,
child: InkWell(
splashColor: Colors.red, // Splash color
onTap: onTap,
child: SizedBox(
width: 40,
height: 40,
child: Icon(
actionIcon,
color: Colors.white,
),
),
boxShadow: boxShadow,
color: backgroundColor,
gradient: backgroundGradient,
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Icon(
startIcon,
size: 36,
color: strokeColorScheme.strokeBase,
),
const SizedBox(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
text,
style: mainTextStyle,
textAlign: TextAlign.left,
),
),
subText != null
? Text(
subText!,
style: subTextStyle,
)
: const SizedBox.shrink(),
],
),
],
),
),
const SizedBox(width: 12),
IconButtonWidget(
icon: actionIcon,
iconButtonType: IconButtonType.rounded,
iconColor: strokeColorScheme.strokeBase,
defaultColor: strokeColorScheme.fillFaint,
pressedColor: strokeColorScheme.fillMuted,
onTap: onTap,
),
],
),
),
),

View File

@@ -53,6 +53,7 @@ class _ToggleSwitchWidgetState extends State<ToggleSwitchWidget> {
fit: BoxFit.contain,
child: Switch.adaptive(
activeColor: enteColorScheme.primary400,
activeTrackColor: enteColorScheme.primary300,
inactiveTrackColor: enteColorScheme.fillMuted,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
value: toggleValue ?? false,

View File

@@ -41,7 +41,7 @@ class CoachMarkWidget extends StatelessWidget {
),
Text(
l10n.swipeHint,
style: Theme.of(context).textTheme.headline6,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(
height: 36,

View File

@@ -1,4 +1,8 @@
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/settings/data/import_page.dart';
import 'package:ente_auth/ui/settings/faq.dart';
import 'package:ente_auth/utils/navigation_util.dart';
import 'package:flutter/material.dart';
class HomeEmptyStateWidget extends StatelessWidget {
@@ -32,7 +36,7 @@ class HomeEmptyStateWidget extends StatelessWidget {
Text(
l10n.setupFirstAccount,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
const SizedBox(height: 64),
SizedBox(
@@ -50,6 +54,33 @@ class HomeEmptyStateWidget extends StatelessWidget {
child: Text(l10n.importEnterSetupKey),
),
),
const SizedBox(height: 54),
InkWell(
onTap: () {
routeToPage(context, ImportCodePage());
},
child: Text(
l10n.importCodes,
textAlign: TextAlign.center,
style: getEnteTextTheme(context).bodyFaint.copyWith(decoration: TextDecoration.underline),
),),
const SizedBox(height: 18),
InkWell(
onTap: () {
showModalBottomSheet<void>(
backgroundColor: Theme.of(context).colorScheme.background,
barrierColor: Colors.black87,
context: context,
builder: (context) {
return const FAQQuestionsWidget();
},
);
},
child: Text(
l10n.faq,
textAlign: TextAlign.center,
style: getEnteTextTheme(context).bodyFaint.copyWith(decoration: TextDecoration.underline),
),),
],
),
],

View File

@@ -5,6 +5,7 @@ import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/core/event_bus.dart';
import 'package:ente_auth/ente_theme_data.dart';
import 'package:ente_auth/events/codes_updated_event.dart';
import 'package:ente_auth/events/icons_changed_event.dart';
import 'package:ente_auth/events/trigger_logout_event.dart';
import "package:ente_auth/l10n/l10n.dart";
import 'package:ente_auth/models/code.dart';
@@ -51,9 +52,11 @@ class _HomePageState extends State<HomePage> {
List<Code> _filteredCodes = [];
StreamSubscription<CodesUpdatedEvent>? _streamSubscription;
StreamSubscription<TriggerLogoutEvent>? _triggerLogoutEvent;
StreamSubscription<IconsChangedEvent>? _iconsChangedEvent;
@override
void initState() {
super.initState();
_textController.addListener(_applyFilteringAndRefresh);
_loadCodes();
_streamSubscription = Bus.instance.on<CodesUpdatedEvent>().listen((event) {
@@ -64,7 +67,14 @@ class _HomePageState extends State<HomePage> {
await autoLogoutAlert(context);
});
_initDeepLinks();
super.initState();
Future.delayed(
const Duration(seconds: 1),
() async => await CodeStore.instance.importOfflineCodes(),
);
_iconsChangedEvent = Bus.instance.on<IconsChangedEvent>().listen((event) {
setState(() {});
});
_showSearchBox = PreferenceService.instance.shouldAutoFocusOnSearchBar();
}
void _loadCodes() {
@@ -96,6 +106,7 @@ class _HomePageState extends State<HomePage> {
void dispose() {
_streamSubscription?.cancel();
_triggerLogoutEvent?.cancel();
_iconsChangedEvent?.cancel();
_textController.removeListener(_applyFilteringAndRefresh);
super.dispose();
}
@@ -167,7 +178,7 @@ class _HomePageState extends State<HomePage> {
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: !_showSearchBox
? const Text('ente Authenticator')
? const Text('ente Auth')
: TextField(
autofocus: _searchText.isEmpty,
controller: _textController,
@@ -178,6 +189,7 @@ class _HomePageState extends State<HomePage> {
decoration: InputDecoration(
hintText: l10n.searchHint,
border: InputBorder.none,
focusedBorder: InputBorder.none,
),
),
actions: <Widget>[
@@ -222,7 +234,11 @@ class _HomePageState extends State<HomePage> {
} else {
final list = ListView.builder(
itemBuilder: ((context, index) {
return CodeWidget(_filteredCodes[index]);
try {
return CodeWidget(_filteredCodes[index]);
} catch (e) {
return const Text("Failed");
}
}),
itemCount: _filteredCodes.length,
);
@@ -243,7 +259,7 @@ class _HomePageState extends State<HomePage> {
Code? code;
try {
code = _filteredCodes[index];
return CodeWidget(code!);
return CodeWidget(code);
} catch (e, s) {
_logger.severe("code widget error", e, s);
return Center(

View File

@@ -0,0 +1,97 @@
import 'dart:io';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/settings/data/import/google_auth_import.dart';
import 'package:ente_auth/utils/toast_util.dart';
import 'package:flutter/material.dart';
import 'package:qr_code_scanner/qr_code_scanner.dart';
class ScannerGoogleAuthPage extends StatefulWidget {
const ScannerGoogleAuthPage({Key? key}) : super(key: key);
@override
State<ScannerGoogleAuthPage> createState() => ScannerGoogleAuthPageState();
}
class ScannerGoogleAuthPageState extends State<ScannerGoogleAuthPage> {
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
QRViewController? controller;
String? totp;
// In order to get hot reload to work we need to pause the camera if the platform
// is android, or resume the camera if the platform is iOS.
@override
void reassemble() {
super.reassemble();
if (Platform.isAndroid) {
controller!.pauseCamera();
} else if (Platform.isIOS) {
controller!.resumeCamera();
}
}
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
return Scaffold(
appBar: AppBar(
title: Text(l10n.scan),
),
body: Column(
children: <Widget>[
Expanded(
flex: 5,
child: QRView(
key: qrKey,
overlay: QrScannerOverlayShape(
borderColor: getEnteColorScheme(context).primary700,),
onQRViewCreated: _onQRViewCreated,
formatsAllowed: const [BarcodeFormat.qrcode],
),
),
Expanded(
flex: 1,
child: Center(
child: (totp != null) ? Text(totp!) : Text(l10n.scanACode),
),
)
],
),
);
}
void _onQRViewCreated(QRViewController controller) {
this.controller = controller;
// h4ck to remove black screen on Android scanners: https://github.com/juliuscanute/qr_code_scanner/issues/560#issuecomment-1159611301
if (Platform.isAndroid) {
controller.pauseCamera();
controller.resumeCamera();
}
controller.scannedDataStream.listen((scanData) {
try {
if (scanData.code == null) {
return;
}
if (scanData.code!.startsWith(kGoogleAuthExportPrefix)) {
List<Code> codes = parseGoogleAuth(scanData.code!);
controller.dispose();
Navigator.of(context).pop(codes);
} else {
showToast(context, "Invalid QR code");
}
} catch (e) {
controller.dispose();
Navigator.of(context).pop();
showToast(context, "Error " + e.toString());
}
});
}
@override
void dispose() {
controller?.dispose();
super.dispose();
}
}

View File

@@ -36,7 +36,7 @@ class AboutSectionWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
launchUrl(Uri.parse("https://github.com/ente-io/photos-app"));
launchUrl(Uri.parse("https://github.com/ente-io/auth"));
},
),
sectionOptionSpacing,

View File

@@ -1,23 +1,19 @@
import 'package:ente_auth/app/view/app.dart';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/locale.dart';
import 'package:ente_auth/services/local_authentication_service.dart';
import 'package:ente_auth/services/user_service.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/account/change_email_dialog.dart';
import 'package:ente_auth/ui/account/delete_account_page.dart';
import 'package:ente_auth/ui/account/password_entry_page.dart';
import 'package:ente_auth/ui/account/recovery_key_page.dart';
import 'package:ente_auth/ui/components/captioned_text_widget.dart';
import 'package:ente_auth/ui/components/expandable_menu_item_widget.dart';
import 'package:ente_auth/ui/components/menu_item_widget.dart';
import 'package:ente_auth/ui/settings/common_settings.dart';
import 'package:ente_auth/ui/settings/language_picker.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:ente_auth/utils/navigation_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_sodium/flutter_sodium.dart';
class AccountSectionWidget extends StatelessWidget {
AccountSectionWidget({Key? key}) : super(key: key);
@@ -36,41 +32,6 @@ class AccountSectionWidget extends StatelessWidget {
final l10n = context.l10n;
List<Widget> children = [];
children.addAll([
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.recoveryKey,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
l10n.authToViewYourRecoveryKey,
);
if (hasAuthenticated) {
String recoveryKey;
try {
recoveryKey =
Sodium.bin2hex(Configuration.instance.getRecoveryKey());
} catch (e) {
showGenericErrorDialog(context: context);
return;
}
routeToPage(
context,
RecoveryKeyPage(
recoveryKey,
l10n.ok,
showAppBar: true,
onDone: () {},
),
);
}
},
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
@@ -127,24 +88,25 @@ class AccountSectionWidget extends StatelessWidget {
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.language,
title: context.l10n.logout,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
final locale = await getLocale();
routeToPage(
context,
LanguageSelectorPage(
appSupportedLocales,
(locale) async {
await setLocale(locale);
App.setLocale(context, locale);
},
locale,
),
);
_onLogoutTapped(context);
},
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: context.l10n.deleteAccount,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
routeToPage(context, const DeleteAccountPage());
},
),
sectionOptionSpacing,
@@ -153,4 +115,15 @@ class AccountSectionWidget extends StatelessWidget {
children: children,
);
}
void _onLogoutTapped(BuildContext context) {
showChoiceActionSheet(
context,
title: context.l10n.areYouSureYouWantToLogout,
firstButtonLabel: context.l10n.yesLogout,
isCritical: true,
firstButtonOnTap: () async {
await UserService.instance.logout(context);
},
);
}
}

View File

@@ -1,12 +1,15 @@
import 'dart:io';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/core/network.dart';
import 'package:ente_auth/ente_theme_data.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/services/update_service.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:open_filex/open_filex.dart';
import 'package:url_launcher/url_launcher_string.dart';
class AppUpdateDialog extends StatefulWidget {
final LatestVersionInfo? latestVersionInfo;
@@ -20,6 +23,7 @@ class AppUpdateDialog extends StatefulWidget {
class _AppUpdateDialogState extends State<AppUpdateDialog> {
@override
Widget build(BuildContext context) {
final enteTextTheme = getEnteTextTheme(context);
final List<Widget> changelog = [];
for (final log in widget.latestVersionInfo!.changelog) {
changelog.add(
@@ -27,7 +31,7 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
padding: const EdgeInsets.fromLTRB(8, 4, 0, 4),
child: Text(
"- " + log,
style: Theme.of(context).textTheme.caption!.copyWith(
style: Theme.of(context).textTheme.bodySmall!.copyWith(
fontSize: 14,
),
),
@@ -41,18 +45,19 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
Text(
widget.latestVersionInfo!.name!,
style: const TextStyle(
fontSize: 20,
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
const Padding(padding: EdgeInsets.all(8)),
const Text(
"Changelog",
style: TextStyle(
fontSize: 18,
if (changelog.isNotEmpty)
const Text(
"Changelog",
style: TextStyle(
fontSize: 18,
),
),
),
const Padding(padding: EdgeInsets.all(4)),
if (changelog.isNotEmpty) const Padding(padding: EdgeInsets.all(4)),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: changelog,
@@ -65,22 +70,16 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
style: Theme.of(context).outlinedButtonTheme.style!.copyWith(
textStyle: MaterialStateProperty.resolveWith<TextStyle?>(
(Set<MaterialState> states) {
return Theme.of(context).textTheme.subtitle1;
return Theme.of(context).textTheme.titleMedium;
},
),
),
onPressed: () async {
Navigator.pop(context);
showDialog(
context: context,
builder: (BuildContext context) {
return ApkDownloaderDialog(widget.latestVersionInfo);
},
barrierDismissible: false,
);
},
child: const Text(
"Update",
onPressed: () => launchUrlString(
widget.latestVersionInfo!.url!,
mode: LaunchMode.externalApplication,
),
child: Text(
context.l10n.downloadUpdate,
),
),
),
@@ -91,8 +90,24 @@ class _AppUpdateDialogState extends State<AppUpdateDialog> {
return WillPopScope(
onWillPop: () async => !shouldForceUpdate,
child: AlertDialog(
title: Text(
shouldForceUpdate ? "Critical update available" : "Update available",
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
Icons.auto_awesome_outlined,
size: 24,
color: getEnteColorScheme(context).strokeMuted,
),
const SizedBox(
height: 16,
),
Text(
shouldForceUpdate
? context.l10n.criticalUpdateAvailable
: context.l10n.updateAvailable,
style: enteTextTheme.h3Bold,
),
],
),
content: content,
),
@@ -147,15 +162,17 @@ class _ApkDownloaderDialogState extends State<ApkDownloaderDialog> {
Future<void> _downloadApk() async {
try {
await Network.instance.getDio().download(
widget.versionInfo!.url!,
_saveUrl,
onReceiveProgress: (count, _) {
setState(() {
_downloadProgress = count / widget.versionInfo!.size!;
});
},
);
if (!File(_saveUrl!).existsSync()) {
await Network.instance.getDio().download(
widget.versionInfo!.url!,
_saveUrl,
onReceiveProgress: (count, _) {
setState(() {
_downloadProgress = count / widget.versionInfo!.size!;
});
},
);
}
Navigator.of(context, rootNavigator: true).pop('dialog');
OpenFilex.open(_saveUrl);
} catch (e) {

View File

@@ -49,7 +49,7 @@ class _AppVersionWidgetState extends State<AppVersionWidget> {
padding: const EdgeInsets.all(20),
child: Text(
"Version: " + snapshot.data!,
style: Theme.of(context).textTheme.caption,
style: Theme.of(context).textTheme.bodySmall,
),
);
}

View File

@@ -0,0 +1,63 @@
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/components/captioned_text_widget.dart';
import 'package:ente_auth/ui/components/expandable_menu_item_widget.dart';
import 'package:ente_auth/ui/components/menu_item_widget.dart';
import 'package:ente_auth/ui/settings/common_settings.dart';
import 'package:ente_auth/ui/settings/data/export_widget.dart';
import 'package:ente_auth/ui/settings/data/import_page.dart';
import 'package:ente_auth/utils/navigation_util.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
class DataSectionWidget extends StatelessWidget {
final _logger = Logger("AccountSectionWidget");
DataSectionWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
return ExpandableMenuItemWidget(
title: l10n.data,
selectionOptionsWidget: _getSectionOptions(context),
leadingIcon: Icons.key_outlined,
);
}
Column _getSectionOptions(BuildContext context) {
final l10n = context.l10n;
List<Widget> children = [];
children.addAll([
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.importCodes,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
routeToPage(context, ImportCodePage());
},
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.exportCodes,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
await handleExportClick(context);
},
),
sectionOptionSpacing,
]);
return Column(
children: children,
);
}
}

View File

@@ -0,0 +1,153 @@
import 'dart:convert';
import 'dart:io';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/export/ente.dart';
import 'package:ente_auth/services/local_authentication_service.dart';
import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/ui/components/buttons/button_widget.dart';
import 'package:ente_auth/ui/components/dialog_widget.dart';
import 'package:ente_auth/ui/components/models/button_type.dart';
import 'package:ente_auth/utils/crypto_util.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:ente_auth/utils/toast_util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_sodium/flutter_sodium.dart';
import 'package:logging/logging.dart';
import 'package:share_plus/share_plus.dart';
Future<void> handleExportClick(BuildContext context) async {
final result = await showDialogWidget(
context: context,
title: context.l10n.selectExportFormat,
body: context.l10n.exportDialogDesc,
buttons: [
ButtonWidget(
buttonType: ButtonType.primary,
labelText: context.l10n.encrypted,
isInAlert: true,
buttonSize: ButtonSize.large,
buttonAction: ButtonAction.first,
),
ButtonWidget(
buttonType: ButtonType.secondary,
labelText: context.l10n.plainText,
buttonSize: ButtonSize.large,
isInAlert: true,
buttonAction: ButtonAction.second,
),
],
);
if (result?.action != null && result!.action != ButtonAction.cancel) {
if (result.action == ButtonAction.first) {
await _requestForEncryptionPassword(context);
} else {
await _showExportWarningDialog(context);
}
}
}
Future<void> _requestForEncryptionPassword(
BuildContext context, {
String? password,
}) async {
final l10n = context.l10n;
await showTextInputDialog(
context,
title: l10n.passwordToEncryptExport,
submitButtonLabel: l10n.export,
hintText: l10n.enterPassword,
isPasswordInput: true,
alwaysShowSuccessState: false,
onSubmit: (String password) async {
if (password.isEmpty || password.length < 4) {
showToast(context, "Password must be at least 4 characters long.");
Future.delayed(const Duration(seconds: 0), () {
_requestForEncryptionPassword(context, password: password);
});
return;
}
if (password.isNotEmpty) {
try {
final kekSalt = CryptoUtil.getSaltToDeriveKey();
final derivedKeyResult = await CryptoUtil.deriveSensitiveKey(
utf8.encode(password) as Uint8List,
kekSalt,
);
String exportPlainText = await _getAuthDataForExport();
// Encrypt the key with this derived key
final encResult = await CryptoUtil.encryptChaCha(
utf8.encode(exportPlainText) as Uint8List,
derivedKeyResult.key,
);
final encContent = Sodium.bin2base64(encResult.encryptedData!);
final encNonce = Sodium.bin2base64(encResult.header!);
final EnteAuthExport data = EnteAuthExport(
version: 1,
encryptedData: encContent,
encryptionNonce: encNonce,
kdfParams: KDFParams(
memLimit: derivedKeyResult.memLimit,
opsLimit: derivedKeyResult.opsLimit,
salt: Sodium.bin2base64(kekSalt),
),
);
// get json value of data
_exportCodes(context, jsonEncode(data.toJson()));
} catch (e, s) {
Logger("ExportWidget").severe(e, s);
showToast(context, "Error while exporting codes.");
}
}
},
);
}
Future<void> _showExportWarningDialog(BuildContext context) async {
await showChoiceActionSheet(
context,
title: context.l10n.warning,
body: context.l10n.exportWarningDesc,
isCritical: true,
firstButtonOnTap: () async {
final data = await _getAuthDataForExport();
await _exportCodes(context, data);
},
secondButtonLabel: context.l10n.cancel,
firstButtonLabel: context.l10n.iUnderStand,
);
}
Future<void> _exportCodes(BuildContext context, String fileContent) async {
final _codeFile = File(
Configuration.instance.getTempDirectory() + "ente-authenticator-codes.txt",
);
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(context, context.l10n.authToExportCodes);
if (!hasAuthenticated) {
return;
}
if (_codeFile.existsSync()) {
await _codeFile.delete();
}
_codeFile.writeAsStringSync(fileContent);
final Size size = MediaQuery.of(context).size;
await Share.shareFiles([_codeFile.path], sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2),);
Future.delayed(const Duration(seconds: 15), () async {
if (_codeFile.existsSync()) {
_codeFile.deleteSync();
}
});
}
Future<String> _getAuthDataForExport() async {
final codes = await CodeStore.instance.getAllCodes();
String data = "";
for (final code in codes) {
data += code.rawData + "\n";
}
return data;
}

View File

@@ -0,0 +1,236 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';
import 'package:convert/convert.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/services/authenticator_service.dart';
import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/ui/common/progress_dialog.dart';
import 'package:ente_auth/ui/components/buttons/button_widget.dart';
import 'package:ente_auth/ui/components/dialog_widget.dart';
import 'package:ente_auth/ui/components/models/button_type.dart';
import 'package:ente_auth/ui/settings/data/import/import_success.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:pointycastle/block/aes.dart';
import 'package:pointycastle/block/modes/gcm.dart';
import 'package:pointycastle/key_derivators/scrypt.dart';
import 'package:pointycastle/pointycastle.dart';
Future<void> showAegisImportInstruction(BuildContext context) async {
final l10n = context.l10n;
final result = await showDialogWidget(
context: context,
title: l10n.importFromApp("Aegis Authenticator"),
body: l10n.importAegisGuide,
buttons: [
ButtonWidget(
buttonType: ButtonType.primary,
labelText: l10n.importSelectJsonFile,
isInAlert: true,
buttonSize: ButtonSize.large,
buttonAction: ButtonAction.first,
),
ButtonWidget(
buttonType: ButtonType.secondary,
labelText: context.l10n.cancel,
buttonSize: ButtonSize.large,
isInAlert: true,
buttonAction: ButtonAction.second,
),
],
);
if (result?.action != null && result!.action != ButtonAction.cancel) {
if (result.action == ButtonAction.first) {
await _pickAegisJsonFile(context);
} else {}
}
}
Future<void> _pickAegisJsonFile(BuildContext context) async {
final l10n = context.l10n;
FilePickerResult? result = await FilePicker.platform
.pickFiles(dialogTitle: l10n.importSelectJsonFile);
if (result == null) {
return;
}
final ProgressDialog progressDialog =
createProgressDialog(context, l10n.pleaseWait);
await progressDialog.show();
try {
String path = result.files.single.path!;
int? count = await _processAegisExportFile(context, path, progressDialog);
await progressDialog.hide();
if (count != null) {
await importSuccessDialog(context, count);
}
} catch (e, s) {
Logger('AegisImport').severe('exception while processing for aegis', e, s);
await progressDialog.hide();
await showErrorDialog(
context,
context.l10n.sorry,
context.l10n.importFailureDesc,
);
}
}
Future<int?> _processAegisExportFile(
BuildContext context,
String path,
final ProgressDialog dialog,
) async {
File file = File(path);
final jsonString = await file.readAsString();
final decodedJson = jsonDecode(jsonString);
final isEncrypted = decodedJson['header']['slots'] != null;
var aegisDB;
if (isEncrypted) {
String? password;
try {
await showTextInputDialog(
context,
title: "Enter password to aegis vault",
submitButtonLabel: "Submit",
isPasswordInput: true,
onSubmit: (value) async {
password = value;
},
);
if (password == null) {
await dialog.hide();
return null;
}
final content = decryptAegisVault(decodedJson, password: password!);
aegisDB = jsonDecode(content);
} catch (e, s) {
Logger("AegisImport")
.warning("exception while decrypting aegis vault", e, s);
await dialog.hide();
if (password != null) {
await showErrorDialog(
context,
"Failed to decrypt aegis vault",
"Please check your password and try again.",
);
}
return null;
}
} else {
aegisDB = decodedJson['db'];
}
final parsedCodes = [];
for (var item in aegisDB['entries']) {
var kind = item['type'];
var account = item['name'];
var issuer = item['issuer'];
var algorithm = item['info']['algo'];
var secret = item['info']['secret'];
var timer = item['info']['period'];
var digits = item['info']['digits'];
var counter = item['info']['counter'];
// Build the OTP URL
String otpUrl;
if (kind.toLowerCase() == 'totp') {
otpUrl =
'otpauth://$kind/$issuer:$account?secret=$secret&issuer=$issuer&algorithm=$algorithm&digits=$digits&period=$timer';
} else if (kind.toLowerCase() == 'hotp') {
otpUrl =
'otpauth://$kind/$issuer:$account?secret=$secret&issuer=$issuer&algorithm=$algorithm&digits=$digits&counter=$counter';
} else {
throw Exception('Invalid OTP type');
}
parsedCodes.add(Code.fromRawData(otpUrl));
}
for (final code in parsedCodes) {
await CodeStore.instance.addCode(code, shouldSync: false);
}
unawaited(AuthenticatorService.instance.onlineSync());
int count = parsedCodes.length;
return count;
}
String decryptAegisVault(dynamic data, {required String password}) {
final header = data["header"];
final slots =
(header["slots"] as List).where((slot) => slot["type"] == 1).toList();
Uint8List? masterKey;
for (final slot in slots) {
final salt = Uint8List.fromList(hex.decode(slot["salt"]));
final int iterations = slot["n"];
final int r = slot["r"];
final int p = slot["p"];
const int derivedKeyLength = 32;
final script = Scrypt()
..init(
ScryptParameters(
iterations,
r,
p,
derivedKeyLength,
salt,
),
);
final key = script.process(Uint8List.fromList(utf8.encode(password)));
final params = slot["key_params"];
final nonce = Uint8List.fromList(hex.decode(params["nonce"]));
final encryptedKeyWithTag =
Uint8List.fromList(hex.decode(slot["key"]) + hex.decode(params["tag"]));
final cipher = GCMBlockCipher(AESEngine())
..init(
false,
AEADParameters(
KeyParameter(key),
128,
nonce,
Uint8List.fromList(<int>[]),
),
);
try {
masterKey = cipher.process(encryptedKeyWithTag);
break;
} catch (e) {
// Ignore decryption failure and continue to next slot
}
}
if (masterKey == null) {
throw Exception("Unable to decrypt the master key with the given password");
}
final content = base64.decode(data["db"]);
final params = header["params"];
final nonce = Uint8List.fromList(hex.decode(params["nonce"]));
final tag = Uint8List.fromList(hex.decode(params["tag"]));
final cipherTextWithTag = Uint8List.fromList(content + tag);
final cipher = GCMBlockCipher(AESEngine())
..init(
false,
AEADParameters(
KeyParameter(masterKey),
128,
nonce,
Uint8List.fromList(<int>[]),
),
);
final dbBytes = cipher.process(cipherTextWithTag);
return utf8.decode(dbBytes);
}

View File

@@ -0,0 +1,157 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/models/export/ente.dart';
import 'package:ente_auth/services/authenticator_service.dart';
import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/ui/components/buttons/button_widget.dart';
import 'package:ente_auth/ui/components/dialog_widget.dart';
import 'package:ente_auth/ui/components/models/button_type.dart';
import 'package:ente_auth/ui/settings/data/import/import_success.dart';
import 'package:ente_auth/utils/crypto_util.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:ente_auth/utils/toast_util.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_sodium/flutter_sodium.dart';
import 'package:logging/logging.dart';
Future<void> showEncryptedImportInstruction(BuildContext context) async {
final l10n = context.l10n;
final result = await showDialogWidget(
context: context,
title: l10n.importFromApp("ente Auth"),
body: l10n.importEnteEncGuide,
buttons: [
ButtonWidget(
buttonType: ButtonType.primary,
labelText: l10n.importSelectJsonFile,
isInAlert: true,
buttonSize: ButtonSize.large,
buttonAction: ButtonAction.first,
),
ButtonWidget(
buttonType: ButtonType.secondary,
labelText: context.l10n.cancel,
buttonSize: ButtonSize.large,
isInAlert: true,
buttonAction: ButtonAction.second,
),
],
);
if (result?.action != null && result!.action != ButtonAction.cancel) {
if (result.action == ButtonAction.first) {
await _pickEnteJsonFile(context);
} else {}
}
}
Future<void> _decryptExportData(
BuildContext context,
EnteAuthExport enteAuthExport, {
String? password,
}) async {
final l10n = context.l10n;
bool isPasswordIncorrect = false;
int? importedCodeCount;
await showTextInputDialog(
context,
title: l10n.passwordForDecryptingExport,
submitButtonLabel: l10n.importLabel,
hintText: l10n.enterYourPasswordHint,
isPasswordInput: true,
alwaysShowSuccessState: false,
showOnlyLoadingState: true,
onSubmit: (String password) async {
if (password.isEmpty) {
showToast(context, l10n.passwordEmptyError);
Future.delayed(const Duration(seconds: 0), () {
_decryptExportData(context, enteAuthExport, password: password);
});
return;
}
if (password.isNotEmpty) {
final progressDialog = createProgressDialog(context, l10n.pleaseWait);
try {
await progressDialog.show();
final derivedKey = await CryptoUtil.deriveKey(
utf8.encode(password) as Uint8List,
Sodium.base642bin(enteAuthExport.kdfParams.salt),
enteAuthExport.kdfParams.memLimit,
enteAuthExport.kdfParams.opsLimit,
);
Uint8List? decryptedContent;
// Encrypt the key with this derived key
try {
decryptedContent = await CryptoUtil.decryptChaCha(
Sodium.base642bin(enteAuthExport.encryptedData),
derivedKey,
Sodium.base642bin(enteAuthExport.encryptionNonce),
);
} catch (e,s) {
Logger("encryptedImport").warning('failed to decrypt',e,s);
showToast(context, l10n.incorrectPasswordTitle);
isPasswordIncorrect = true;
}
if (isPasswordIncorrect) {
await progressDialog.hide();
Future.delayed(const Duration(seconds: 0), () {
_decryptExportData(context, enteAuthExport, password: password);
});
return;
}
String content = utf8.decode(decryptedContent!);
List<String> splitCodes = content.split("\n");
final parsedCodes = [];
for (final code in splitCodes) {
try {
parsedCodes.add(Code.fromRawData(code));
} catch (e) {
Logger('EncryptedText').severe("Could not parse code", e);
}
}
for (final code in parsedCodes) {
await CodeStore.instance.addCode(code, shouldSync: false);
}
unawaited(AuthenticatorService.instance.onlineSync());
importedCodeCount = parsedCodes.length;
await progressDialog.hide();
} catch (e, s) {
await progressDialog.hide();
Logger("ExportWidget").severe(e, s);
showToast(context, "Error while exporting codes.");
}
}
},
);
if (importedCodeCount != null) {
await importSuccessDialog(context, importedCodeCount!);
}
}
Future<void> _pickEnteJsonFile(BuildContext context) async {
FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result == null) {
return;
}
try {
File file = File(result.files.single.path!);
final jsonString = await file.readAsString();
EnteAuthExport exportedData =
EnteAuthExport.fromJson(jsonDecode(jsonString));
await _decryptExportData(context, exportedData);
} catch (e) {
await showErrorDialog(
context,
context.l10n.sorry,
context.l10n.importFailureDesc,
);
}
}

View File

@@ -0,0 +1,132 @@
import 'dart:async';
import 'dart:convert';
import 'dart:typed_data';
import 'package:base32/base32.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/models/protos/googleauth.pb.dart';
import 'package:ente_auth/services/authenticator_service.dart';
import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/ui/components/buttons/button_widget.dart';
import 'package:ente_auth/ui/components/dialog_widget.dart';
import 'package:ente_auth/ui/components/models/button_type.dart';
import 'package:ente_auth/ui/scanner_gauth_page.dart';
import 'package:ente_auth/ui/settings/data/import/import_success.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
const kGoogleAuthExportPrefix = 'otpauth-migration://offline?data=';
Future<void> showGoogleAuthInstruction(BuildContext context) async {
final l10n = context.l10n;
final result = await showDialogWidget(
context: context,
title: l10n.importFromApp("Google Authenticator"),
body: l10n.importGoogleAuthGuide,
buttons: [
ButtonWidget(
buttonType: ButtonType.primary,
labelText: l10n.scanAQrCode,
isInAlert: true,
buttonSize: ButtonSize.large,
buttonAction: ButtonAction.first,
),
ButtonWidget(
buttonType: ButtonType.secondary,
labelText: context.l10n.cancel,
buttonSize: ButtonSize.large,
isInAlert: true,
buttonAction: ButtonAction.second,
),
],
);
if (result?.action != null && result!.action != ButtonAction.cancel) {
if (result.action == ButtonAction.first) {
final List<Code>? codes = await Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return const ScannerGoogleAuthPage();
},
),
);
if (codes == null || codes.isEmpty) {
return;
}
for (final code in codes) {
await CodeStore.instance.addCode(code, shouldSync: false);
}
unawaited(AuthenticatorService.instance.onlineSync());
importSuccessDialog(context, codes.length);
}
}
}
List<Code> parseGoogleAuth(String qrCodeData) {
try {
List<Code> codes = <Code>[];
final String payload = qrCodeData.substring(kGoogleAuthExportPrefix.length);
final Uint8List base64Decoded = base64Decode(Uri.decodeComponent(payload));
final MigrationPayload mPayload =
MigrationPayload.fromBuffer(base64Decoded);
for (var otpParameter in mPayload.otpParameters) {
// Build the OTP URL
String otpUrl;
String issuer = otpParameter.issuer;
String account = otpParameter.name;
var counter = otpParameter.counter;
// Create a list of bytes from the list of integers.
Uint8List bytes = Uint8List.fromList(otpParameter.secret);
// Encode the bytes to base 32.
String base32String = base32.encode(bytes);
String secret = base32String;
// identify digit count
int digits = 6;
int timer = 30; // default timer, no field in Google Auth
Algorithm algorithm = Algorithm.sha1;
switch (otpParameter.algorithm) {
case MigrationPayload_Algorithm.ALGORITHM_MD5:
throw Exception('GoogleAuthImport: MD5 is not supported');
case MigrationPayload_Algorithm.ALGORITHM_SHA1:
algorithm = Algorithm.sha1;
break;
case MigrationPayload_Algorithm.ALGORITHM_SHA256:
algorithm = Algorithm.sha256;
break;
case MigrationPayload_Algorithm.ALGORITHM_SHA512:
algorithm = Algorithm.sha512;
break;
case MigrationPayload_Algorithm.ALGORITHM_UNSPECIFIED:
algorithm = Algorithm.sha1;
break;
}
switch (otpParameter.digits) {
case MigrationPayload_DigitCount.DIGIT_COUNT_EIGHT:
digits = 8;
break;
case MigrationPayload_DigitCount.DIGIT_COUNT_SIX:
digits = 6;
break;
case MigrationPayload_DigitCount.DIGIT_COUNT_UNSPECIFIED:
digits = 6;
}
if (otpParameter.type == MigrationPayload_OtpType.OTP_TYPE_TOTP ||
otpParameter.type == MigrationPayload_OtpType.OTP_TYPE_UNSPECIFIED) {
otpUrl =
'otpauth://totp/$issuer:$account?secret=$secret&issuer=$issuer&algorithm=$algorithm&digits=$digits&period=$timer';
} else if (otpParameter.type == MigrationPayload_OtpType.OTP_TYPE_HOTP) {
otpUrl =
'otpauth://hotp/$issuer:$account?secret=$secret&issuer=$issuer&algorithm=$algorithm&digits=$digits&counter=$counter';
} else {
throw Exception('Invalid OTP type');
}
codes.add(Code.fromRawData(otpUrl));
}
return codes;
} catch (e, s) {
Logger("GoogleAuthImport")
.severe("Error while parsing Google Auth QR code", e, s);
throw Exception('Failed to parse Google Auth QR code \n ${e.toString()}');
}
}

View File

@@ -0,0 +1,36 @@
import 'package:ente_auth/ui/settings/data/import/aegis_import.dart';
import 'package:ente_auth/ui/settings/data/import/encrypted_ente_import.dart';
import 'package:ente_auth/ui/settings/data/import/google_auth_import.dart';
import 'package:ente_auth/ui/settings/data/import/plain_text_import.dart';
import 'package:ente_auth/ui/settings/data/import/raivo_plain_text_import.dart';
import 'package:ente_auth/ui/settings/data/import_page.dart';
import 'package:flutter/cupertino.dart';
class ImportService {
static final ImportService _instance = ImportService._internal();
factory ImportService() => _instance;
ImportService._internal();
Future<void> initiateImport(BuildContext context, ImportType type) async {
switch (type) {
case ImportType.plainText:
showImportInstructionDialog(context);
break;
case ImportType.encrypted:
showEncryptedImportInstruction(context);
break;
case ImportType.ravio:
showRaivoImportInstruction(context);
break;
case ImportType.googleAuthenticator:
showGoogleAuthInstruction(context);
// showToast(context, 'coming soon');
break;
case ImportType.aegis:
showAegisImportInstruction(context);
break;
}
}
}

View File

@@ -0,0 +1,26 @@
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/ui/components/dialog_widget.dart';
import 'package:ente_auth/ui/components/models/button_type.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:flutter/cupertino.dart';
Future<void> importSuccessDialog(BuildContext context, int count) async {
final DialogWidget dialog = choiceDialog(
title: context.l10n.importSuccessTitle,
body: context.l10n.importSuccessDesc(count),
firstButtonLabel: context.l10n.ok,
firstButtonOnTap: () async {
Navigator.of(context).pop();
if(Navigator.of(context).canPop()) {
Navigator.of(context).pop();
}
},
firstButtonType: ButtonType.primary,
);
await showConfettiDialog(
context: context,
dialogBuilder: (BuildContext context) {
return dialog;
},
);
}

View File

@@ -0,0 +1,135 @@
import 'dart:async';
import 'dart:io';
import 'dart:ui';
import 'package:ente_auth/ente_theme_data.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/services/authenticator_service.dart';
import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/ui/settings/data/import/import_success.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
class PlainTextImport extends StatelessWidget {
const PlainTextImport({super.key});
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
return Column(
children: [
Text(
l10n.importInstruction,
),
const SizedBox(
height: 20,
),
Container(
color: Theme.of(context).colorScheme.gNavBackgroundColor,
child: Padding(
padding: const EdgeInsets.all(8),
child: Text(
"otpauth://totp/provider.com:you@email.com?secret=YOUR_SECRET",
style: TextStyle(
fontFeatures: const [FontFeature.tabularFigures()],
fontFamily: Platform.isIOS ? "Courier" : "monospace",
fontSize: 13,
),
),
),
),
const SizedBox(
height: 20,
),
Text(l10n.importCodeDelimiterInfo),
],
);
}
}
Future<void> showImportInstructionDialog(BuildContext context) async {
final l10n = context.l10n;
final AlertDialog alert = AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
title: Text(
l10n.importCodes,
style: Theme.of(context).textTheme.titleLarge,
),
content: const SingleChildScrollView(
child: PlainTextImport(),
),
actions: [
TextButton(
child: Text(
l10n.cancel,
style: const TextStyle(
color: Colors.red,
),
),
onPressed: () {
Navigator.of(context, rootNavigator: true).pop('dialog');
},
),
TextButton(
child: Text(l10n.selectFile),
onPressed: () {
Navigator.of(context, rootNavigator: true).pop('dialog');
_pickImportFile(context);
},
),
],
);
return showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
barrierColor: Colors.black12,
);
}
Future<void> _pickImportFile(BuildContext context) async {
final l10n = context.l10n;
FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result == null) {
return;
}
final progressDialog = createProgressDialog(context, l10n.pleaseWait);
await progressDialog.show();
try {
File file = File(result.files.single.path!);
final codes = await file.readAsString();
List<String> splitCodes = codes.split(",");
if (splitCodes.length == 1) {
splitCodes = codes.split("\n");
}
final parsedCodes = [];
for (final code in splitCodes) {
try {
parsedCodes.add(Code.fromRawData(code));
} catch (e) {
Logger('PlainText').severe("Could not parse code", e);
}
}
for (final code in parsedCodes) {
await CodeStore.instance.addCode(code, shouldSync: false);
}
unawaited(AuthenticatorService.instance.onlineSync());
await progressDialog.hide();
await importSuccessDialog(context, parsedCodes.length);
} catch (e) {
await progressDialog.hide();
await showErrorDialog(
context,
context.l10n.sorry,
context.l10n.importFailureDesc,
);
}
}

View File

@@ -0,0 +1,117 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/services/authenticator_service.dart';
import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/ui/components/buttons/button_widget.dart';
import 'package:ente_auth/ui/components/dialog_widget.dart';
import 'package:ente_auth/ui/components/models/button_type.dart';
import 'package:ente_auth/ui/settings/data/import/import_success.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
Future<void> showRaivoImportInstruction(BuildContext context) async {
final l10n = context.l10n;
final result = await showDialogWidget(
context: context,
title: l10n.importFromApp("Raivo OTP"),
body: l10n.importRaivoGuide,
buttons: [
ButtonWidget(
buttonType: ButtonType.primary,
labelText: l10n.importSelectJsonFile,
isInAlert: true,
buttonSize: ButtonSize.large,
buttonAction: ButtonAction.first,
),
ButtonWidget(
buttonType: ButtonType.secondary,
labelText: context.l10n.cancel,
buttonSize: ButtonSize.large,
isInAlert: true,
buttonAction: ButtonAction.second,
),
],
);
if (result?.action != null && result!.action != ButtonAction.cancel) {
if (result.action == ButtonAction.first) {
await _pickRaivoJsonFile(context);
} else {}
}
}
Future<void> _pickRaivoJsonFile(BuildContext context) async {
final l10n = context.l10n;
FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result == null) {
return;
}
final progressDialog = createProgressDialog(context, l10n.pleaseWait);
await progressDialog.show();
try {
String path = result.files.single.path!;
int? count = await _processRaivoExportFile(context, path);
await progressDialog.hide();
if(count != null) {
await importSuccessDialog(context, count);
}
} catch (e) {
await progressDialog.hide();
await showErrorDialog(
context,
context.l10n.sorry,
context.l10n.importFailureDesc,
);
}
}
Future<int?> _processRaivoExportFile(BuildContext context,String path) async {
File file = File(path);
if(path.endsWith('.zip')) {
await showErrorDialog(
context,
context.l10n.sorry,
"We don't support zip files yet. Please unzip the file and try again.",
);
return null;
}
final jsonString = await file.readAsString();
List<dynamic> jsonArray = jsonDecode(jsonString);
final parsedCodes = [];
for (var item in jsonArray) {
var kind = item['kind'];
var algorithm = item['algorithm'];
var timer = item['timer'];
var digits = item['digits'];
var issuer = item['issuer'];
var secret = item['secret'];
var account = item['account'];
var counter = item['counter'];
// Build the OTP URL
String otpUrl;
if (kind.toLowerCase() == 'totp') {
otpUrl =
'otpauth://$kind/$issuer:$account?secret=$secret&issuer=$issuer&algorithm=$algorithm&digits=$digits&period=$timer';
} else if (kind.toLowerCase() == 'hotp') {
otpUrl =
'otpauth://$kind/$issuer:$account?secret=$secret&issuer=$issuer&algorithm=$algorithm&digits=$digits&counter=$counter';
} else {
throw Exception('Invalid OTP type');
}
parsedCodes.add(Code.fromRawData(otpUrl));
}
for (final code in parsedCodes) {
await CodeStore.instance.addCode(code, shouldSync: false);
}
unawaited(AuthenticatorService.instance.onlineSync());
int count = parsedCodes.length;
return count;
}

View File

@@ -0,0 +1,118 @@
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/components/buttons/icon_button_widget.dart';
import 'package:ente_auth/ui/components/captioned_text_widget.dart';
import 'package:ente_auth/ui/components/divider_widget.dart';
import 'package:ente_auth/ui/components/menu_item_widget.dart';
import 'package:ente_auth/ui/components/title_bar_title_widget.dart';
import 'package:ente_auth/ui/components/title_bar_widget.dart';
import 'package:ente_auth/ui/settings/data/import/import_service.dart';
import 'package:flutter/material.dart';
enum ImportType {
plainText,
encrypted,
ravio,
googleAuthenticator,
aegis,
}
class ImportCodePage extends StatelessWidget {
late List<ImportType> importOptions = [
ImportType.plainText,
ImportType.encrypted,
ImportType.ravio,
ImportType.aegis,
ImportType.googleAuthenticator,
];
ImportCodePage({super.key});
String getTitle(BuildContext context, ImportType type) {
switch (type) {
case ImportType.plainText:
return context.l10n.importTypePlainText;
case ImportType.encrypted:
return context.l10n.importTypeEnteEncrypted;
case ImportType.ravio:
return 'Raivo OTP';
case ImportType.googleAuthenticator:
return 'Google Authenticator';
case ImportType.aegis:
return 'Aegis Authenticator';
}
}
@override
Widget build(BuildContext context) {
return Material(
color: Colors.transparent,
child: Scaffold(
body: CustomScrollView(
primary: false,
slivers: <Widget>[
TitleBarWidget(
flexibleSpaceTitle: TitleBarTitleWidget(
title: context.l10n.importCodes,
),
flexibleSpaceCaption: "Import source",
actionIcons: [
IconButtonWidget(
icon: Icons.close_outlined,
iconButtonType: IconButtonType.secondary,
onTap: () {
Navigator.pop(context);
if(Navigator.canPop(context)) {
Navigator.pop(context);
}
},
),
],
),
SliverList(
delegate: SliverChildBuilderDelegate(
(delegateBuildContext, index) {
final type = importOptions[index];
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
children: [
if (index == 0)
const SizedBox(
height: 24,
),
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: getTitle(context, type),
),
alignCaptionedTextToLeft: true,
menuItemColor: getEnteColorScheme(context).fillFaint,
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
isBottomBorderRadiusRemoved:
index != importOptions.length - 1,
isTopBorderRadiusRemoved: index != 0,
onTap: () async {
ImportService().initiateImport(context, type);
// routeToPage(context, ImportCodePage());
// _showImportInstructionDialog(context);
},
),
if (index != importOptions.length - 1)
DividerWidget(
dividerType: DividerType.menu,
bgColor: getEnteColorScheme(context).fillFaint,
),
],
),
);
},
childCount: importOptions.length,
),
),
],
),
),
);
}
}

View File

@@ -1,267 +0,0 @@
import 'dart:async';
import 'dart:io';
import 'dart:ui';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/ente_theme_data.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/code.dart';
import 'package:ente_auth/services/authenticator_service.dart';
import 'package:ente_auth/services/local_authentication_service.dart';
import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/components/captioned_text_widget.dart';
import 'package:ente_auth/ui/components/dialog_widget.dart';
import 'package:ente_auth/ui/components/expandable_menu_item_widget.dart';
import 'package:ente_auth/ui/components/menu_item_widget.dart';
import 'package:ente_auth/ui/components/models/button_type.dart';
import 'package:ente_auth/ui/settings/common_settings.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import 'package:share_plus/share_plus.dart';
class DataSectionWidget extends StatelessWidget {
final _logger = Logger("AccountSectionWidget");
final _codeFile = File(
Configuration.instance.getTempDirectory() + "ente-authenticator-codes.txt",
);
DataSectionWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
return ExpandableMenuItemWidget(
title: l10n.data,
selectionOptionsWidget: _getSectionOptions(context),
leadingIcon: Icons.key_outlined,
);
}
Column _getSectionOptions(BuildContext context) {
final l10n = context.l10n;
List<Widget> children = [];
children.addAll([
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.importCodes,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
_showImportInstructionDialog(context);
},
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.exportCodes,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
_showExportWarningDialog(context);
},
),
sectionOptionSpacing,
]);
return Column(
children: children,
);
}
Future<void> _showImportInstructionDialog(BuildContext context) async {
final l10n = context.l10n;
final AlertDialog alert = AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
title: Text(
l10n.importCodes,
style: Theme.of(context).textTheme.headline6,
),
content: SingleChildScrollView(
child: Column(
children: [
Text(
l10n.importInstruction,
),
const SizedBox(
height: 20,
),
Container(
color: Theme.of(context).colorScheme.gNavBackgroundColor,
child: Padding(
padding: const EdgeInsets.all(8),
child: Text(
"otpauth://totp/provider.com:you@email.com?secret=YOUR_SECRET",
style: TextStyle(
fontFeatures: const [FontFeature.tabularFigures()],
fontFamily: Platform.isIOS ? "Courier" : "monospace",
fontSize: 13,
),
),
),
),
const SizedBox(
height: 20,
),
Text(l10n.importCodeDelimiterInfo),
],
),
),
actions: [
TextButton(
child: Text(
l10n.cancel,
style: const TextStyle(
color: Colors.red,
),
),
onPressed: () {
Navigator.of(context, rootNavigator: true).pop('dialog');
},
),
TextButton(
child: Text(l10n.selectFile),
onPressed: () {
Navigator.of(context, rootNavigator: true).pop('dialog');
_pickImportFile(context);
},
),
],
);
return showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
barrierColor: Colors.black12,
);
}
Future<void> _showExportWarningDialog(BuildContext context) async {
final AlertDialog alert = AlertDialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
title: Text(
context.l10n.warning,
style: Theme.of(context).textTheme.headline6,
),
content: Text(
context.l10n.exportWarningDesc,
),
actions: [
TextButton(
child: Text(
context.l10n.iUnderStand,
style: const TextStyle(
color: Colors.red,
),
),
onPressed: () {
Navigator.of(context, rootNavigator: true).pop('dialog');
_exportCodes(context);
},
),
TextButton(
child: Text(
context.l10n.cancel,
),
onPressed: () {
Navigator.of(context, rootNavigator: true).pop('dialog');
},
),
],
);
return showDialog(
context: context,
builder: (BuildContext context) {
return alert;
},
barrierColor: Colors.black12,
);
}
Future<void> _exportCodes(BuildContext context) async {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(context, context.l10n.authToExportCodes);
if (!hasAuthenticated) {
return;
}
if (_codeFile.existsSync()) {
await _codeFile.delete();
}
final codes = await CodeStore.instance.getAllCodes();
String data = "";
for (final code in codes) {
data += code.rawData + "\n";
}
_codeFile.writeAsStringSync(data);
await Share.shareFiles([_codeFile.path]);
Future.delayed(const Duration(seconds: 15), () async {
if (_codeFile.existsSync()) {
_codeFile.deleteSync();
}
});
}
Future<void> _pickImportFile(BuildContext context) async {
final l10n = context.l10n;
FilePickerResult? result = await FilePicker.platform.pickFiles();
if (result == null) {
return;
}
final dialog = createProgressDialog(context, l10n.pleaseWait);
await dialog.show();
try {
File file = File(result.files.single.path!);
final codes = await file.readAsString();
List<String> splitCodes = codes.split(",");
if (splitCodes.length == 1) {
splitCodes = codes.split("\n");
}
final parsedCodes = [];
for (final code in splitCodes) {
try {
parsedCodes.add(Code.fromRawData(code));
} catch (e) {
_logger.severe("Could not parse code", e);
}
}
for (final code in parsedCodes) {
await CodeStore.instance.addCode(code, shouldSync: false);
}
unawaited(AuthenticatorService.instance.sync());
final DialogWidget dialog = choiceDialog(
title: context.l10n.importSuccessTitle,
body: context.l10n.importSuccessDesc(parsedCodes.length),
// body: "You have imported " + parsedCodes.length.toString() + " codes!",
firstButtonLabel: l10n.ok,
firstButtonOnTap: () async {
Navigator.of(context, rootNavigator: true).pop('dialog');
},
firstButtonType: ButtonType.primary,
);
await showConfettiDialog(
context: context,
dialogBuilder: (BuildContext context) {
return dialog;
},
);
} catch (e) {
await dialog.hide();
await showErrorDialog(
context,
context.l10n.sorry,
context.l10n.importFailureDesc,
);
}
}
}

124
lib/ui/settings/faq.dart Normal file
View File

@@ -0,0 +1,124 @@
import 'dart:convert';
import 'package:ente_auth/ente_theme_data.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/ui/common/loading_widget.dart';
import 'package:expansion_tile_card/expansion_tile_card.dart';
import 'package:flutter/material.dart';
class FAQQuestionsWidget extends StatelessWidget {
const FAQQuestionsWidget({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return FutureBuilder<List<FaqItem>>(
future: Future.value(_getFAQs(context)),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasData) {
final faqs = <Widget>[];
faqs.add(
Padding(
padding: const EdgeInsets.all(24),
child: Text(
context.l10n.faq,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
),
);
for (final faq in snapshot.data) {
faqs.add(FaqWidget(faq: faq));
}
faqs.add(
const Padding(
padding: EdgeInsets.all(16),
),
);
return SingleChildScrollView(
child: Column(
children: faqs,
),
);
} else {
return const EnteLoadingWidget();
}
},
);
}
List<FaqItem> _getFAQs(BuildContext context) {
final l01n = context.l10n;
List<FaqItem> faqs = [];
faqs.add(FaqItem(q: l01n.faq_q_1, a: l01n.faq_a_1));
faqs.add(FaqItem(q: l01n.faq_q_2, a: l01n.faq_a_2));
faqs.add(FaqItem(q: l01n.faq_q_3, a: l01n.faq_a_3));
faqs.add(FaqItem(q: l01n.faq_q_4, a: l01n.faq_a_4));
faqs.add(FaqItem(q: l01n.faq_q_5, a: l01n.faq_a_5));
return faqs;
}
}
class FaqWidget extends StatelessWidget {
const FaqWidget({
Key? key,
required this.faq,
}) : super(key: key);
final FaqItem? faq;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(2),
child: ExpansionTileCard(
elevation: 0,
title: Text(faq!.q),
expandedTextColor: Theme.of(context).colorScheme.alternativeColor,
baseColor: Theme.of(context).cardColor,
children: [
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.only(
left: 16,
right: 16,
bottom: 12,
),
child: Text(
faq!.a,
style: const TextStyle(
height: 1.5,
),
),
),
)
],
),
);
}
}
class FaqItem {
final String q;
final String a;
FaqItem({
required this.q,
required this.a,
});
factory FaqItem.fromMap(Map<String, dynamic> map) {
return FaqItem(
q: map['q'] ?? 'q',
a: map['a'] ?? 'a',
);
}
factory FaqItem.fromJson(String source) =>
FaqItem.fromMap(json.decode(source));
}

View File

@@ -0,0 +1,111 @@
import 'package:ente_auth/app/view/app.dart';
import 'package:ente_auth/core/logging/super_logging.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/locale.dart';
import 'package:ente_auth/services/preference_service.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/components/captioned_text_widget.dart';
import 'package:ente_auth/ui/components/expandable_menu_item_widget.dart';
import 'package:ente_auth/ui/components/menu_item_widget.dart';
import 'package:ente_auth/ui/components/toggle_switch_widget.dart';
import 'package:ente_auth/ui/settings/common_settings.dart';
import 'package:ente_auth/ui/settings/language_picker.dart';
import 'package:ente_auth/utils/navigation_util.dart';
import 'package:flutter/material.dart';
class AdvancedSectionWidget extends StatefulWidget {
const AdvancedSectionWidget({Key? key}) : super(key: key);
@override
State<AdvancedSectionWidget> createState() => _AdvancedSectionWidgetState();
}
class _AdvancedSectionWidgetState extends State<AdvancedSectionWidget> {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
return ExpandableMenuItemWidget(
title: l10n.general,
selectionOptionsWidget: _getSectionOptions(context),
leadingIcon: Icons.graphic_eq,
);
}
Widget _getSectionOptions(BuildContext context) {
final l10n = context.l10n;
return Column(
children: [
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.language,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
final locale = await getLocale();
routeToPage(
context,
LanguageSelectorPage(
appSupportedLocales,
(locale) async {
await setLocale(locale);
App.setLocale(context, locale);
},
locale,
),
);
},
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.showLargeIcons,
),
trailingWidget: ToggleSwitchWidget(
value: () => PreferenceService.instance.shouldShowLargeIcons(),
onChanged: () async {
await PreferenceService.instance.setShowLargeIcons(
!PreferenceService.instance.shouldShowLargeIcons(),
);
setState(() {});
},
),
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.focusOnSearchBar,
),
trailingWidget: ToggleSwitchWidget(
value: () =>
PreferenceService.instance.shouldAutoFocusOnSearchBar(),
onChanged: () async {
await PreferenceService.instance.setAutoFocusOnSearchBar(
!PreferenceService.instance.shouldAutoFocusOnSearchBar(),
);
setState(() {});
},
),
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.crashAndErrorReporting,
),
trailingWidget: ToggleSwitchWidget(
value: () => SuperLogging.shouldReportErrors(),
onChanged: () async {
await SuperLogging.setShouldReportErrors(
!SuperLogging.shouldReportErrors(),
);
setState(() {});
},
),
),
sectionOptionSpacing,
],
);
}
}

View File

@@ -1,14 +1,26 @@
import 'dart:async';
import 'dart:typed_data';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/user_details.dart';
import 'package:ente_auth/services/local_authentication_service.dart';
import 'package:ente_auth/services/user_service.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/account/recovery_key_page.dart';
import 'package:ente_auth/ui/account/request_pwd_verification_page.dart';
import 'package:ente_auth/ui/account/sessions_page.dart';
import 'package:ente_auth/ui/components/captioned_text_widget.dart';
import 'package:ente_auth/ui/components/expandable_menu_item_widget.dart';
import 'package:ente_auth/ui/components/menu_item_widget.dart';
import 'package:ente_auth/ui/components/toggle_switch_widget.dart';
import 'package:ente_auth/ui/settings/common_settings.dart';
import 'package:ente_auth/utils/crypto_util.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:ente_auth/utils/navigation_util.dart';
import 'package:ente_auth/utils/toast_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter_sodium/flutter_sodium.dart';
class SecuritySectionWidget extends StatefulWidget {
const SecuritySectionWidget({Key? key}) : super(key: key);
@@ -19,9 +31,11 @@ class SecuritySectionWidget extends StatefulWidget {
class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
final _config = Configuration.instance;
late bool _hasLoggedIn;
@override
void initState() {
_hasLoggedIn = _config.hasConfiguredAccount();
super.initState();
}
@@ -43,6 +57,100 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
Widget _getSectionOptions(BuildContext context) {
final l10n = context.l10n;
final List<Widget> children = [];
if (_hasLoggedIn) {
final bool? canDisableMFA = UserService.instance.canDisableEmailMFA();
if (canDisableMFA == null) {
// We don't know if the user can disable MFA yet, so we fetch the info
UserService.instance.getUserDetailsV2().ignore();
}
children.addAll([
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.recoveryKey,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
l10n.authToViewYourRecoveryKey,
);
if (hasAuthenticated) {
String recoveryKey;
try {
recoveryKey =
Sodium.bin2hex(Configuration.instance.getRecoveryKey());
} catch (e) {
showGenericErrorDialog(context: context);
return;
}
routeToPage(
context,
RecoveryKeyPage(
recoveryKey,
l10n.ok,
showAppBar: true,
onDone: () {},
),
);
}
},
),
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.emailVerificationToggle,
),
trailingWidget: ToggleSwitchWidget(
value: () => UserService.instance.hasEmailMFAEnabled(),
onChanged: () async {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
l10n.authToChangeEmailVerificationSetting,
);
final isEmailMFAEnabled =
UserService.instance.hasEmailMFAEnabled();
if (hasAuthenticated) {
await updateEmailMFA(!isEmailMFAEnabled);
if (mounted) {
setState(() {});
}
}
},
),
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: context.l10n.viewActiveSessions,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
context.l10n.authToViewYourActiveSessions,
);
if (hasAuthenticated) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return const SessionsPage();
},
),
);
}
},
),
]);
} else {
children.add(sectionOptionSpacing);
}
children.addAll([
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
@@ -65,34 +173,31 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
),
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: context.l10n.viewActiveSessions,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
context,
context.l10n.authToViewYourActiveSessions,
);
if (hasAuthenticated) {
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return const SessionsPage();
},
),
);
}
},
),
sectionOptionSpacing,
]);
return Column(
children: children,
);
}
Future<void> updateEmailMFA(bool isEnabled) async {
try {
final UserDetails details =
await UserService.instance.getUserDetailsV2(memoryCount: false);
if (details.profileData?.canDisableEmailMFA == false) {
await routeToPage(
context,
RequestPasswordVerificationPage(
onPasswordVerified: (Uint8List keyEncryptionKey) async {
final Uint8List loginKey =
await CryptoUtil.deriveLoginKey(keyEncryptionKey);
await UserService.instance.registerOrUpdateSrp(loginKey);
},
),
);
}
await UserService.instance.updateEmailMFA(isEnabled);
} catch (e) {
showToast(context, context.l10n.somethingWentWrongMessage);
}
}
}

View File

@@ -24,9 +24,9 @@ class SettingsSectionTitle extends StatelessWidget {
style: color != null
? Theme.of(context)
.textTheme
.headline6!
.titleLarge!
.merge(TextStyle(color: color))
: Theme.of(context).textTheme.headline6,
: Theme.of(context).textTheme.titleLarge,
),
),
const Padding(padding: EdgeInsets.all(4)),

View File

@@ -23,7 +23,7 @@ class SettingsTextItem extends StatelessWidget {
children: [
Align(
alignment: Alignment.centerLeft,
child: Text(text, style: Theme.of(context).textTheme.subtitle1),
child: Text(text, style: Theme.of(context).textTheme.titleMedium),
),
Icon(icon),
],

View File

@@ -1,4 +1,7 @@
import 'dart:io';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/services/update_service.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/components/captioned_text_widget.dart';
import 'package:ente_auth/ui/components/expandable_menu_item_widget.dart';
@@ -21,8 +24,26 @@ class SocialSectionWidget extends StatelessWidget {
}
Widget _getSectionOptions(BuildContext context) {
final l10n = context.l10n;
final result = UpdateService.instance.getRateDetails();
final String ratePlace = result.item1;
final String rateUrl = result.item2;
final List<Widget> options = [
sectionOptionSpacing,
SocialsMenuItemWidget(l10n.rateUsOnStore(ratePlace), rateUrl),
sectionOptionSpacing,
SocialsMenuItemWidget(
l10n.blog,
"https://ente.io/blog",
launchInExternalApp: !Platform.isAndroid,
),
sectionOptionSpacing,
SocialsMenuItemWidget(
l10n.merchandise,
"https://shop.ente.io",
launchInExternalApp: !Platform.isAndroid,
),
const SocialsMenuItemWidget("Mastodon", "https://mstdn.social/@ente/"),
sectionOptionSpacing,
const SocialsMenuItemWidget("Twitter", "https://twitter.com/enteio"),
@@ -40,9 +61,15 @@ class SocialSectionWidget extends StatelessWidget {
class SocialsMenuItemWidget extends StatelessWidget {
final String text;
final String urlSring;
const SocialsMenuItemWidget(this.text, this.urlSring, {Key? key})
: super(key: key);
final String url;
final bool launchInExternalApp;
const SocialsMenuItemWidget(
this.text,
this.url, {
Key? key,
this.launchInExternalApp = true,
}) : super(key: key);
@override
Widget build(BuildContext context) {
@@ -54,7 +81,12 @@ class SocialsMenuItemWidget extends StatelessWidget {
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
launchUrlString(urlSring);
launchUrlString(
url,
mode: launchInExternalApp
? LaunchMode.externalApplication
: LaunchMode.platformDefault,
);
},
);
}

View File

@@ -1,5 +1,6 @@
import 'dart:io';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/subscription.dart';
import 'package:ente_auth/services/billing_service.dart';
@@ -18,50 +19,56 @@ class SupportDevWidget extends StatelessWidget {
final l10n = context.l10n;
// fetch
return FutureBuilder<Subscription>(
future: BillingService.instance.getSubscription(),
builder: (context, snapshot) {
if (snapshot.hasData) {
final subscription = snapshot.data;
if (subscription != null && subscription.productID != "free") {
return GestureDetector(
onTap: () {
launchUrl(Uri.parse("https://ente.io"));
},
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 12.0, horizontal: 6),
child: Column(
children: [
StyledText(
text: l10n.supportDevs,
tags: {
'bold-green': StyledTextTag(
style: TextStyle(
fontWeight: FontWeight.bold,
color: getEnteColorScheme(context).primaryGreen,
),
),
},
),
const Padding(padding: EdgeInsets.all(6)),
Platform.isAndroid
? Text(
l10n.supportDiscount,
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.grey,
),
)
: const SizedBox.shrink(),
],
),
),
);
if (Configuration.instance.hasConfiguredAccount()) {
return FutureBuilder<Subscription>(
future: BillingService.instance.getSubscription(),
builder: (context, snapshot) {
if (snapshot.hasData) {
final subscription = snapshot.data;
if (subscription != null && subscription.productID == "free") {
return buildWidget(l10n, context);
}
}
}
return const SizedBox.shrink();
return const SizedBox.shrink();
},
);
} else {
return buildWidget(l10n, context);
}
}
GestureDetector buildWidget(AppLocalizations l10n, BuildContext context) {
return GestureDetector(
onTap: () {
launchUrl(Uri.parse("https://ente.io"));
},
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 6),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
StyledText(
text: l10n.supportDevs,
style: getEnteTextTheme(context).large,
tags: {
'bold-green': StyledTextTag(
style: TextStyle(
fontWeight: FontWeight.bold,
color: getEnteColorScheme(context).primaryGreen,
),
),
},
),
const Padding(padding: EdgeInsets.all(6)),
Text(
l10n.supportDiscount,
style: const TextStyle(
color: Colors.grey,
),
),
],
),
),
);
}
}

View File

@@ -1,14 +1,14 @@
import 'package:ente_auth/core/constants.dart';
import 'package:ente_auth/core/logging/super_logging.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/components/captioned_text_widget.dart';
import 'package:ente_auth/ui/components/expandable_menu_item_widget.dart';
import 'package:ente_auth/ui/components/menu_item_widget.dart';
import 'package:ente_auth/ui/components/toggle_switch_widget.dart';
import 'package:ente_auth/ui/settings/common_settings.dart';
import 'package:ente_auth/ui/settings/faq.dart';
import 'package:ente_auth/utils/email_util.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher_string.dart';
class SupportSectionWidget extends StatefulWidget {
const SupportSectionWidget({Key? key}) : super(key: key);
@@ -32,6 +32,40 @@ class _SupportSectionWidgetState extends State<SupportSectionWidget> {
final l10n = context.l10n;
return Column(
children: [
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.faq,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
showModalBottomSheet<void>(
backgroundColor: Theme.of(context).colorScheme.background,
barrierColor: Colors.black87,
context: context,
builder: (context) {
return const FAQQuestionsWidget();
},
);
},
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.suggestFeatures,
),
pressedColor: getEnteColorScheme(context).fillFaint,
trailingIcon: Icons.chevron_right_outlined,
trailingIconIsMuted: true,
onTap: () async {
launchUrlString(
githubIssuesUrl,
mode: LaunchMode.externalApplication,
);
},
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
@@ -61,21 +95,6 @@ class _SupportSectionWidgetState extends State<SupportSectionWidget> {
},
),
sectionOptionSpacing,
MenuItemWidget(
captionedTextWidget: CaptionedTextWidget(
title: l10n.crashAndErrorReporting,
),
trailingWidget: ToggleSwitchWidget(
value: () => SuperLogging.shouldReportErrors(),
onChanged: () async {
await SuperLogging.setShouldReportErrors(
!SuperLogging.shouldReportErrors(),
);
setState(() {});
},
),
),
sectionOptionSpacing,
],
);
}

View File

@@ -1,27 +1,42 @@
import 'dart:io';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/onboarding/view/onboarding_page.dart';
import 'package:ente_auth/services/user_service.dart';
import 'package:ente_auth/theme/colors.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/components/buttons/button_widget.dart';
import 'package:ente_auth/ui/components/models/button_result.dart';
import 'package:ente_auth/ui/components/notification_warning_widget.dart';
import 'package:ente_auth/ui/settings/about_section_widget.dart';
import 'package:ente_auth/ui/settings/account_section_widget.dart';
import 'package:ente_auth/ui/settings/app_version_widget.dart';
import 'package:ente_auth/ui/settings/danger_section_widget.dart';
import 'package:ente_auth/ui/settings/data_section_widget.dart';
import 'package:ente_auth/ui/settings/data/data_section_widget.dart';
import 'package:ente_auth/ui/settings/data/export_widget.dart';
import 'package:ente_auth/ui/settings/general_section_widget.dart';
import 'package:ente_auth/ui/settings/security_section_widget.dart';
import 'package:ente_auth/ui/settings/social_section_widget.dart';
import 'package:ente_auth/ui/settings/support_dev_widget.dart';
import 'package:ente_auth/ui/settings/support_section_widget.dart';
import 'package:ente_auth/ui/settings/theme_switch_widget.dart';
import 'package:ente_auth/ui/settings/title_bar_widget.dart';
import 'package:ente_auth/utils/dialog_util.dart';
import 'package:ente_auth/utils/navigation_util.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
class SettingsPage extends StatelessWidget {
final ValueNotifier<String?> emailNotifier;
const SettingsPage({Key? key, required this.emailNotifier}) : super(key: key);
SettingsPage({Key? key, required this.emailNotifier}) : super(key: key);
@override
Widget build(BuildContext context) {
final _hasLoggedIn = Configuration.instance.hasConfiguredAccount();
if (_hasLoggedIn) {
UserService.instance.getUserDetailsV2().ignore();
}
final enteColorScheme = getEnteColorScheme(context);
return Scaffold(
body: Container(
@@ -32,34 +47,71 @@ class SettingsPage extends StatelessWidget {
}
Widget _getBody(BuildContext context, EnteColorScheme colorScheme) {
final _hasLoggedIn = Configuration.instance.hasConfiguredAccount();
final enteTextTheme = getEnteTextTheme(context);
const sectionSpacing = SizedBox(height: 8);
final List<Widget> contents = [];
contents.add(
Container(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Align(
alignment: Alignment.centerLeft,
child: AnimatedBuilder(
// [AnimatedBuilder] accepts any [Listenable] subtype.
animation: emailNotifier,
builder: (BuildContext context, Widget? child) {
return Text(
emailNotifier.value!,
style: enteTextTheme.body.copyWith(
color: colorScheme.textMuted,
overflow: TextOverflow.ellipsis,
),
);
},
if (_hasLoggedIn) {
contents.add(
Container(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Align(
alignment: Alignment.centerLeft,
child: AnimatedBuilder(
// [AnimatedBuilder] accepts any [Listenable] subtype.
animation: emailNotifier,
builder: (BuildContext context, Widget? child) {
return Text(
emailNotifier.value!,
style: enteTextTheme.body.copyWith(
color: colorScheme.textMuted,
overflow: TextOverflow.ellipsis,
),
);
},
),
),
),
),
);
const sectionSpacing = SizedBox(height: 8);
contents.add(const SizedBox(height: 12));
);
contents.addAll([
const SizedBox(height: 12),
AccountSectionWidget(),
sectionSpacing,
]);
} else {
contents.addAll([
NotificationWidget(
startIcon: Icons.account_circle_sharp,
actionIcon: Icons.arrow_forward,
text: context.l10n.signInToBackup,
type: NotificationType.notice,
onTap: () async {
ButtonResult? result = await showChoiceActionSheet(
context,
title: context.l10n.warning,
body: context.l10n.sigInBackupReminder,
secondButtonLabel: context.l10n.singIn,
secondButtonAction: ButtonAction.second,
firstButtonLabel: context.l10n.exportCodes,
);
if (result == null) return;
if (result.action == ButtonAction.first) {
await handleExportClick(context);
} else {
if (result.action == ButtonAction.second) {
await routeToPage(
context,
const OnboardingPage(),
);
}
}
},
),
sectionSpacing,
sectionSpacing,
]);
}
contents.addAll([
AccountSectionWidget(),
sectionSpacing,
DataSectionWidget(),
sectionSpacing,
const SecuritySectionWidget(),
@@ -74,13 +126,13 @@ class SettingsPage extends StatelessWidget {
}
contents.addAll([
const AdvancedSectionWidget(),
sectionSpacing,
const SupportSectionWidget(),
sectionSpacing,
const SocialSectionWidget(),
sectionSpacing,
const AboutSectionWidget(),
sectionSpacing,
const DangerSectionWidget(),
const AppVersionWidget(),
const SupportDevWidget(),
const Padding(

View File

@@ -0,0 +1,80 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_svg/svg.dart';
class IconUtils {
IconUtils._privateConstructor();
static final IconUtils instance = IconUtils._privateConstructor();
// Map of icon-title to the color code in HEX
final Map<String, String> _simpleIcons = {};
final Map<String, String> _customIcons = {};
Future<void> init() async {
await _loadJson();
}
Widget getIcon(
String provider, {
double width = 24,
}) {
final title = _getProviderTitle(provider);
if (_customIcons.containsKey(title)) {
return _getSVGIcon(
"assets/custom-icons/icons/$title.svg",
title,
_customIcons[title]!,
width,
);
} else if (_simpleIcons.containsKey(title)) {
return _getSVGIcon(
"assets/simple-icons/icons/$title.svg",
title,
_simpleIcons[title]!,
width,
);
} else {
return const SizedBox.shrink();
}
}
Widget _getSVGIcon(
String path,
String title,
String color,
double width,
) {
return SvgPicture.asset(
path,
width: width,
semanticsLabel: title,
colorFilter: ColorFilter.mode(
Color(int.parse("0xFF" + color)),
BlendMode.srcIn,
),
);
}
Future<void> _loadJson() async {
final simpleIconData = await rootBundle
.loadString('assets/simple-icons/_data/simple-icons.json');
final simpleIcons = json.decode(simpleIconData);
for (final icon in simpleIcons["icons"]) {
_simpleIcons[icon["title"].toString().toLowerCase()] = icon["hex"];
}
final customIconData = await rootBundle
.loadString('assets/custom-icons/_data/custom-icons.json');
final customIcons = json.decode(customIconData);
for (final icon in customIcons["icons"]) {
_customIcons[icon["title"].toString().toLowerCase()] = icon["hex"];
}
}
String _getProviderTitle(String provider) {
return provider.split(RegExp(r'[.(]'))[0].trim().toLowerCase();
}
}

Some files were not shown because too many files have changed in this diff Show More