Adjust to API changes 50/312650/2
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 12 Jun 2024 10:09:09 +0000 (12:09 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Fri, 19 Jul 2024 10:26:27 +0000 (12:26 +0200)
Change-Id: Ibd4872b096afbf3f0183cdead76c451f50951ffe

srcs/exception.h
srcs/message.cpp
srcs/request_handler.cpp
srcs/request_handler.h
tests/ctap_message_processor_tests.cpp
tests/man_tests.cpp
tests/message_tests.cpp
tests/request_handler_tests.cpp

index d7670045e0540e4629efc82514068c06ec35334d..779044eea6842cdee8249d0f864d25bb2101806e 100644 (file)
@@ -53,9 +53,9 @@ using EncodingFailed = Exception<WAUTHN_ERROR_ENCODING_FAILED>;
 using SocketError = Exception<WAUTHN_ERROR_SOCKET>;
 using NoSuchService = Exception<WAUTHN_ERROR_NO_SUCH_SERVICE>;
 using AccessDenied = Exception<WAUTHN_ERROR_ACCESS_DENIED>;
-using MemoryError = Exception<WAUTHN_ERROR_MEMORY>;
-using Cancelled = Exception<WAUTHN_ERROR_CANCELLED>;
-using Timeout = Exception<WAUTHN_ERROR_TIMEOUT>;
+using MemoryError = Exception<WAUTHN_ERROR_OUT_OF_MEMORY>;
+using Cancelled = Exception<WAUTHN_ERROR_CANCELED>;
+using Timeout = Exception<WAUTHN_ERROR_TIMED_OUT>;
 
 } // namespace Exception
 
index 776cc8e614a99f8c3b17b0e68314d06b6f2172cf..3ee47d58bef323f2f9f628b7b53fd05ff1f14c84 100644 (file)
@@ -227,7 +227,7 @@ void SerializePubkeyCredDescriptors(CborEncoding::SortedMap &map,
         if (!desc.id)
             THROW_INVALID_PARAM("Missing credential id");
         publicKeyCredDescriptorMap.AppendByteStringAt("id", *desc.id);
-        if (desc.type != PCT_PUBLIC_KEY)
+        if (desc.type != WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY)
             THROW_INVALID_PARAM("Unexpected credential type");
         publicKeyCredDescriptorMap.AppendTextStringZAt("type", CREDENTIAL_TYPE_PUBLIC_KEY);
 
@@ -330,7 +330,7 @@ void MakeCredentialCommand::Serialize(Buffer &output) const
             keys++;
         if (m_options.authenticator_selection)
             keys++;
-        if (m_options.attestation != AP_NONE)
+        if (m_options.attestation != WAUTHN_ATTESTATION_PREF_NONE)
             keys++;
         if (m_options.attestation_formats)
             keys++;
@@ -386,7 +386,8 @@ void MakeCredentialCommand::Serialize(Buffer &output) const
                     auto paramMap = pubKeyCredParamsArray.OpenMap(2);
                     paramMap.AppendInt64At("alg", m_options.pubkey_cred_params->params[i].alg);
 
-                    if (m_options.pubkey_cred_params->params[i].type != PCT_PUBLIC_KEY)
+                    if (m_options.pubkey_cred_params->params[i].type !=
+                        WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY)
                         THROW_INVALID_PARAM("Invalid credential type");
                     paramMap.AppendTextStringZAt("type", CREDENTIAL_TYPE_PUBLIC_KEY);
                 }
@@ -417,22 +418,27 @@ void MakeCredentialCommand::Serialize(Buffer &output) const
             auto optionsMap = map.OpenMapAt(KEY_MC_CMD_OPTIONS, 2);
             const auto &selection = *m_options.authenticator_selection;
 
-            auto effectiveRk = (selection.resident_key == RKR_REQUIRED) ||
-                (selection.resident_key == RKR_PREFERRED && m_supportedOptions.rk) ||
-                (selection.resident_key == RKR_NONE && selection.require_resident_key);
+            auto effectiveRk =
+                (selection.resident_key == WAUTHN_RESIDENT_KEY_REQUIREMENT_REQUIRED) ||
+                (selection.resident_key == WAUTHN_RESIDENT_KEY_REQUIREMENT_PREFERRED &&
+                 m_supportedOptions.rk) ||
+                (selection.resident_key == WAUTHN_RESIDENT_KEY_REQUIREMENT_NONE &&
+                 selection.require_resident_key);
             optionsMap.AppendBooleanAt("rk", effectiveRk);
 
             // TODO user presence "up" not mapped?
 
