Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(@desktop/keycard): authenticate flow added #7246

Merged
merged 7 commits into from
Sep 14, 2022
Merged

Conversation

saledjenic
Copy link
Contributor

@saledjenic saledjenic commented Sep 6, 2022

@saledjenic saledjenic changed the base branch from master to feat/issue-7026 September 6, 2022 10:23
@status-im-auto
Copy link
Member

status-im-auto commented Sep 6, 2022

Jenkins Builds

Click to see older builds (72)
Commit #️⃣ Finished (UTC) Duration Platform Result
⁉️ dfb6f4f #2 2022-09-06 10:28:45 ~5 min linux-cpp 📄log
⁉️ dfb6f4f #1 2022-09-06 10:29:01 ~5 min linux-cpp 📄log
✔️ dfb6f4f #2 2022-09-06 10:35:08 ~11 min linux 📦tgz
✔️ dfb6f4f #1 2022-09-06 10:36:15 ~12 min linux 📦tgz
✔️ dfb6f4f #1 2022-09-06 10:40:36 ~17 min macos 📦dmg
✔️ dfb6f4f #2 2022-09-06 10:40:36 ~16 min macos 📦dmg
✔️ dfb6f4f #1 2022-09-06 10:49:44 ~26 min windows 📦exe
✔️ dfb6f4f #2 2022-09-06 10:49:56 ~26 min windows 📦exe
✔️ e50b393 #5 2022-09-06 13:33:14 ~16 min macos 📦dmg
⁉️ e50b393 #5 2022-09-06 13:41:48 ~24 min linux-cpp 📄log
✔️ e50b393 #5 2022-09-06 13:48:14 ~31 min linux 📦tgz
✔️ e50b393 #5 2022-09-06 13:51:58 ~35 min windows 📦exe
⁉️ de07422 #6 2022-09-07 09:17:12 ~5 min linux-cpp 📄log
✔️ de07422 #6 2022-09-07 09:21:27 ~9 min macos 📦dmg
✔️ de07422 #6 2022-09-07 09:24:06 ~12 min linux 📦tgz
✔️ de07422 #6 2022-09-07 09:38:10 ~26 min windows 📦exe
⁉️ 67d8821 #8 2022-09-08 11:14:19 ~7 min linux-cpp 📄log
✔️ 67d8821 #8 2022-09-08 11:21:59 ~14 min linux 📦tgz
✔️ 67d8821 #8 2022-09-08 11:33:23 ~26 min windows 📦exe
⁉️ 1241364 #9 2022-09-08 11:27:55 ~8 min linux-cpp 📄log
✔️ 1241364 #9 2022-09-08 11:34:59 ~15 min linux 📦tgz
✔️ 1241364 #9 2022-09-08 11:54:17 ~34 min windows 📦exe
✔️ 1241364 #9 2022-09-08 11:58:49 ~39 min macos 📦dmg
⁉️ 893feb0 #10 2022-09-09 10:23:05 ~5 min linux-cpp 📄log
✔️ 893feb0 #10 2022-09-09 10:26:25 ~8 min macos 📦dmg
✔️ 893feb0 #10 2022-09-09 10:29:57 ~12 min linux 📦tgz
✔️ 893feb0 #10 2022-09-09 10:41:53 ~24 min windows 📦exe
⁉️ 5216942 #11 2022-09-09 11:00:11 ~5 min linux-cpp 📄log
✔️ 5216942 #11 2022-09-09 11:02:39 ~7 min macos 📦dmg
✔️ 5216942 #11 2022-09-09 11:06:46 ~11 min linux 📦tgz
✔️ 5216942 #11 2022-09-09 11:18:11 ~23 min windows 📦exe
⁉️ c0862e1 #12 2022-09-09 11:47:15 ~4 min linux-cpp 📄log
✔️ c0862e1 #12 2022-09-09 11:51:03 ~8 min macos 📦dmg
✔️ c0862e1 #12 2022-09-09 11:54:42 ~12 min linux 📦tgz
✔️ c0862e1 #12 2022-09-09 12:07:49 ~25 min windows 📦exe
⁉️ 9400c35 #13 2022-09-09 11:50:32 ~5 min linux-cpp 📄log
✔️ 9400c35 #13 2022-09-09 11:57:09 ~11 min linux 📦tgz
✔️ 9400c35 #13 2022-09-09 11:58:40 ~13 min macos 📦dmg
✔️ 9400c35 #13 2022-09-09 12:10:50 ~25 min windows 📦exe
9400c35 #8 2022-09-09 13:02:45 ~26 min e2e 📄log
⁉️ 1233d70 #14 2022-09-09 20:56:00 ~4 min linux-cpp 📄log
✔️ 1233d70 #14 2022-09-09 20:59:50 ~8 min macos 📦dmg
✔️ 1233d70 #14 2022-09-09 21:02:17 ~11 min linux 📦tgz
✔️ 1233d70 #14 2022-09-09 21:13:47 ~22 min windows 📦exe
⁉️ 1928e8f #15 2022-09-12 06:43:51 ~4 min linux-cpp 📄log
✔️ 1928e8f #15 2022-09-12 06:47:41 ~8 min macos 📦dmg
✔️ 1928e8f #15 2022-09-12 06:51:06 ~12 min linux 📦tgz
✔️ 1928e8f #15 2022-09-12 07:02:11 ~22 min windows 📦exe
⁉️ 7b433bd #16 2022-09-12 09:51:59 ~4 min linux-cpp 📄log
✔️ 7b433bd #16 2022-09-12 09:55:40 ~8 min macos 📦dmg
✔️ 7b433bd #16 2022-09-12 10:00:16 ~12 min linux 📦tgz
✔️ 7b433bd #16 2022-09-12 10:11:01 ~23 min windows 📦exe
⁉️ a4dd0f2 #17 2022-09-13 09:27:51 ~5 min linux-cpp 📄log
✔️ a4dd0f2 #17 2022-09-13 09:31:14 ~8 min macos 📦dmg
✔️ a4dd0f2 #17 2022-09-13 09:34:34 ~11 min linux 📦tgz
✔️ a4dd0f2 #17 2022-09-13 09:45:49 ~23 min windows 📦exe
⁉️ 1dda566 #18 2022-09-13 09:38:54 ~4 min linux-cpp 📄log
✔️ 1dda566 #18 2022-09-13 09:45:32 ~10 min linux 📦tgz
✔️ 1dda566 #18 2022-09-13 09:46:16 ~11 min macos 📦dmg
✔️ 1dda566 #18 2022-09-13 09:58:05 ~23 min windows 📦exe
⁉️ 0ca6f90 #19 2022-09-13 10:18:12 ~4 min linux-cpp 📄log
✔️ 0ca6f90 #19 2022-09-13 10:21:54 ~8 min macos 📦dmg
✔️ 0ca6f90 #19 2022-09-13 10:25:33 ~12 min linux 📦tgz
✔️ 0ca6f90 #19 2022-09-13 10:38:08 ~24 min windows 📦exe
⁉️ 4d6335c #20 2022-09-13 14:30:51 ~4 min linux-cpp 📄log
✔️ 4d6335c #20 2022-09-13 14:37:28 ~11 min macos 📦dmg
✔️ 4d6335c #20 2022-09-13 14:40:45 ~14 min linux 📦tgz
✔️ 4d6335c #20 2022-09-13 14:50:04 ~24 min windows 📦exe
⁉️ d9aafd5 #21 2022-09-14 07:26:23 ~4 min linux-cpp 📄log
✔️ d9aafd5 #21 2022-09-14 07:33:33 ~12 min linux 📦tgz
✔️ d9aafd5 #21 2022-09-14 07:35:41 ~14 min macos 📦dmg
✔️ d9aafd5 #21 2022-09-14 07:46:34 ~25 min windows 📦exe
Commit #️⃣ Finished (UTC) Duration Platform Result
⁉️ 25601a1 #22 2022-09-14 07:27:23 ~5 min linux-cpp 📄log
✔️ 25601a1 #22 2022-09-14 07:33:18 ~10 min linux 📦tgz
✔️ 25601a1 #22 2022-09-14 07:35:43 ~13 min macos 📦dmg
✔️ 25601a1 #22 2022-09-14 07:47:22 ~24 min windows 📦exe
⁉️ 7cc3f55 #23 2022-09-14 12:16:52 ~5 min linux-cpp 📄log
✔️ 7cc3f55 #23 2022-09-14 12:20:14 ~8 min macos 📦dmg
✔️ 7cc3f55 #23 2022-09-14 12:23:47 ~12 min linux 📦tgz
✔️ 7cc3f55 #23 2022-09-14 12:34:37 ~22 min windows 📦exe

