Bug 1867847 - part 2: add hybrid transport identifier. r=keeler

Differential Revision: https://phabricator.services.mozilla.com/D195282
This commit is contained in:
John Schanck 2023-12-04 22:42:53 +00:00
Родитель 9a4722e837
Коммит dcae74c097
4 изменённых файлов: 19 добавлений и 8 удалений

Просмотреть файл

@ -9,7 +9,7 @@
// WARNING: This version number must match the WebAuthn level where the strings
// below are defined.
#define MOZ_WEBAUTHN_ENUM_STRINGS_VERSION 2
#define MOZ_WEBAUTHN_ENUM_STRINGS_VERSION 3
// https://www.w3.org/TR/webauthn-2/#enum-attestation-convey
#define MOZ_WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_NONE "none"
@ -44,6 +44,7 @@
#define MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_NFC "nfc"
#define MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_BLE "ble"
#define MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_INTERNAL "internal"
#define MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_HYBRID "hybrid"
// WARNING: Change version number when adding new values!
#endif // mozilla_dom_WebAuthnEnumStrings_h

Просмотреть файл

@ -398,7 +398,7 @@ already_AddRefed<Promise> WebAuthnManager::MakeCredential(
// The residentKey field was added in WebAuthn level 2. It takes precedent
// over the requireResidentKey field if and only if it is present and it is a
// member of the ResidentKeyRequirement enum.
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 2);
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 3);
bool useResidentKeyValue =
selection.mResidentKey.WasPassed() &&
(selection.mResidentKey.Value().EqualsLiteral(
@ -585,7 +585,7 @@ already_AddRefed<Promise> WebAuthnManager::GetAssertion(
// We ignore unknown transports for forward-compatibility, but this
// needs to be reviewed if values are added to the
// AuthenticatorTransport enum.
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 2);
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 3);
for (const nsAString& str : s.mTransports.Value()) {
if (str.EqualsLiteral(MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_USB)) {
transports |= MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_ID_USB;
@ -598,6 +598,9 @@ already_AddRefed<Promise> WebAuthnManager::GetAssertion(
} else if (str.EqualsLiteral(
MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_INTERNAL)) {
transports |= MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_ID_INTERNAL;
} else if (str.EqualsLiteral(
MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_HYBRID)) {
transports |= MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_ID_HYBRID;
}
}
c.transports() = transports;

Просмотреть файл

@ -11,5 +11,6 @@
#define MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_ID_NFC 2
#define MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_ID_BLE 4
#define MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_ID_INTERNAL 8
#define MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_ID_HYBRID 16
#endif // mozilla_dom_WebAuthnTransportIdentifiers_h

Просмотреть файл

@ -328,7 +328,7 @@ WinWebAuthnService::MakeCredential(uint64_t aTransactionId,
Unused << aArgs->GetUserVerification(userVerificationReq);
// This mapping needs to be reviewed if values are added to the
// UserVerificationRequirement enum.
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 2);
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 3);
if (userVerificationReq.EqualsLiteral(
MOZ_WEBAUTHN_USER_VERIFICATION_REQUIREMENT_REQUIRED)) {
winUserVerificationReq =
@ -357,7 +357,7 @@ WinWebAuthnService::MakeCredential(uint64_t aTransactionId,
}
// This mapping needs to be reviewed if values are added to the
// AuthenticatorAttachement enum.
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 2);
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 3);
if (authenticatorAttachment.EqualsLiteral(
MOZ_WEBAUTHN_AUTHENTICATOR_ATTACHMENT_PLATFORM)) {
winAttachment = WEBAUTHN_AUTHENTICATOR_ATTACHMENT_PLATFORM;
@ -374,7 +374,7 @@ WinWebAuthnService::MakeCredential(uint64_t aTransactionId,
Unused << aArgs->GetResidentKey(residentKey);
// This mapping needs to be reviewed if values are added to the
// ResidentKeyRequirement enum.
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 2);
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 3);
if (residentKey.EqualsLiteral(
MOZ_WEBAUTHN_RESIDENT_KEY_REQUIREMENT_REQUIRED)) {
winRequireResidentKey = TRUE;
@ -401,7 +401,7 @@ WinWebAuthnService::MakeCredential(uint64_t aTransactionId,
bool anonymize = false;
// This mapping needs to be reviewed if values are added to the
// AttestationConveyancePreference enum.
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 2);
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 3);
if (attestation.EqualsLiteral(
MOZ_WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_NONE)) {
winAttestation = WEBAUTHN_ATTESTATION_CONVEYANCE_PREFERENCE_NONE;
@ -483,6 +483,9 @@ WinWebAuthnService::MakeCredential(uint64_t aTransactionId,
if (transports & MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_ID_INTERNAL) {
winTransports |= WEBAUTHN_CTAP_TRANSPORT_INTERNAL;
}
if (transports & MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_ID_HYBRID) {
winTransports |= WEBAUTHN_CTAP_TRANSPORT_HYBRID;
}
WEBAUTHN_CREDENTIAL_EX credential = {
WEBAUTHN_CREDENTIAL_EX_CURRENT_VERSION,
@ -697,7 +700,7 @@ void WinWebAuthnService::DoGetAssertion(
DWORD winUserVerificationReq;
// This mapping needs to be reviewed if values are added to the
// UserVerificationRequirement enum.
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 2);
static_assert(MOZ_WEBAUTHN_ENUM_STRINGS_VERSION == 3);
if (userVerificationReq.EqualsLiteral(
MOZ_WEBAUTHN_USER_VERIFICATION_REQUIREMENT_REQUIRED)) {
winUserVerificationReq =
@ -753,6 +756,9 @@ void WinWebAuthnService::DoGetAssertion(
if (transports & MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_ID_INTERNAL) {
winTransports |= WEBAUTHN_CTAP_TRANSPORT_INTERNAL;
}
if (transports & MOZ_WEBAUTHN_AUTHENTICATOR_TRANSPORT_ID_HYBRID) {
winTransports |= WEBAUTHN_CTAP_TRANSPORT_HYBRID;
}
WEBAUTHN_CREDENTIAL_EX credential = {
WEBAUTHN_CREDENTIAL_EX_CURRENT_VERSION,