-            auto effectiveUv = (selection.user_verification == UVR_REQUIRED) ||
-                (selection.user_verification == UVR_PREFERRED && m_supportedOptions.uv);
+            auto effectiveUv =
+                (selection.user_verification == WAUTHN_USER_VERIFICATION_REQUIREMENT_REQUIRED) ||
+                (selection.user_verification == WAUTHN_USER_VERIFICATION_REQUIREMENT_PREFERRED &&
+                 m_supportedOptions.uv);
             optionsMap.AppendBooleanAt("uv", effectiveUv);
         }
 
         // TODO 0x08
         // TODO 0x09
 
-        if (m_options.attestation != AP_NONE) {
+        if (m_options.attestation != WAUTHN_ATTESTATION_PREF_NONE) {
             // TODO not sure what to put here
             // 1 - vendor facilitated enterprise attestation
             // 2 - platform managed enterprise attestation
@@ -480,8 +486,10 @@ void GetAssertionCommand::Serialize(Buffer &output) const
         if (m_options.allow_credentials)
             keys++;
 
-        const bool uv = (m_options.user_verification == UVR_REQUIRED) ||
-            (m_options.user_verification == UVR_PREFERRED && m_supportedOptions.uv);
+        const bool uv =
+            (m_options.user_verification == WAUTHN_USER_VERIFICATION_REQUIREMENT_REQUIRED) ||
+            (m_options.user_verification == WAUTHN_USER_VERIFICATION_REQUIREMENT_PREFERRED &&
+             m_supportedOptions.uv);
         if (uv)
             keys++;
 
index 928d4e42a4d1d83db8957c1a11157ee95ce4ec71..9db75fd81bc2b1b84fc0b85b2794b0c885e828b0 100644 (file)
@@ -72,7 +72,7 @@ std::string ToStr(wauthn_cose_algorithm_e alg)
 std::string ToStr(wauthn_pubkey_cred_type_e pct)
 {
     switch (pct) {
-    case PCT_PUBLIC_KEY: return "public-key";
+    case WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY: return "public-key";
     }
     return std::to_string(pct);
 }
@@ -80,9 +80,9 @@ std::string ToStr(wauthn_pubkey_cred_type_e pct)
 std::string ToStr(wauthn_authenticator_attachment_e authenticatorAttachment)
 {
     switch (authenticatorAttachment) {
-    case AA_NONE: return "none";
-    case AA_PLATFORM: return "platform";
-    case AA_CROSS_PLATFORM: return "cross-platform";
+    case WAUTHN_AUTHENTICATOR_ATTACHMENT_NONE: return "none";
+    case WAUTHN_AUTHENTICATOR_ATTACHMENT_PLATFORM: return "platform";
+    case WAUTHN_AUTHENTICATOR_ATTACHMENT_CROSS_PLATFORM: return "cross-platform";
     }
     return std::to_string(authenticatorAttachment);
 }
@@ -90,10 +90,10 @@ std::string ToStr(wauthn_authenticator_attachment_e authenticatorAttachment)
 std::string ToStr(wauthn_resident_key_requirement_e residentKeyRequirement)
 {
     switch (residentKeyRequirement) {
-    case RKR_NONE: return "none";
-    case RKR_DISCOURAGED: return "discouraged";
-    case RKR_PREFERRED: return "preferred";
-    case RKR_REQUIRED: return "required";
+    case WAUTHN_RESIDENT_KEY_REQUIREMENT_NONE: return "none";
+    case WAUTHN_RESIDENT_KEY_REQUIREMENT_DISCOURAGED: return "discouraged";
+    case WAUTHN_RESIDENT_KEY_REQUIREMENT_PREFERRED: return "preferred";
+    case WAUTHN_RESIDENT_KEY_REQUIREMENT_REQUIRED: return "required";
     }
     return std::to_string(residentKeyRequirement);
 }
@@ -101,10 +101,10 @@ std::string ToStr(wauthn_resident_key_requirement_e residentKeyRequirement)
 std::string ToStr(wauthn_user_verification_requirement_e userVerificationRequirement)
 {
     switch (userVerificationRequirement) {
-    case UVR_NONE: return "none";
-    case UVR_REQUIRED: return "required";
-    case UVR_PREFERRED: return "preferred";
-    case UVR_DISCOURAGED: return "discouraged";
+    case WAUTHN_USER_VERIFICATION_REQUIREMENT_NONE: return "none";
+    case WAUTHN_USER_VERIFICATION_REQUIREMENT_REQUIRED: return "required";
+    case WAUTHN_USER_VERIFICATION_REQUIREMENT_PREFERRED: return "preferred";
+    case WAUTHN_USER_VERIFICATION_REQUIREMENT_DISCOURAGED: return "discouraged";
     }
     return std::to_string(userVerificationRequirement);
 }
@@ -112,10 +112,10 @@ std::string ToStr(wauthn_user_verification_requirement_e userVerificationRequire
 std::string ToStr(wauthn_pubkey_cred_hint_e credHint)
 {
     switch (credHint) {
-    case PCH_NONE: return "none";
-    case PCH_SECURITY_KEY: return "security-key";
-    case PCH_CLIENT_DEVICE: return "client-device";
-    case PCH_HYBRID: return "hybrid";
+    case WAUTHN_PUBKEY_CRED_HINT_NONE: return "none";
+    case WAUTHN_PUBKEY_CRED_HINT_SECURITY_KEY: return "security-key";
+    case WAUTHN_PUBKEY_CRED_HINT_CLIENT_DEVICE: return "client-device";
+    case WAUTHN_PUBKEY_CRED_HINT_HYBRID: return "hybrid";
     }
     return std::to_string(credHint);
 }
@@ -123,10 +123,10 @@ std::string ToStr(wauthn_pubkey_cred_hint_e credHint)
 std::string ToStr(wauthn_attestation_pref_e attestationPref)
 {
     switch (attestationPref) {
-    case AP_NONE: return "none";
-    case AP_INDIRECT: return "indirect";
-    case AP_DIRECT: return "direct";
-    case AP_ENTERPRISE: return "enterprise";
+    case WAUTHN_ATTESTATION_PREF_NONE: return "none";
+    case WAUTHN_ATTESTATION_PREF_INDIRECT: return "indirect";
+    case WAUTHN_ATTESTATION_PREF_DIRECT: return "direct";
+    case WAUTHN_ATTESTATION_PREF_ENTERPRISE: return "enterprise";
     }
     return std::to_string(attestationPref);
 }
index e3969115873ef697ae93cebfb79ec2c337cfc3fd..7f86dd0b78bf0fcee3bb393f255f47dd7d6fc507 100644 (file)
@@ -198,14 +198,14 @@ public:
             } catch (const Exception::Cancelled &) {
                 if (timedOutFuture.wait_for(std::chrono::nanoseconds{0}) !=
                     std::future_status::timeout) {
-                    result = WAUTHN_ERROR_TIMEOUT; // It is already logged
+                    result = WAUTHN_ERROR_TIMED_OUT; // It is already logged
                 } else {
-                    result = WAUTHN_ERROR_CANCELLED; // It is already logged
+                    result = WAUTHN_ERROR_CANCELED; // It is already logged
                 }
             } catch (const Exception::ExceptionBase &e) {
                 result = e.Code();
             } catch (const std::bad_alloc &) {
-                result = WAUTHN_ERROR_MEMORY;
+                result = WAUTHN_ERROR_OUT_OF_MEMORY;
             } catch (const std::exception &e) {
                 TRY_LOG_ERROR("Caught unexpected exception: " << e.what());
                 result = WAUTHN_ERROR_UNKNOWN;
@@ -270,7 +270,7 @@ public:
             } catch (const Exception::ExceptionBase &e) {
                 result = e.Code();
             } catch (const std::bad_alloc &) {
-                result = WAUTHN_ERROR_MEMORY;
+                result = WAUTHN_ERROR_OUT_OF_MEMORY;
             } catch (const std::exception &e) {
                 TRY_LOG_ERROR("Caught unexpected exception: " << e.what());
                 result = WAUTHN_ERROR_UNKNOWN;
@@ -374,9 +374,9 @@ private:
             BufferView{forCallbacks.credentialRawId.data, forCallbacks.credentialRawId.size});
 
         Assign(forCallbacks.ca.id, forCallbacks.credentialId, forCallbacks.credentialIdInBase64);
-        forCallbacks.ca.type = PCT_PUBLIC_KEY;
+        forCallbacks.ca.type = WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY;
         forCallbacks.ca.response = &forCallbacks.response;
-        forCallbacks.ca.authenticator_attachment = AA_CROSS_PLATFORM;
+        forCallbacks.ca.authenticator_attachment = WAUTHN_AUTHENTICATOR_ATTACHMENT_CROSS_PLATFORM;
         forCallbacks.ca.extensions = nullptr;
         forCallbacks.ca.linked_device = AssignAndGetLinkedData(forCallbacks);
 
index 235da04fd4038e088be8b5c1b8a15679125a19be..72bdd21185ddf4b774e94dbe83b0c6d2d2fb0431 100644 (file)
@@ -98,8 +98,8 @@ auto WithDefaultMCArgs(Func &&func)
     user.display_name = "user display name";
 
     wauthn_pubkey_cred_param_s params[] = {
-        {PCT_PUBLIC_KEY, WAUTHN_COSE_ALGORITHM_ECDSA_P256_WITH_SHA256       },
-        {PCT_PUBLIC_KEY, WAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA256},
+        {WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY, WAUTHN_COSE_ALGORITHM_ECDSA_P256_WITH_SHA256       },
+        {WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY, WAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA256},
     };
     wauthn_pubkey_cred_params_s pubkeyCredParams;
     pubkeyCredParams.params = params;
@@ -126,7 +126,7 @@ auto WithDefaultGAArgs(Func &&func, const BufferView &credentialIdBytes)
     auto credentialId = ToWauthnConstBuff(credentialIdBytes);
 
     wauthn_pubkey_cred_descriptor_s pubkeyCredDescriptor;
-    pubkeyCredDescriptor.type = PCT_PUBLIC_KEY;
+    pubkeyCredDescriptor.type = WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY;
     pubkeyCredDescriptor.id = &credentialId;
     pubkeyCredDescriptor.transports = WAUTHN_TRANSPORT_INTERNAL | WAUTHN_TRANSPORT_HYBRID;
 
@@ -137,7 +137,7 @@ auto WithDefaultGAArgs(Func &&func, const BufferView &credentialIdBytes)
     wauthn_pubkey_cred_request_options_s options;
     std::memset(&options, 0, sizeof(options));
     options.rpId = "acme.com";
-    options.user_verification = UVR_REQUIRED;
+    options.user_verification = WAUTHN_USER_VERIFICATION_REQUIREMENT_REQUIRED;
     options.allow_credentials = &pubkeyCredDescriptors;
 
     return std::forward<Func>(func)(clientData, options);
index d5b1e428b3b56ccde3899973145488b42f262619..0d35534222cc523f453e94818412cc49a758c00a 100644 (file)
@@ -217,8 +217,8 @@ void TestMC(struct TestContents &testContents)
     user.display_name = USER_DISPLAY_NAME;
 
     wauthn_pubkey_cred_param_s params[] = {
-        {PCT_PUBLIC_KEY, WAUTHN_COSE_ALGORITHM_ECDSA_P256_WITH_SHA256       },
-        {PCT_PUBLIC_KEY, WAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA256},
+        {WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY, WAUTHN_COSE_ALGORITHM_ECDSA_P256_WITH_SHA256       },
+        {WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY, WAUTHN_COSE_ALGORITHM_RSASSA_PKCS1_V1_5_WITH_SHA256},
     };
     wauthn_pubkey_cred_params_s pubkeyCredParams;
     pubkeyCredParams.params = params;
@@ -231,7 +231,7 @@ void TestMC(struct TestContents &testContents)
     for (size_t i = 0; i < testContents.excludedCredentialsIds.size(); ++i) {
         excluded_credentials_wcbs[i] = ToWauthnConstBuff(testContents.excludedCredentialsIds[i]);
         excluded_credentials[i] = {
-            PCT_PUBLIC_KEY,
+            WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY,
             &excluded_credentials_wcbs[i],
             testContents.transports,
         };
@@ -242,10 +242,10 @@ void TestMC(struct TestContents &testContents)
     exclude_credentials.size = excluded_credentials.size();
 
     wauthn_authenticator_sel_cri_s authenticator_selection;
-    authenticator_selection.attachment = AA_CROSS_PLATFORM;
+    authenticator_selection.attachment = WAUTHN_AUTHENTICATOR_ATTACHMENT_CROSS_PLATFORM;
     authenticator_selection.require_resident_key = true;
-    authenticator_selection.resident_key = RKR_REQUIRED;
-    authenticator_selection.user_verification = UVR_REQUIRED;
+    authenticator_selection.resident_key = WAUTHN_RESIDENT_KEY_REQUIREMENT_REQUIRED;
+    authenticator_selection.user_verification = WAUTHN_USER_VERIFICATION_REQUIREMENT_REQUIRED;
 
     wauthn_pubkey_cred_creation_options_s mcOptions;
     std::memset(&mcOptions, 0, sizeof(mcOptions));
@@ -257,7 +257,7 @@ void TestMC(struct TestContents &testContents)
     mcOptions.authenticator_selection =
         testContents.allowNonDiscoverable ? nullptr : &authenticator_selection;
     mcOptions.hints = nullptr;
-    mcOptions.attestation = AP_NONE;
+    mcOptions.attestation = WAUTHN_ATTESTATION_PREF_NONE;
     mcOptions.attestation_formats = nullptr;
     mcOptions.extensions = nullptr;
     mcOptions.linked_device = nullptr;
@@ -285,7 +285,7 @@ void TestGA(struct TestContents &testContents)
     wauthn_const_buffer_s credentialId = ToWauthnConstBuff(credentialRawIdCopy);
 
     wauthn_pubkey_cred_descriptor_s pubkeyCredDescriptor;
-    pubkeyCredDescriptor.type = PCT_PUBLIC_KEY;
+    pubkeyCredDescriptor.type = WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY;
     pubkeyCredDescriptor.id = &credentialId;
     pubkeyCredDescriptor.transports = testContents.transports;
 
@@ -331,9 +331,9 @@ void TestGA(struct TestContents &testContents)
     gaOptions.rpId = RP_ID;
     gaOptions.allow_credentials =
         testContents.allowNonDiscoverable ? &pubkeyCredDescriptors : nullptr;
-    gaOptions.user_verification = UVR_REQUIRED;
+    gaOptions.user_verification = WAUTHN_USER_VERIFICATION_REQUIREMENT_REQUIRED;
     gaOptions.hints = nullptr;
-    gaOptions.attestation = AP_NONE;
+    gaOptions.attestation = WAUTHN_ATTESTATION_PREF_NONE;
     gaOptions.attestation_formats = nullptr;
     gaOptions.extensions = nullptr;
     gaOptions.linked_device = linkedData ? &linkedDevice : nullptr;
@@ -363,7 +363,7 @@ void MCCallback(const wauthn_pubkey_credential_attestation_s *pubkey_cred,
     std::cout << "MakeCredential: response_callback() was called."
               << std::endl; // NOLINT(performance-avoid-endl)
     auto *testContents = static_cast<TestContents *>(data);
-    if (result == WAUTHN_ERROR_TIMEOUT) {
+    if (result == WAUTHN_ERROR_TIMED_OUT) {
         std::cout << __FUNCTION__ << ": request timed out"
                   << std::endl; // NOLINT(performance-avoid-endl)
         testContents->succeeded = false;
@@ -415,7 +415,7 @@ void GACallback(const wauthn_pubkey_credential_assertion_s *pubkey_cred,
               << std::endl; // NOLINT(performance-avoid-endl)
     auto *testContents = static_cast<TestContents *>(data);
     auto lock = std::lock_guard{testContents->mutex};
-    if (result == WAUTHN_ERROR_TIMEOUT) {
+    if (result == WAUTHN_ERROR_TIMED_OUT) {
         std::cout << __FUNCTION__ << ": request timed out"
                   << std::endl; // NOLINT(performance-avoid-endl)
         testContents->succeeded = false;
index d06f212a187fcd55108c4c413b64839f5eaf2c3c..931cd5ccbccabed13e81c96c8eefc67f35c0a3fb 100644 (file)
@@ -191,7 +191,7 @@ wauthn_pubkey_cred_descriptor_s &GetPubkeyDescriptor()
         static auto credentialId = ToWauthnConstBuff(CREDENTIAL_ID_BUFFER);
 
         wauthn_pubkey_cred_descriptor_s descriptor;
-        descriptor.type = PCT_PUBLIC_KEY;
+        descriptor.type = WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY;
         descriptor.id = &credentialId;
         descriptor.transports = WAUTHN_TRANSPORT_NONE;
         return descriptor;
@@ -371,7 +371,7 @@ TEST(Messages, SerializeMakeCredential1)
     wauthn_pubkey_cred_param_s params[ALGS.size()];
     size_t idx = 0;
     for (auto alg : ALGS) {
-        params[idx].type = PCT_PUBLIC_KEY;
+        params[idx].type = WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY;
         params[idx].alg = alg;
         idx++;
     }
@@ -384,7 +384,7 @@ TEST(Messages, SerializeMakeCredential1)
     options.exclude_credentials = nullptr;
     options.authenticator_selection = nullptr; // TODO
     options.hints = nullptr;
-    options.attestation = AP_NONE;
+    options.attestation = WAUTHN_ATTESTATION_PREF_NONE;
     options.attestation_formats = nullptr;
     options.extensions = nullptr;
     options.linked_device = nullptr;
@@ -454,7 +454,7 @@ TEST(Messages, SerializeMakeCredential2)
     wauthn_pubkey_cred_param_s params[ALGS.size()];
     size_t idx = 0;
     for (auto alg : ALGS) {
-        params[idx].type = PCT_PUBLIC_KEY;
+        params[idx].type = WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY;
         params[idx].alg = alg;
         idx++;
     }
@@ -468,13 +468,13 @@ TEST(Messages, SerializeMakeCredential2)
     options.exclude_credentials = nullptr;
 
     wauthn_authenticator_sel_cri_s authenticator_selection;
-    authenticator_selection.resident_key = RKR_REQUIRED;
+    authenticator_selection.resident_key = WAUTHN_RESIDENT_KEY_REQUIREMENT_REQUIRED;
     authenticator_selection.require_resident_key = true;
-    authenticator_selection.user_verification = UVR_REQUIRED;
+    authenticator_selection.user_verification = WAUTHN_USER_VERIFICATION_REQUIREMENT_REQUIRED;
     options.authenticator_selection = &authenticator_selection;
 
     options.hints = nullptr;
-    options.attestation = AP_NONE;
+    options.attestation = WAUTHN_ATTESTATION_PREF_NONE;
     options.attestation_formats = nullptr;
     options.extensions = nullptr;
     options.linked_device = nullptr;
@@ -512,7 +512,7 @@ TEST(Messages, SerializeGetAssertion)
     wauthn_const_buffer_s desc_id0;
     desc_id0.data = credential_id0;
     desc_id0.size = sizeof(credential_id0) - 1; // -1 to remove zero-termination
-    pubkey_cred_descriptor[0].type = PCT_PUBLIC_KEY;
+    pubkey_cred_descriptor[0].type = WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY;
     pubkey_cred_descriptor[0].id = &desc_id0;
     pubkey_cred_descriptor[0].transports = WAUTHN_TRANSPORT_NONE;
 
@@ -523,7 +523,7 @@ TEST(Messages, SerializeGetAssertion)
     wauthn_const_buffer_s desc_id1;
     desc_id1.data = credential_id1;
     desc_id1.size = sizeof(credential_id1) - 1; // -1 to remove zero-termination
-    pubkey_cred_descriptor[1].type = PCT_PUBLIC_KEY;
+    pubkey_cred_descriptor[1].type = WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY;
     pubkey_cred_descriptor[1].id = &desc_id1;
     pubkey_cred_descriptor[1].transports = WAUTHN_TRANSPORT_NONE;
 
@@ -536,9 +536,9 @@ TEST(Messages, SerializeGetAssertion)
     options.timeout = 0; // not serialized
     options.rpId = rp_id;
     options.allow_credentials = &pubkey_cred_descriptors;
-    options.user_verification = UVR_REQUIRED;
+    options.user_verification = WAUTHN_USER_VERIFICATION_REQUIREMENT_REQUIRED;
     options.hints = nullptr;
-    options.attestation = AP_NONE;
+    options.attestation = WAUTHN_ATTESTATION_PREF_NONE;
     options.attestation_formats = nullptr;
     options.extensions = nullptr;
     options.linked_device = nullptr;
index fab399afe316aee56154b827a786e7950c61a94f..f41f00a5e8a4cfbba9b95b8d0097b12d8dd2b68b 100644 (file)
@@ -702,7 +702,7 @@ TEST(RequestHandler, perform_transaction_throws_std_bad_alloc)
         },
         [](auto &test) {
             EXPECT_EQ(test.called, "response_callback;");
-            EXPECT_EQ(test.responseCallbackRes, WAUTHN_ERROR_MEMORY);
+            EXPECT_EQ(test.responseCallbackRes, WAUTHN_ERROR_OUT_OF_MEMORY);
         });
 }
 
@@ -908,7 +908,7 @@ struct ResponseCallbackArgumentsTest {
             EXPECT_EQ(result, WAUTHN_ERROR_NONE);
 
             ASSERT_NE(pubkeyCred, nullptr);
-            EXPECT_EQ(pubkeyCred->type, PCT_PUBLIC_KEY);
+            EXPECT_EQ(pubkeyCred->type, WAUTHN_PUBKEY_CRED_TYPE_PUBLIC_KEY);
 
             ASSERT_NE(pubkeyCred->response, nullptr);
             EXPECT_EQ(pubkeyCred->response->client_data_json, BUFFER_VIEW(EXAMPLE_CLIENT_JSON));
@@ -938,7 +938,8 @@ struct ResponseCallbackArgumentsTest {
                 EXPECT_EQ(pubkeyCred->id, ToBufferView(idInBase64));
             }
 
-            EXPECT_EQ(pubkeyCred->authenticator_attachment, AA_CROSS_PLATFORM);
+            EXPECT_EQ(pubkeyCred->authenticator_attachment,
+                      WAUTHN_AUTHENTICATOR_ATTACHMENT_CROSS_PLATFORM);
             EXPECT_EQ(pubkeyCred->extensions, nullptr);
 
             if (test.addLinkedData) {
@@ -1196,7 +1197,7 @@ void TestCancellationFromTheOtherThread()
             if (test.responseCallbackRes == WAUTHN_ERROR_NONE) {
                 EXPECT_EQ(test.called, "response_callback;linked_data_callback;");
                 EXPECT_EQ(test.linkedDataCallbackRes, WAUTHN_ERROR_NONE);
-            } else if (test.responseCallbackRes == WAUTHN_ERROR_CANCELLED) {
+            } else if (test.responseCallbackRes == WAUTHN_ERROR_CANCELED) {
                 EXPECT_EQ(test.called, "response_callback;");
                 throw Exception::Cancelled{};
             } else {
@@ -1317,7 +1318,7 @@ TEST(RequestHandler, timeout)
             auto duration = std::chrono::steady_clock::now() - tp;
 
             EXPECT_EQ(test.called, "response_callback;");
-            EXPECT_EQ(test.responseCallbackRes, WAUTHN_ERROR_TIMEOUT);
+            EXPECT_EQ(test.responseCallbackRes, WAUTHN_ERROR_TIMED_OUT);
 
             EXPECT_GE(duration, std::chrono::milliseconds{timeoutInMilliseconds});
             EXPECT_LT(duration, std::chrono::milliseconds{timeoutInMilliseconds + 300});