Base automatically changed from feat/issue-7026 to master September 6, 2022 13:06
@saledjenic saledjenic force-pushed the feat/issue-7205 branch 12 times, most recently from 1dda566 to 0ca6f90 Compare September 13, 2022 10:12
@saledjenic saledjenic changed the title Feat/issue 7205 feat(@desktop/keycard): authenticate flow added Sep 13, 2022
@saledjenic saledjenic marked this pull request as ready for review September 13, 2022 10:13
@saledjenic saledjenic requested review from a team, osmaczko, stefandunca, glitchminer and endulab and removed request for a team September 13, 2022 10:13
@saledjenic saledjenic requested review from igor-sirotin and removed request for a team September 13, 2022 10:14
Copy link
Member

@caybro caybro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow again... what an amount of code :)

Reviewed the frontend part mostly, some minor remarks inline, otherwise looks good imo

ui/imports/shared/popups/keycard/states/EnterPassword.qml Outdated Show resolved Hide resolved
ui/imports/shared/popups/keycard/states/EnterPassword.qml Outdated Show resolved Hide resolved
ui/imports/shared/popups/keycard/states/EnterPassword.qml Outdated Show resolved Hide resolved
ui/imports/shared/popups/keycard/KeycardPopup.qml Outdated Show resolved Hide resolved
Copy link
Contributor

