Backed out changeset b462e7b742d8 (bug 1908261) for causing multiple reftest failures...
[gecko.git] / dom / webauthn / WebAuthnAutoFillEntry.h
blob53fb0405623df73c12b64055c9499b72013405b4
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_dom_WebAuthnAutoFillEntry_h_
6 #define mozilla_dom_WebAuthnAutoFillEntry_h_
8 #include "nsIWebAuthnService.h"
9 #include "nsString.h"
11 #ifdef XP_WIN
12 # include <windows.h>
13 # include "winwebauthn/webauthn.h"
14 #endif
16 namespace mozilla::dom {
18 class WebAuthnAutoFillEntry final : public nsIWebAuthnAutoFillEntry {
19 public:
20 NS_DECL_THREADSAFE_ISUPPORTS
21 NS_DECL_NSIWEBAUTHNAUTOFILLENTRY
23 WebAuthnAutoFillEntry(uint8_t aProvider, const nsAString& aUserName,
24 const nsAString& aRpId,
25 const nsTArray<uint8_t>& aCredentialId)
26 : mProvider(aProvider), mUserName(aUserName), mRpId(aRpId) {
27 mCredentialId.Assign(aCredentialId);
30 #ifdef XP_WIN
31 explicit WebAuthnAutoFillEntry(
32 PCWEBAUTHN_CREDENTIAL_DETAILS aCredentialDetails) {
33 mProvider = nsIWebAuthnAutoFillEntry::PROVIDER_PLATFORM_WINDOWS;
34 mUserName.Assign(aCredentialDetails->pUserInformation->pwszName);
35 mRpId.Assign(aCredentialDetails->pRpInformation->pwszId);
36 mCredentialId.AppendElements(aCredentialDetails->pbCredentialID,
37 aCredentialDetails->cbCredentialID);
39 #endif
41 private:
42 ~WebAuthnAutoFillEntry() = default;
44 uint8_t mProvider;
45 nsString mUserName;
46 nsString mRpId;
47 nsTArray<uint8_t> mCredentialId;
50 } // namespace mozilla::dom
51 #endif // mozilla_dom_WebAuthnAutoFillEntry_h_