Skip to content

Commit f37dc16

Browse files
authored
Update FIDO2.1 Manager.cpp
Adding domain field in the passkeys table
1 parent 7abfbea commit f37dc16

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

FIDO2.1 Manager.cpp

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ HWND hComboBox, hListView, hRefreshButton, hMainWindow, hwnd;
2222
struct PasskeyInfo {
2323
std::wstring credentialId;
2424
std::wstring user;
25+
std::wstring domain;
2526
};
2627

2728

@@ -134,11 +135,14 @@ std::vector<PasskeyInfo> GetResidentKeysWithDomains(const std::wstring& deviceNu
134135

135136
// Debug: Check the raw output
136137
for (const auto& line : output) {
137-
// MessageBox(NULL, line.c_str(), L"Debug: Second Run Output", MB_OK);
138+
//MessageBox(NULL, line.c_str(), L"Debug: Second Run Output", MB_OK);
138139
}
139140

140141
// Parse the results and add them to the list
141142
std::vector<PasskeyInfo> parsedPasskeys = ParseResidentKeys(output);
143+
for (auto& key : parsedPasskeys) {
144+
key.domain = domain; // Assuming PasskeyInfo has a domain member.
145+
}
142146
passkeys.insert(passkeys.end(), parsedPasskeys.begin(), parsedPasskeys.end());
143147
}
144148

@@ -190,16 +194,22 @@ void PopulatePasskeysList(HWND hListView, const std::vector<PasskeyInfo>& passke
190194
lvItem.mask = LVIF_TEXT;
191195
lvItem.iItem = static_cast<int>(i);
192196

193-
// Add Credential ID
197+
// Add Credential ID (Column 0)
194198
lvItem.pszText = const_cast<LPWSTR>(pk.credentialId.c_str());
195199
SendMessage(hListView, LVM_INSERTITEM, 0, (LPARAM)&lvItem);
196200

197-
// Add User
201+
// Add User (Column 1)
198202
lvItem.iSubItem = 1;
199203
lvItem.pszText = const_cast<LPWSTR>(pk.user.c_str());
200204
SendMessage(hListView, LVM_SETITEM, 0, (LPARAM)&lvItem);
205+
206+
// Add Domain (Column 2)
207+
lvItem.iSubItem = 2;
208+
lvItem.pszText = const_cast<LPWSTR>(pk.domain.c_str());
209+
SendMessage(hListView, LVM_SETITEM, 0, (LPARAM)&lvItem);
201210
}
202211
}
212+
203213

204214

205215
INT_PTR CALLBACK PasskeysDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
@@ -214,14 +224,18 @@ INT_PTR CALLBACK PasskeysDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
214224
LVCOLUMN lvColumn = { 0 };
215225
lvColumn.mask = LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
216226

217-
lvColumn.cx = 150;
227+
lvColumn.cx = 100;
218228
lvColumn.pszText = const_cast<LPWSTR>(L"Credential ID");
219229
SendMessage(hListView, LVM_INSERTCOLUMN, 0, (LPARAM)&lvColumn);
220230

221-
lvColumn.cx = 300;
231+
lvColumn.cx = 200;
222232
lvColumn.pszText = const_cast<LPWSTR>(L"User");
223233
SendMessage(hListView, LVM_INSERTCOLUMN, 1, (LPARAM)&lvColumn);
224234

235+
lvColumn.cx = 200; // Set the width for the Domain column
236+
lvColumn.pszText = const_cast<LPWSTR>(L"Domain");
237+
SendMessage(hListView, LVM_INSERTCOLUMN, 2, (LPARAM)&lvColumn);
238+
225239
// Store the initial passkeys pointer
226240
passkeys = reinterpret_cast<std::vector<PasskeyInfo>*>(lParam);
227241

@@ -277,14 +291,18 @@ INT_PTR CALLBACK PasskeysDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPAR
277291

278292
// Parse the second run output
279293
std::vector<PasskeyInfo> parsedPasskeys = ParseResidentKeys(secondOutput);
294+
for (auto& key : parsedPasskeys) {
295+
key.domain = domain; // Assuming PasskeyInfo has a domain member.
296+
}
297+
280298
refreshedPasskeys.insert(refreshedPasskeys.end(), parsedPasskeys.begin(), parsedPasskeys.end());
281299
}
282300

283301
// Debug: Display parsed passkeys
284302
for (const auto& pk : refreshedPasskeys) {
285303
// MessageBox(hDlg, (L"Credential ID: " + pk.credentialId + L"\nUser: " + pk.user).c_str(), L"Debug: Parsed Passkey", MB_OK);
286304
}
287-
305+
288306
// Step 3: Populate the ListView with the complete data
289307
PopulatePasskeysList(hListView, refreshedPasskeys);
290308

@@ -418,7 +436,7 @@ INT_PTR CALLBACK FingerprintDialogProc(HWND hDlg, UINT message, WPARAM wParam, L
418436
std::wstring fingerprintID_And_Description = line.substr(colonPos + 2); // From after ':'
419437

420438
// Debug: Display the parsed data
421-
MessageBox(hDlg, (L"Index: " + index + L"\nData: " + fingerprintID_And_Description).c_str(), L"Debug: Parsed Data", MB_OK);
439+
// MessageBox(hDlg, (L"Index: " + index + L"\nData: " + fingerprintID_And_Description).c_str(), L"Debug: Parsed Data", MB_OK);
422440

423441
// Add to the ListView
424442
LVITEM lvItem = { 0 };
@@ -440,7 +458,7 @@ INT_PTR CALLBACK FingerprintDialogProc(HWND hDlg, UINT message, WPARAM wParam, L
440458
}
441459
else {
442460
// Debug: Show lines that failed to parse
443-
MessageBox(hDlg, line.c_str(), L"Debug: Unparsed Line", MB_OK);
461+
// MessageBox(hDlg, line.c_str(), L"Debug: Unparsed Line", MB_OK);
444462
}
445463
}
446464

0 commit comments

Comments
 (0)