@stefandunca stefandunca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see you put a lot of effort into this and appreciate it.

I did my best to help by matching the requirements (design) with the states and presentation logic. However, without a clear understanding of the workflows and corner cases, I can't say I trust myself to cover much. I find it easy to get lost in the back and forth between QML events, NIM states, and keycard library input/output.

I trust you have all covered and have a deep understanding of keycard implementation.

Moving forward, I feel that more testing, a state machine diagram and some refactoring can bring some sanity to the workflows and conditions that drive them.

Otherwise helping with keycard implementation seems like a full-time job.

@@ -6,7 +6,7 @@ QtObject:
type UserProfile* = ref object of QObject
# fields which cannot change
username: string
address: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@@ -101,6 +105,31 @@ StatusModal {
return
}
}
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.authentication) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't all these state checks be grouped together in a few meaningful function calls and reused?
I tried to check which overlapped with what but I get easily lost. Also matching this with requirements in design is not easy. I trust you know what you did :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefandunca it could be grouped, but in that case it will be difficult for figuring out even for me who wrote this after some time, that's why I've splitted each flow and handle the states within each flow separately even some states are the same among flows. Tracking root.sharedKeycardModule.currentState.flowType you can be sure what flow we're working with.

@saledjenic
Copy link
Contributor Author

I find it easy to get lost in the back and forth between QML events, NIM states, and keycard library input/output.

@stefandunca yes, I agree, this is true, but I don't see other way to cover all that correctly in Nim. You just need to follow the flow and states and realize what's happening, also need to understand flows on the keycard lib side, cause they do not match the design flows at all.

Moving forward, I feel that more testing, a state machine diagram and some refactoring can bring some sanity to the workflows and conditions that drive them.

Would be nice to have, but creating something like that is very hard, we will use figma designs for that.

Images required for authentication flow added
Prop `address` renamed to `keyUid` to be consistent in code and name the
things in the way what they really are.
new procs added to the wallet account service:
- `addMigratedKeyPair`
- `getAllMigratedKeyPairs`
- `getMigratedKeyPairByKeyUID`
- `setKeycardName`
- `keycardLocked`
- `keycardUnlocked`
- `deleteKeycard`
shared keycard popup module is extended with:
- `uniqueIdentifier`
- `settingsService`
- `walletAccountService`
- `keychainService`
- login states updated so they can resolve enter pin state from each state
that flow may be in
- not a keycard state added
- login plugin state added
- Added `Authenticate` flow
- `Setup a new Keycard with an existing account` updated so it includes `Authenticate` flow
from the point where is needed (when migrating a profile keypair)
- We are missing `Unlock Keycard` flow for this one, will be added once it is developed
@saledjenic saledjenic merged commit 03bb1e5 into master Sep 14, 2022
@saledjenic saledjenic deleted the feat/issue-7205 branch September 14, 2022 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Authentication flow popup
5 participants