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"
13 # include "winwebauthn/webauthn.h"
16 namespace mozilla::dom
{
18 class WebAuthnAutoFillEntry final
: public nsIWebAuthnAutoFillEntry
{
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
);
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
);
42 ~WebAuthnAutoFillEntry() = default;
47 nsTArray
<uint8_t> mCredentialId
;
50 } // namespace mozilla::dom
51 #endif // mozilla_dom_WebAuthnAutoFillEntry_h_