Fix typos 75/308575/4
authorKrzysztof Malysa <k.malysa@samsung.com>
Wed, 27 Mar 2024 18:11:38 +0000 (19:11 +0100)
committerKrzysztof Malysa <k.malysa@samsung.com>
Thu, 28 Mar 2024 13:20:27 +0000 (14:20 +0100)
Change-Id: Ib135c77a6f900ae1b24471dc28c2fdddc6d6146e

25 files changed:
include/webauthn-hal.h
include/webauthn-types.h
include/webauthn.h
srcs/client/client-request-mc.h
srcs/common/CMakeLists.txt
srcs/common/errno_string.cpp
srcs/common/message-buffer.h
srcs/common/serialization.cpp
srcs/common/serialization.h
srcs/common/singleton.h
srcs/common/wauth-error.cpp [deleted file]
srcs/common/wauthn-error.cpp [new file with mode: 0644]
srcs/server/main.cpp
srcs/server/request-ga.h
srcs/server/request-mc.h
srcs/server/request.h
srcs/server/service.cpp
srcs/server/service.h
srcs/server/socket-manager.cpp
tests/client-request-test.cpp
tests/file-lock-test.cpp
tests/serialization-test.cpp
tests/socket-manager-test.cpp
tests/test-common.cpp
tests/test-common.h

index fd0bf94fcda7cc59f119914ae969a892df394e3b..2f940ef362c2c8060f340e62d7f4156a07deb54a 100644 (file)
@@ -15,7 +15,7 @@
  *
  * @file    webauthn-hal.h
  * @version 1.0
- * @brief   APIs for hardware abrstraction layer of WebAuthn Authenticator.
+ * @brief   APIs for hardware abstraction layer of WebAuthn Authenticator.
 */
 #ifndef __WEBAUTHN_HAL__
 #define __WEBAUTHN_HAL__
@@ -29,7 +29,7 @@ extern "C" {
 #define WEBAUTHN_HAL_API __attribute__((visibility("default")))
 
 /**
- * @brief Library path of the plugin implemenation for hybrid transport
+ * @brief Library path of the plugin implementation for hybrid transport
  */
 #define WAH_PLUGIN_SO_PATH_HYBRID HYBRID_PLUGIN_SO_PATH
 
index e528b1667528be6060bd78979422359291c3fb2d..9f696e1c0162e1410dfc4851ba492192663434fa 100644 (file)
@@ -35,7 +35,7 @@ extern "C" {
  * @{
  */
 
-#define WATUH_API_VERSION_NUMBER                                   0x00000001
+#define WAUTHN_API_VERSION_NUMBER                                   0x00000001
 
 /**
  * @brief WebAuthn Errors.
@@ -79,7 +79,7 @@ WEBAUTHN_API const char * wauthn_error_to_string(int error);
  * @remarks Multiple transport values can be combined using bit-wise operation.
  */
 typedef enum __wauthn_authenticator_transport {
-    WAUTHN_TRANSPORT_NONE                   = 0x00000000, /**< No tranport specificed */
+    WAUTHN_TRANSPORT_NONE                   = 0x00000000, /**< No transport specified */
     WAUTHN_TRANSPORT_USB                    = 0x00000001, /**< "usb" */
     WAUTHN_TRANSPORT_NFC                    = 0x00000002, /**< "nfc" */
     WAUTHN_TRANSPORT_BLE                    = 0x00000004, /**< "ble" */
@@ -226,7 +226,7 @@ typedef struct __wauthn_const_buffer {
  *          https://www.w3.org/TR/webauthn-3/#authenticatorattestationresponse
  *
  * @see wauthn_make_credential()
- * @see #wauthn_pubkey_credential_attestaion_s
+ * @see #wauthn_pubkey_credential_attestation_s
  * @see #wauthn_authenticator_transport_e
  * @see #wauthn_cose_algorithm_e
  */
@@ -249,13 +249,13 @@ typedef struct __wauthn_authenticator_attestation_response {
 } wauthn_authenticator_attestation_response_s;
 
 /**
- * @brief The structure for response of wauthn_get_assersion.
+ * @brief The structure for response of wauthn_get_assertion.
  * @since_tizen 9.0
  *
  * @remarks Refer to the following W3C specification for more information.
  *          https://www.w3.org/TR/webauthn-3/#authenticatorassertionresponse
  *
- * @see wauthn_get_assersion()
+ * @see wauthn_get_assertion()
  * @see #wauthn_pubkey_credential_assertion_s
  */
 typedef struct __wauthn_authenticator_assertion_response {
@@ -332,7 +332,7 @@ typedef struct __wauthn_pubkey_cred_params {
     size_t size;  /**<
         the number of params */
     wauthn_pubkey_cred_param_s *params; /**<
-        the sequenece of #wauthn_pubkey_cred_param_s */
+        the sequence of #wauthn_pubkey_cred_param_s */
 } wauthn_pubkey_cred_params_s;
 
 /**
@@ -363,7 +363,7 @@ typedef struct __wauthn_pubkey_cred_descriptors {
     size_t size; /**<
         the number of descriptors */
     wauthn_pubkey_cred_descriptor_s *descriptors; /**<
-        the sequenece of #wauthn_pubkey_cred_descriptor_s */
+        the sequence of #wauthn_pubkey_cred_descriptor_s */
 } wauthn_pubkey_cred_descriptors_s;
 
 /**
@@ -392,7 +392,7 @@ typedef struct __wauthn_authentication_exts {
     size_t size; /**<
         the number of extensions */
     wauthn_authentication_ext_s *extensions; /**<
-        the sequenece of #wauthn_authentication_ext_s */
+        the sequence of #wauthn_authentication_ext_s */
 } wauthn_authentication_exts_s;
 
 /**
@@ -410,7 +410,7 @@ typedef struct __wauthn_authenticator_sel_cri {
     wauthn_authenticator_attachment_e attachment; /**<
         Authenticator attachment modality*/
     wauthn_resident_key_requirement_e resident_key; /**<
-        Specifies the extent to which the Relying Party desires to create a client-side discoverable credentialy*/
+        Specifies the extent to which the Relying Party desires to create a client-side discoverable credential*/
     bool require_resident_key; /**<
         Relying Parties SHOULD set it to true if, and only if, residentKey is set to required.*/
     wauthn_user_verification_requirement_e user_verification; /**<
@@ -426,20 +426,20 @@ typedef struct __wauthn_pubkey_cred_hints {
     size_t size; /**<
         the number of hints */
     wauthn_pubkey_cred_hint_e *hints; /**<
-        the sequenece of #wauthn_pubkey_cred_hint_e */
+        the sequence of #wauthn_pubkey_cred_hint_e */
 } wauthn_pubkey_cred_hints_s;
 
 /**
  * @brief The structure for a linked device data.
  * @since_tizen 9.0
  *
- * @remarks The linked device data is used for state assisited transaction.
- *          From the successful QR initiated transcation, the linked device data
+ * @remarks The linked device data is used for state assisted transaction.
+ *          From the successful QR initiated transaction, the linked device data
  *          might be returned from an authenticator to a webauthn client
- *          via #wauthn_pubkey_credential_attestaion_s or #wauthn_pubkey_credential_assertion_s.
+ *          via #wauthn_pubkey_credential_attestation_s or #wauthn_pubkey_credential_assertion_s.
  *          Then the client can store the linked device data and use it in the next call
  *          for #wauthn_pubkey_cred_creation_options_s or #wauthn_pubkey_cred_request_options_s.
- *          Then the stated assisted transction will start instead of QR initiated transtion.
+ *          Then the stated assisted transaction will start instead of QR initiated transaction.
  *
  * @remarks For more information, find a section with the keyword, "linking map",
  *          from the following specification.
@@ -478,7 +478,7 @@ typedef struct __wauthn_attestation_formats {
     size_t size; /**<
         the number of attestation_formats */
     wauthn_const_buffer_s *attestation_formats; /**<
-        the sequenece of #wauthn_const_buffer_s */
+        the sequence of #wauthn_const_buffer_s */
 } wauthn_attestation_formats_s;
 
 /**
@@ -592,7 +592,7 @@ typedef struct __wauthn_pubkey_cred_request_options {
  * @see #wauthn_authentication_exts_s
  * @see #wauthn_hybrid_linked_data_s
  */
-typedef struct __wauthn_pubkey_credential_attestaion {
+typedef struct __wauthn_pubkey_credential_attestation {
     wauthn_const_buffer_s *id; /**<
         The based64url encoding of credential’s identifier.*/
     wauthn_pubkey_cred_type_e type; /**<
@@ -608,7 +608,7 @@ typedef struct __wauthn_pubkey_credential_attestaion {
         upon the Relying Party's invocation of #wauthn_make_credential(). (optional)*/
     wauthn_hybrid_linked_data_s *linked_device; /**<
         Linked Device Connection Info (optional) */
-} wauthn_pubkey_credential_attestaion_s;
+} wauthn_pubkey_credential_attestation_s;
 
 /**
  * @brief The structure for a publickey_credential response for wauthn_get_assertion().
@@ -709,15 +709,15 @@ typedef void (*wauthn_cb_display_qrcode)(const char *qr_contents, void *user_dat
  * @brief Invoked when the response for the make credential request need to be returned.
  * @since_tizen 9.0
  * @param[in] pubkey_cred The publickey credential contains response data.
- * @param[in] result The result of the #wauthn_make_credential reqeust.
+ * @param[in] result The result of the #wauthn_make_credential request.
  *                   #WAUTHN_ERROR_NONE if the request is completed well,
  *                   #WAUTHN_ERROR_CANCELLED if the request is cancelled by #wauthn_cancel request.
  * @param[in] user_data The user data passed from the callback structure, #wauthn_mc_callbacks_s.
 
  * @see #wauthn_mc_callbacks_s
- * @see #wauthn_pubkey_credential_attestaion_s
+ * @see #wauthn_pubkey_credential_attestation_s
  */
-typedef void (*wauthn_cb_mc_on_response)(const wauthn_pubkey_credential_attestaion_s *pubkey_cred,
+typedef void (*wauthn_cb_mc_on_response)(const wauthn_pubkey_credential_attestation_s *pubkey_cred,
                                       wauthn_error_e result,
                                       void *user_data);
 
@@ -725,7 +725,7 @@ typedef void (*wauthn_cb_mc_on_response)(const wauthn_pubkey_credential_attestai
  * @brief Invoked when the response for the get assertion request need to be returned.
  * @since_tizen 9.0
  * @param[in] pubkey_cred The publickey credential contains response data.
- * @param[in] result The result of the reqeust.
+ * @param[in] result The result of the request.
  *                   #WAUTHN_ERROR_NONE if the request is completed well,
  *                   #WAUTHN_ERROR_CANCELLED if the request is cancelled by #wauthn_cancel request.
  * @param[in] user_data The user data passed from the callback structure, #wauthn_ga_callbacks_s.
index fc0d89377ff22eaeb6133e7c2d185e7bf3ad5ba9..3b14e3a50e812546f1af831482ce53735273829f 100644 (file)
@@ -43,7 +43,7 @@ extern "C" {
  * @remarks This API must be called before other APIs are called.
  *
  * @param[in] api_version_number API version number to set.
- *                Use #WATUH_API_VERSION_NUMBER as an input.
+ *                Use #WAUTHN_API_VERSION_NUMBER as an input.
  *
  * @return @c 0 on success,
  *         otherwise a negative error value
index c5a31704472e1413519fa7386771accc541edc19..445fbff6179b4ca1384c8465f6edc22cbb5bb2fe 100644 (file)
@@ -29,7 +29,7 @@ class ClientRequestMC : public ClientRequest {
 public:
     typedef wauthn_pubkey_cred_creation_options_s Options;
     typedef wauthn_mc_callbacks_s Callbacks;
-    typedef wauthn_pubkey_credential_attestaion_s PubKeyCred;
+    typedef wauthn_pubkey_credential_attestation_s PubKeyCred;
 
     explicit ClientRequestMC() : ClientRequest(WebAuthnCall::MAKE_CREDENTIAL)
     {
index 026ba8dfc0e19daf93ab560256989b6e66b5e943..7757020311fc823d985b2f96871a126a4a460ebe 100644 (file)
@@ -8,7 +8,7 @@ SET(COMMON_VERSION_MAJOR ${VERSION_MAJOR})
 SET(COMMON_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
 
 SET(COMMON_SOURCES
-    ${CMAKE_CURRENT_SOURCE_DIR}/wauth-error.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/wauthn-error.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/singleton.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/webauthn-log.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/exception.cpp
index 4372bdf464dc2ed73c22267fce95847f8b38f18c..0606b28df501c83e134b8a6a761b6ab2871d7b2d 100644 (file)
@@ -43,7 +43,7 @@ std::string GetErrnoString(int error)
     char *buffer = NULL;
 
     for (;;) {
-        // Add one extra characted for end of string null value
+        // Add one extra character for end of string null value
         char *newBuffer = static_cast<char *>(::realloc(buffer, size + 1));
 
         if (!newBuffer) {
@@ -86,7 +86,7 @@ std::string GetErrnoString(int error)
 
         case ERANGE:
             if (size <= (sizeof(size_t) >> 1)){
-                // Incease buffer size and retry
+                // Increase buffer size and retry
                 size <<= 1;
                 continue;
             }
index 469844d2919b860adbcfd61bb3276540b7167940..8ed2657b2e324e2106b01410b27d225f1afcdfc5 100644 (file)
@@ -16,7 +16,7 @@
  *
  * @file        message-buffer.h
  * @version     1.0
- * @brief       Implementatin of MessageBuffer.
+ * @brief       Implementation of MessageBuffer.
  */
 
 #pragma once
index 6420d0fcf54c768f264b6fa2d0e1704f6aac3208..8335da0bc488af710bfe61c29ef4719b83c2d30e 100644 (file)
@@ -41,8 +41,8 @@ void __checkArraySize(size_t size) {
 
 // For struct body itself
 void WAuthnCtypeSerializer::serializeStructBody(IStream& stream, const void *data, size_t struct_size) {
-    size_t lengh = (data == nullptr) ? 0 : struct_size;
-    serialize(stream, reinterpret_cast<const unsigned char*>(data), lengh);
+    size_t length = (data == nullptr) ? 0 : struct_size;
+    serialize(stream, reinterpret_cast<const unsigned char*>(data), length);
 }
 void WAuthnCtypeSerializer::deserializeStructBody(IStream& stream, void **data, size_t struct_size) {
     if (data == nullptr)
@@ -134,41 +134,41 @@ void __checkValidity(const wauthn_const_buffer_s* data) {
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_const_buffer_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_const_buffer_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     serialize(stream, data->data, data->size);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_const_buffer_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void**>(data), sizeof(wauthn_const_buffer_s));
     __checkValidity(*data);
     if (*data == nullptr)
         return;
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     deserialize(stream, &((*data)->data), &((*data)->size));
 }
 
 // For wauthn_authenticator_attestation_response_s
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_authenticator_attestation_response_s* data) {
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_authenticator_attestation_response_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     serialize(stream, data->client_data_json);
     serialize(stream, data->attestation_object);
     serialize(stream, data->authenticator_data);
     serialize(stream, data->subject_pubkey_info);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authenticator_attestation_response_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_authenticator_attestation_response_s));
     if (*data == nullptr)
         return;
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     deserialize(stream, &((*data)->client_data_json));
     deserialize(stream, &((*data)->attestation_object));
     deserialize(stream, &((*data)->authenticator_data));
@@ -177,11 +177,11 @@ void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authenticator_at
 
 // For wauthn_authenticator_assertion_response_s
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_authenticator_assertion_response_s* data) {
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_authenticator_assertion_response_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     serialize(stream, data->client_data_json);
     serialize(stream, data->authenticator_data);
     serialize(stream, data->signature);
@@ -189,11 +189,11 @@ void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_authenticato
     serialize(stream, data->attestation_object);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authenticator_assertion_response_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_authenticator_assertion_response_s));
     if (*data == nullptr)
         return;
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     deserialize(stream, &((*data)->client_data_json));
     deserialize(stream, &((*data)->authenticator_data));
     deserialize(stream, &((*data)->signature));
@@ -203,41 +203,41 @@ void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authenticator_as
 
 // For wauthn_rp_entity_s
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_rp_entity_s* data) {
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_rp_entity_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     serialize(stream, data->name);
     serialize(stream, data->id);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_rp_entity_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_rp_entity_s));
     if (*data == nullptr)
         return;
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     deserialize(stream, &((*data)->name));
     deserialize(stream, &((*data)->id));
 }
 
 // For wauthn_user_entity_s
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_user_entity_s* data) {
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_user_entity_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     serialize(stream, data->name);
     serialize(stream, data->id);
     serialize(stream, data->display_name);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_user_entity_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_user_entity_s));
     if (*data == nullptr)
         return;
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     deserialize(stream, &((*data)->name));
     deserialize(stream, &((*data)->id));
     deserialize(stream, &((*data)->display_name));
@@ -275,12 +275,12 @@ void __checkValidity(const wauthn_pubkey_cred_param_s* data) {
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_param_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_param_s));
     // No pointers in struct
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_param_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_param_s));
     __checkValidity(*data);
     // No pointers in struct
@@ -297,7 +297,7 @@ void __checkValidity(const wauthn_pubkey_cred_params_s* data) {
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_params_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_params_s));
     if (data == nullptr)
         return;
@@ -306,7 +306,7 @@ void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_
         __serializeArrayItem(stream, reinterpret_cast<const void *>(data->params + i), sizeof(wauthn_pubkey_cred_params_s));
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_params_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_params_s));
     if (*data == nullptr)
         return;
@@ -314,7 +314,7 @@ void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_para
         (*data)->params = nullptr;
     }
     __checkValidity(*data);
-    // Deseriallize array
+    // Deserialize array
     wauthn_pubkey_cred_param_s* tmp;
     for(size_t i=0; i < (*data)->size; i++ ) {
         __deserializeArrayItem(stream, reinterpret_cast<void **>(&tmp), sizeof(wauthn_pubkey_cred_params_s));
@@ -337,20 +337,20 @@ void __deserializePointerContents(IStream& stream, wauthn_pubkey_cred_descriptor
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_descriptor_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_descriptor_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     __serializePointerContents(stream, data);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_descriptor_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_descriptor_s));
     if (*data == nullptr)
         return;
     __checkValidity(*data);
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     __deserializePointerContents(stream, *data);
 }
 
@@ -365,19 +365,19 @@ void __checkValidity(const wauthn_pubkey_cred_descriptors_s* data) {
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_descriptors_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_descriptors_s));
     if (data == nullptr)
         return;
     // Serialize array
     for(size_t i=0; i < data->size; i++ )
         __serializeArrayItem(stream, reinterpret_cast<const void *>(data->descriptors + i), sizeof(wauthn_pubkey_cred_descriptor_s));
-    // Seriallize the contents of pointers in struct array
+    // Serialize the contents of pointers in struct array
     for(size_t i=0; i < data->size; i++ )
         __serializePointerContents(stream, data->descriptors + i);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_descriptors_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_descriptors_s));
     if (*data == nullptr)
         return;
@@ -386,14 +386,14 @@ void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_desc
         (*data)->descriptors = nullptr;
         return;
     }
-    // Deseriallize array
+    // Deserialize array
     wauthn_pubkey_cred_descriptor_s* tmp;
     for(size_t i=0; i < (*data)->size; i++ ) {
         __deserializeArrayItem(stream, reinterpret_cast<void **>(&tmp), sizeof(wauthn_pubkey_cred_descriptor_s));
         if (i == 0) // set pointer to the first parameter
             (*data)->descriptors = tmp;
     }
-    // Deseriallize the contents of pointers in struct array
+    // Deserialize the contents of pointers in struct array
     for(size_t i=0; i < (*data)->size; i++ )
         __deserializePointerContents(stream, (*data)->descriptors + i);
 }
@@ -408,19 +408,19 @@ void __deserializePointerContents(IStream& stream, wauthn_authentication_ext_s*
     WAuthnCtypeSerializer::deserialize(stream, &(data->extension_value));
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_authentication_ext_s* data) {
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_authentication_ext_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     __serializePointerContents(stream, data);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authentication_ext_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_authentication_ext_s));
     if (*data == nullptr)
         return;
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     __deserializePointerContents(stream, *data);
 }
 
@@ -435,19 +435,19 @@ void __checkValidity(const wauthn_authentication_exts_s* data) {
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_authentication_exts_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_authentication_exts_s));
     if (data == nullptr)
         return;
     // Serialize array
     for(size_t i=0; i < data->size; i++ )
         __serializeArrayItem(stream, reinterpret_cast<const void *>(data->extensions + i), sizeof(wauthn_authentication_ext_s));
-    // Seriallize the contents of pointers in struct array
+    // Serialize the contents of pointers in struct array
     for(size_t i=0; i < data->size; i++ )
         __serializePointerContents(stream, data->extensions + i);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authentication_exts_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_authentication_exts_s));
     if (*data == nullptr)
         return;
@@ -456,14 +456,14 @@ void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authentication_e
         (*data)->extensions = nullptr;
         return;
     }
-    // Deseriallize array
+    // Deserialize array
     wauthn_authentication_ext_s* tmp;
     for(size_t i=0; i < (*data)->size; i++ ) {
         __deserializeArrayItem(stream, reinterpret_cast<void **>(&tmp), sizeof(wauthn_authentication_ext_s));
         if (i == 0) // set pointer to the first parameter
             (*data)->extensions = tmp;
     }
-    // Deseriallize the contents of pointers in struct array
+    // Deserialize the contents of pointers in struct array
     for(size_t i=0; i < (*data)->size; i++ )
         __deserializePointerContents(stream, (*data)->extensions + i);
 }
@@ -513,12 +513,12 @@ void __checkValidity(const wauthn_authenticator_sel_cri_s* data) {
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_authenticator_sel_cri_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_authenticator_sel_cri_s));
     // No pointers in struct
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_authenticator_sel_cri_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_authenticator_sel_cri_s));
     __checkValidity(*data);
     // No pointers in struct
@@ -549,7 +549,7 @@ void __checkValidity(const wauthn_pubkey_cred_hints_s* data) {
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_hints_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_hints_s));
     if (data == nullptr)
         return;
@@ -558,7 +558,7 @@ void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_
         __serializeArrayItem(stream, reinterpret_cast<const void *>(data->hints + i), sizeof(wauthn_pubkey_cred_hint_e));
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_hints_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_hints_s));
     if (*data == nullptr)
         return;
@@ -567,7 +567,7 @@ void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_hint
         return;
     }
     __checkValidity(*data);
-    // Deseriallize array
+    // Deserialize array
     wauthn_pubkey_cred_hint_e* tmp;
     for(size_t i=0; i < (*data)->size; i++ ) {
         __deserializeArrayItem(stream, reinterpret_cast<void **>(&tmp), sizeof(wauthn_pubkey_cred_hint_e));
@@ -579,11 +579,11 @@ void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_hint
 
 // For wauthn_hybrid_linked_data_s
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_hybrid_linked_data_s* data) {
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_hybrid_linked_data_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     serialize(stream, data->contact_id);
     serialize(stream, data->link_id);
     serialize(stream, data->link_secret);
@@ -594,11 +594,11 @@ void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_hybrid_linke
     serialize(stream, data->tunnel_server_domain);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_hybrid_linked_data_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_hybrid_linked_data_s));
     if (*data == nullptr)
         return;
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     deserialize(stream, &((*data)->contact_id));
     deserialize(stream, &((*data)->link_id));
     deserialize(stream, &((*data)->link_secret));
@@ -626,19 +626,19 @@ void __deserializePointerContents(IStream& stream, wauthn_const_buffer_s* data)
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_attestation_formats_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_attestation_formats_s));
     if (data == nullptr)
         return;
     // Serialize array
     for(size_t i=0; i < data->size; i++ )
         __serializeArrayItem(stream, reinterpret_cast<const void *>(data->attestation_formats + i), sizeof(wauthn_const_buffer_s));
-    // Seriallize the contents of pointers in struct array
+    // Serialize the contents of pointers in struct array
     for(size_t i=0; i < data->size; i++ )
         __serializePointerContents(stream, data->attestation_formats + i);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_attestation_formats_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_attestation_formats_s));
     if (*data == nullptr)
         return;
@@ -647,14 +647,14 @@ void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_attestation_form
         return;
     }
     __checkValidity(*data);
-    // Deseriallize array
+    // Deserialize array
     wauthn_const_buffer_s* tmp;
     for(size_t i=0; i < (*data)->size; i++ ) {
         __deserializeArrayItem(stream, reinterpret_cast<void **>(&tmp), sizeof(wauthn_const_buffer_s));
         if (i == 0) // set pointer to the first parameter
             (*data)->attestation_formats = tmp;
     }
-    // Deseriallize the contents of pointers in struct array
+    // Deserialize the contents of pointers in struct array
     for(size_t i=0; i < (*data)->size; i++ )
         __deserializePointerContents(stream, (*data)->attestation_formats + i);
 }
@@ -679,11 +679,11 @@ void __checkValidity(const wauthn_pubkey_cred_creation_options_s* data) {
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_creation_options_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_creation_options_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     serialize(stream, data->rp);
     serialize(stream, data->user);
     serialize(stream, data->pubkey_cred_params);
@@ -695,12 +695,12 @@ void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_
     serialize(stream, data->linked_device);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_creation_options_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_creation_options_s));
     if (*data == nullptr)
         return;
     __checkValidity(*data);
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     deserialize(stream, &((*data)->rp));
     deserialize(stream, &((*data)->user));
     deserialize(stream, &((*data)->pubkey_cred_params));
@@ -721,11 +721,11 @@ void __checkValidity(const wauthn_pubkey_cred_request_options_s* data) {
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_request_options_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_cred_request_options_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     serialize(stream, data->rpId);
     serialize(stream, data->allow_credentials);
     serialize(stream, data->hints);
@@ -734,12 +734,12 @@ void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_cred_
     serialize(stream, data->linked_device);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_request_options_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_cred_request_options_s));
     if (*data == nullptr)
         return;
     __checkValidity(*data);
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     deserialize(stream, &((*data)->rpId));
     deserialize(stream, &((*data)->allow_credentials));
     deserialize(stream, &((*data)->hints));
@@ -748,33 +748,33 @@ void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_cred_requ
     deserialize(stream, &((*data)->linked_device));
 }
 
-// For wauthn_pubkey_credential_attestaion_s
-void __checkValidity(const wauthn_pubkey_credential_attestaion_s* data) {
+// For wauthn_pubkey_credential_attestation_s
+void __checkValidity(const wauthn_pubkey_credential_attestation_s* data) {
     if (data == nullptr)
         return;
     __checkValidity(data->type);
     __checkValidity(data->authenticator_attachment);
 }
-void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_credential_attestaion_s* data) {
+void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_credential_attestation_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
-    serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_credential_attestaion_s));
+    // Serialize struct itself
+    serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_credential_attestation_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     serialize(stream, data->id);
     serialize(stream, data->rawId);
     serialize(stream, data->response);
     serialize(stream, data->extensions);
     serialize(stream, data->linked_device);
 }
-void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_credential_attestaion_s** data) {
-    // Deseriallize struct itself
-    deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_credential_attestaion_s));
+void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_credential_attestation_s** data) {
+    // Deserialize struct itself
+    deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_credential_attestation_s));
     if (*data == nullptr)
         return;
     __checkValidity(*data);
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     deserialize(stream, &((*data)->id));
     deserialize(stream, &((*data)->rawId));
     deserialize(stream, &((*data)->response));
@@ -791,11 +791,11 @@ void __checkValidity(const wauthn_pubkey_credential_assertion_s* data) {
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_credential_assertion_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_pubkey_credential_assertion_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     serialize(stream, data->id);
     serialize(stream, data->rawId);
     serialize(stream, data->response);
@@ -803,12 +803,12 @@ void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_pubkey_crede
     serialize(stream, data->linked_device);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_pubkey_credential_assertion_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_pubkey_credential_assertion_s));
     if (*data == nullptr)
         return;
     __checkValidity(*data);
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     deserialize(stream, &((*data)->id));
     deserialize(stream, &((*data)->rawId));
     deserialize(stream, &((*data)->response));
@@ -833,20 +833,20 @@ void __checkValidity(const wauthn_client_data_s* data) {
 }
 void WAuthnCtypeSerializer::serialize(IStream& stream, const wauthn_client_data_s* data) {
     __checkValidity(data);
-    // Seriallize struct itself
+    // Serialize struct itself
     serializeStructBody(stream, reinterpret_cast<const void *>(data), sizeof(wauthn_client_data_s));
     if (data == nullptr)
         return;
-    // Seriallize the contents of struct's pointers
+    // Serialize the contents of struct's pointers
     serialize(stream, data->client_data_json);
 }
 void WAuthnCtypeSerializer::deserialize(IStream& stream, wauthn_client_data_s** data) {
-    // Deseriallize struct itself
+    // Deserialize struct itself
     deserializeStructBody(stream, reinterpret_cast<void **>(data), sizeof(wauthn_client_data_s));
     if (*data == nullptr)
         return;
     __checkValidity(*data);
-    // Deseriallize the contents of struct's pointers
+    // Deserialize the contents of struct's pointers
     deserialize(stream, &((*data)->client_data_json));
 }
 
index ed9dfd94b1aeeb2e8ab9f7a9c4038c5f3a341e43..4bd510235f07ee4e43ca04ef92677624a4ed2089 100644 (file)
@@ -64,7 +64,7 @@ class SerializeKeysAsVector
 const size_t MAX_BUFFER_SIZE = 128 * 1024 * 1024; // 128 MB
 const size_t MAX_ARRAY_COUNT = 1024;
 
-// Serialize & Deserialze struct types in wetauthn-types.h
+// Serialize & Deserialize struct types in webauthn-types.h
 struct WAuthnCtypeSerializer {
 private:
     static void serializeStructBody(IStream& stream, const void *data, size_t struct_size);
@@ -131,8 +131,8 @@ public:
     static void serialize(IStream& stream, const wauthn_pubkey_cred_request_options_s* data);
     static void deserialize(IStream& stream, wauthn_pubkey_cred_request_options_s** data);
 
-    static void serialize(IStream& stream, const wauthn_pubkey_credential_attestaion_s* data);
-    static void deserialize(IStream& stream, wauthn_pubkey_credential_attestaion_s** data);
+    static void serialize(IStream& stream, const wauthn_pubkey_credential_attestation_s* data);
+    static void deserialize(IStream& stream, wauthn_pubkey_credential_attestation_s** data);
 
     static void serialize(IStream& stream, const wauthn_pubkey_credential_assertion_s* data);
     static void deserialize(IStream& stream, wauthn_pubkey_credential_assertion_s** data);
@@ -452,8 +452,8 @@ struct Serialization {
     {
         WAuthnCtypeSerializer::serialize(stream, data);
     }
-    // For wauthn_pubkey_credential_attestaion_s
-    static void Serialize(IStream& stream, const wauthn_pubkey_credential_attestaion_s* data)
+    // For wauthn_pubkey_credential_attestation_s
+    static void Serialize(IStream& stream, const wauthn_pubkey_credential_attestation_s* data)
     {
         WAuthnCtypeSerializer::serialize(stream, data);
     }
@@ -737,7 +737,7 @@ struct Deserialization {
     // 2. The returned data(more exactly *data) points to somewhere of m_buffer of MessageBuffer.
     //    So the returned data is only valid while the stream is alive.
     //###########################################################################################
-    // This convers all other C types.
+    // This converts all other C types.
     template<typename T>
     static void Deserialize(IStream& stream, T** data)
     {
index a456984cbac0898d7c13d5567073f4aca3aeaa46..688c1c9ec1c6ab95f92de5e8060543ba8a9e7f1d 100644 (file)
@@ -29,7 +29,7 @@ class Singleton :
     //
     // Note:
     //
-    // To remove posibility of instantiating directly Class,
+    // To remove possibility of instantiating directly Class,
     // make Class' default constructor protected
     //
 
diff --git a/srcs/common/wauth-error.cpp b/srcs/common/wauth-error.cpp
deleted file mode 100644 (file)
index fe35c19..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *  Copyright (c) 2023 Samsung Electronics Co., Ltd. All rights reserved
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License
- */
-/*
- * @file       wauth-error.cpp
- * @version    1.0
- * @brief      Error related functions
- */
-
-#include <webauthn.h>
-
-
-#define WAUTHN_CODE_DESCRIBE(name) case name: return #name
-
-const char * wauthn_error_to_string(int error) {
-    switch (error) {
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NONE);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_UNKNOWN);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_INVALID_PARAMETER);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_PERMISSION_DENIED);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NOT_SUPPORTED);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NOT_ALLOWED);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_INVALID_STATE);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_ENCODING_FAILED);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_SOCKET);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NO_SUCH_SERVICE);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_ACCESS_DENIED);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_MEMORY);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_CANCELLED);
-        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_TIMEOUT);
-        default: return "Code not defined";
-    }
-}
diff --git a/srcs/common/wauthn-error.cpp b/srcs/common/wauthn-error.cpp
new file mode 100644 (file)
index 0000000..1810efa
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ *  Copyright (c) 2023 Samsung Electronics Co., Ltd. All rights reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License
+ */
+/*
+ * @file       wauthn-error.cpp
+ * @version    1.0
+ * @brief      Error related functions
+ */
+
+#include <webauthn.h>
+
+
+#define WAUTHN_CODE_DESCRIBE(name) case name: return #name
+
+const char * wauthn_error_to_string(int error) {
+    switch (error) {
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NONE);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_UNKNOWN);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_INVALID_PARAMETER);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_PERMISSION_DENIED);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NOT_SUPPORTED);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NOT_ALLOWED);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_INVALID_STATE);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_ENCODING_FAILED);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_SOCKET);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_NO_SUCH_SERVICE);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_ACCESS_DENIED);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_MEMORY);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_CANCELLED);
+        WAUTHN_CODE_DESCRIBE(WAUTHN_ERROR_TIMEOUT);
+        default: return "Code not defined";
+    }
+}
index 50c4fef559dcb164bb660ea5286895e85c6fa8a2..e4d9f0b7acd0f8f7fdd5e3f05c59539c5ffdebbc 100644 (file)
@@ -46,7 +46,7 @@ int webauthn_manager()
     } catch (const std::exception &e) {
         LogError("Error in starting service, details:\n" << e.what());
     } catch (...) {
-        LogError("Error in starting service, unknown exception occured");
+        LogError("Error in starting service, unknown exception occurred");
     }
     return EXIT_FAILURE;
 }
@@ -82,4 +82,4 @@ int main(void)
 #endif
     LogDebug("Stopping server..");
     return ret;
-}
\ No newline at end of file
+}
index 87251835528cbf4703b44911a79b355e3e5e5f02..78a700bee253607fdc99ac278287249556013e97 100644 (file)
@@ -37,9 +37,9 @@ public:
         user_data_s *userData = GetUserData(user_data);
         if (userData != nullptr)
         {
-            MessageBuffer buffer(userData->service->GetSocketmanager()->newMessage());
+            MessageBuffer buffer(userData->service->GetSocketManager()->newMessage());
             Serialization::Serialize(buffer, result, pubkey_cred);
-            userData->service->GetSocketmanager()->Write(userData->connectionID, std::move(buffer));
+            userData->service->GetSocketManager()->Write(userData->connectionID, std::move(buffer));
         }
         else
         {
index 075407b021ab4ceae89235eb2e13f32ce8b98cd7..7af5fb76a4fd37056d2b32a95db945b45bf9eb91 100644 (file)
@@ -25,7 +25,7 @@ class RequestMakeCredential : Request
 public:
     typedef wauthn_pubkey_cred_creation_options_s Options;
     typedef wauthn_mc_callbacks_s Callbacks;
-    typedef wauthn_pubkey_credential_attestaion_s PubKeyCred;
+    typedef wauthn_pubkey_credential_attestation_s PubKeyCred;
 
     std::string GetAPI() {return m_API;}
 
@@ -37,9 +37,9 @@ public:
         user_data_s *userData = GetUserData(user_data);
         if (userData != nullptr)
         {
-            MessageBuffer buffer(userData->service->GetSocketmanager()->newMessage());
+            MessageBuffer buffer(userData->service->GetSocketManager()->newMessage());
             Serialization::Serialize(buffer, result, pubkey_cred);
-            userData->service->GetSocketmanager()->Write(userData->connectionID, std::move(buffer));
+            userData->service->GetSocketManager()->Write(userData->connectionID, std::move(buffer));
         }
         else
         {
index 4546626c0235f513c565ae6c17258b37950be32b..b67eff513d3bab2edb95b53b72a531a27e5f6d49 100644 (file)
@@ -25,9 +25,9 @@ public:
         user_data_s *userData = GetUserData(user_data);
         if (userData != nullptr && qr_contents != nullptr)
         {
-            MessageBuffer buffer(userData->service->GetSocketmanager()->newMessage());
+            MessageBuffer buffer(userData->service->GetSocketManager()->newMessage());
             Serialization::Serialize(buffer, WAUTHN_ERROR_NONE, std::string(qr_contents));
-            userData->service->GetSocketmanager()->Write(userData->connectionID, std::move(buffer));
+            userData->service->GetSocketManager()->Write(userData->connectionID, std::move(buffer));
         }
         else
             LogError("Cannot write qr_contents to client");
index 06a338cfa8b9465cd78b327f7f721d4c85ad9ec8..e4ec284fff907fa48acc169a48b5ac342ae3da78 100644 (file)
@@ -32,7 +32,7 @@
 
 namespace WA {
 
-SocketManager *GenericService::GetSocketmanager()
+SocketManager *GenericService::GetSocketManager()
 {
     return this->m_serviceManager;
 }
index b4b3bc0141e14362804c9fb8fd30915270ce7363..3f49e3714e6e0ea04b0938696a5b775bffad72a5 100644 (file)
@@ -64,10 +64,10 @@ public:
     void ProcessEvent(Event &&msg);
 
     /**
-     * Get the sockekmanager
+     * Get the sockemanager
      * @return The object of socket manager
      */
-    SocketManager *GetSocketmanager();
+    SocketManager *GetSocketManager();
 
     virtual SocketManager::ServiceDescription GetServiceDescription() = 0;
 
index 8cab0fc7331e573b42c3a537e2a3753a87c36412..6f4e2472ed82fb43c7b130b92e1b2fae8ae23fa1 100644 (file)
@@ -113,7 +113,7 @@ void SocketManager::ReadyForAccept() {
         return;
     }
     else if (std::numeric_limits<int>::max() - SD_VECTOR_INCREASE_SIZE <= client) {
-        LogError("An integer overflow my occur due to addtion between fd("
+        LogError("An integer overflow my occur due to addition between fd("
                  << client << ")and SD_VECTOR_INCREASE_SIZE("
                  << SD_VECTOR_INCREASE_SIZE << ")");
         return;
@@ -280,8 +280,8 @@ int SocketManager::GetSocketFromSystemD(const ServiceDescription &desc)
     int n = sd_listen_fds(0);
 
     if (n < 0) {
-        LogError("Error in sd_listend_fds");
-        ThrowMsg(Exception::InitFailed, "Error in sd_listend_fds");
+        LogError("Error in sd_listen_fds");
+        ThrowMsg(Exception::InitFailed, "Error in sd_listen_fds");
     }
 
     for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; ++fd) {
@@ -398,7 +398,7 @@ void SocketManager::Write(ConnectionID connectionID, MessageBuffer &&buffer) {
     desc.buffer = std::move(buffer);
     desc.buffer.ModeOutput();
 
-    LogDebug("Calling ReadyforWrite");
+    LogDebug("Calling ReadyForWrite");
     ReadyForWrite(connectionID.sock);
 }
 
index d5fe2913cfea375a27d40aaac68b131a2aa88217..48240c900ea2be73e57ea346e19617cd98fe1692 100644 (file)
@@ -41,7 +41,7 @@ class TestClientRequestMC : public TestClientRequest
 public:
     typedef wauthn_pubkey_cred_creation_options_s Options;
     typedef wauthn_mc_callbacks_s Callbacks;
-    typedef wauthn_pubkey_credential_attestaion_s PubKeyCred;
+    typedef wauthn_pubkey_credential_attestation_s PubKeyCred;
 
     explicit TestClientRequestMC() : TestClientRequest(WebAuthnCall::MAKE_CREDENTIAL) {}
 };
@@ -207,7 +207,7 @@ TEST_F(ClientRequestTest, request_to_not_supported_server_N)
         sleep(1);
         ret = 0;
     } catch (...) {
-        std::cout << "Error in starting service, unknown exception occured" << std::endl;
+        std::cout << "Error in starting service, unknown exception occurred" << std::endl;
         ret = -1;
     }
     EXPECT_EQ(ret, 0);
@@ -244,7 +244,7 @@ TEST_F(ClientRequestTest, MC_without_QR_callback_P)
         sleep(1);
         ret = 0;
     } catch (...) {
-        std::cout << "Error in starting service, unknown exception occured" << std::endl;
+        std::cout << "Error in starting service, unknown exception occurred" << std::endl;
         ret = -1;
     }
     EXPECT_EQ(ret, 0);
@@ -281,7 +281,7 @@ TEST_F(ClientRequestTest, MC_with_QR_callback_P)
         sleep(1);
         ret = 0;
     } catch (...) {
-        std::cout << "Error in starting service, unknown exception occured" << std::endl;
+        std::cout << "Error in starting service, unknown exception occurred" << std::endl;
         ret = -1;
     }
     EXPECT_EQ(ret, 0);
@@ -319,7 +319,7 @@ TEST_F(ClientRequestTest, GA_without_QR_callback_P)
         sleep(1);
         ret = 0;
     } catch (...) {
-        std::cout << "Error in starting service, unknown exception occured" << std::endl;
+        std::cout << "Error in starting service, unknown exception occurred" << std::endl;
         ret = -1;
     }
     EXPECT_EQ(ret, 0);
@@ -356,7 +356,7 @@ TEST_F(ClientRequestTest, GA_with_QR_callback_P)
         sleep(1);
         ret = 0;
     } catch (...) {
-        std::cout << "Error in starting service, unknown exception occured" << std::endl;
+        std::cout << "Error in starting service, unknown exception occurred" << std::endl;
         ret = -1;
     }
     EXPECT_EQ(ret, 0);
@@ -413,7 +413,7 @@ TEST_F(ClientRequestTest, not_allowed_N)
         sleep(1);
         ret = 0;
     } catch (...) {
-        std::cout << "Error in starting service, unknown exception occured" << std::endl;
+        std::cout << "Error in starting service, unknown exception occurred" << std::endl;
         ret = -1;
     }
     EXPECT_EQ(ret, 0);
@@ -462,7 +462,7 @@ TEST_F(ClientRequestTest, cancel_P)
         sleep(1);
         ret = 0;
     } catch (...) {
-        std::cout << "Error in starting service, unknown exception occured" << std::endl;
+        std::cout << "Error in starting service, unknown exception occurred" << std::endl;
         ret = -1;
     }
     EXPECT_EQ(ret, 0);
index 5fb8a89c802aeedc2f19bb6a9b00a1f453e85a6d..edc907bb390772261e09ef8c2d8d9867128582a5 100644 (file)
@@ -92,7 +92,7 @@ TEST_F(FileLockerTest, lock_invalid_path_N)
 {
     int ret = 0;
     try{
-        FileLocker fileLocker("/invalidpath/webauthn-test.lock", true);
+        FileLocker fileLocker("/invalid-path/webauthn-test.lock", true);
     } catch (FileLockerException::LockFailed &e)
     {
         ret = 1;
index a81674e22f9a23cc4f560fe2715dbe4e237c79e6..5e11197b24f054b71968d4e4afea1cb923c65587 100644 (file)
@@ -39,7 +39,7 @@ protected:
 };
 
 template<typename T, typename U>
-void __serializeDeserializeWtihWAuthnCtypeSerializer(MessageBuffer& buffer, T data, U deserialized)
+void __serializeDeserializeWithWAuthnCtypeSerializer(MessageBuffer& buffer, T data, U deserialized)
 {
     buffer.InitForStreaming();
     WAuthnCtypeSerializer::serialize(buffer, data);
@@ -61,17 +61,17 @@ void __serializeDeserializeStruct(MessageBuffer& buffer, T data, U deserialized)
 }
 
 template<typename T, typename F>
-void __testSerialization(T data, F cmpfunction)
+void __testSerialization(T data, F cmpFunction)
 {
     MessageBuffer buffer0;
     T deserialized0;
-    __serializeDeserializeWtihWAuthnCtypeSerializer(buffer0, data, &deserialized0);
-    EXPECT_EQ(cmpfunction(data, deserialized0), true);
+    __serializeDeserializeWithWAuthnCtypeSerializer(buffer0, data, &deserialized0);
+    EXPECT_EQ(cmpFunction(data, deserialized0), true);
 
     MessageBuffer buffer1;
     T deserialized1;
     __serializeDeserializeStruct(buffer1, data, &deserialized1);
-    EXPECT_EQ(cmpfunction(data, deserialized1), true);
+    EXPECT_EQ(cmpFunction(data, deserialized1), true);
 }
 
 void __fillBufferWithTestCommonData(MessageBuffer& buffer,
@@ -175,10 +175,10 @@ void __testUnsignedCharPtr(unsigned char *data, size_t data_size)
 TEST_F(WAuthnSerializationTest, unsignedCharPtr_P)
 {
     unsigned char data[13] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,};
-    unsigned char *nulldata = nullptr;
+    unsigned char *nullData = nullptr;
 
     __testUnsignedCharPtr(data, sizeof(data));
-    __testUnsignedCharPtr(nulldata, 0);
+    __testUnsignedCharPtr(nullData, 0);
 }
 TEST_F(WAuthnSerializationTest, unsignedCharPtr_N1)
 {
@@ -223,11 +223,11 @@ TEST_F(WAuthnSerializationTest, ConstCharPtr_P)
 {
     const char *data = "This is a test data.";
     const char *size0data ="";
-    const char *nulldata = nullptr;
+    const char *nullData = nullptr;
 
     __testSerialization(data, __compareCstring);
     __testSerialization(size0data, __compareCstring);
-    __testSerialization(nulldata, __compareCstring);
+    __testSerialization(nullData, __compareCstring);
 }
 TEST_F(WAuthnSerializationTest, CharPtr_N1)
 {// serialize: for too large length
@@ -243,7 +243,7 @@ TEST_F(WAuthnSerializationTest, ConstCharPtr_N2)
     __testDeserializeForTooLongLength(deserialized);
 }
 TEST_F(WAuthnSerializationTest, CharPtr_N3)
-{// deserialize: for invalid C String lenght
+{// deserialize: for invalid C String length
     // strlen(data) = 4, length in buffer stream = 8
     unsigned char data[8] = {0x01, 0x02, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00};
     MessageBuffer buffer;
@@ -421,7 +421,7 @@ bool __compareWAuthnRpEntityS(const wauthn_rp_entity_s *expected,
 TEST_F(WAuthnSerializationTest, wauthn_rp_entity_s_P)
 {
     __testSerialization(&TestCommonData::rpEntity, __compareWAuthnRpEntityS);
-    __testSerialization(&TestCommonData::emptyRpEntiy, __compareWAuthnRpEntityS);
+    __testSerialization(&TestCommonData::emptyRpEntity, __compareWAuthnRpEntityS);
     __testSerialization(static_cast<wauthn_rp_entity_s *>(nullptr), __compareWAuthnRpEntityS);
 }
 TEST_F(WAuthnSerializationTest, wauthn_rp_entity_s_N1)
@@ -795,8 +795,8 @@ bool __compareWAuthnHybridLinkedDataS(const wauthn_hybrid_linked_data_s *expecte
 }
 TEST_F(WAuthnSerializationTest, wauthn_hybrid_linked_data_s_P)
 {
-    __testSerialization(&TestCommonData::hybirdLinkedData, __compareWAuthnHybridLinkedDataS);
-    __testSerialization(&TestCommonData::emptyHybirdLinkedData, __compareWAuthnHybridLinkedDataS);
+    __testSerialization(&TestCommonData::hybridLinkedData, __compareWAuthnHybridLinkedDataS);
+    __testSerialization(&TestCommonData::emptyHybridLinkedData, __compareWAuthnHybridLinkedDataS);
     __testSerialization(static_cast<wauthn_hybrid_linked_data_s *>(nullptr), __compareWAuthnHybridLinkedDataS);
 }
 TEST_F(WAuthnSerializationTest, wauthn_hybrid_linked_data_s_N1)
@@ -960,8 +960,8 @@ TEST_F(WAuthnSerializationTest, wauthn_pubkey_cred_request_options_s_N4)
     __testDeserializeInvalidMember(data);
 }
 
-bool __compareWAuthnPubkeyCredentialAttestionS(const wauthn_pubkey_credential_attestaion_s *expected,
-            const wauthn_pubkey_credential_attestaion_s *actual)
+bool __compareWAuthnPubkeyCredentialAttestationS(const wauthn_pubkey_credential_attestation_s *expected,
+            const wauthn_pubkey_credential_attestation_s *actual)
 {
     if (actual == nullptr || expected == nullptr)
         return (actual == expected);
@@ -981,39 +981,39 @@ bool __compareWAuthnPubkeyCredentialAttestionS(const wauthn_pubkey_credential_at
         return false;
     return true;
 }
-TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestaion_s_P)
+TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestation_s_P)
 {
     __testSerialization(&TestCommonData::pubkeyCredentialAttestation,
-                __compareWAuthnPubkeyCredentialAttestionS);
+                __compareWAuthnPubkeyCredentialAttestationS);
     __testSerialization(&TestCommonData::emptyPubkeyCredentialAttestation,
-                __compareWAuthnPubkeyCredentialAttestionS);
-    __testSerialization(static_cast<wauthn_pubkey_credential_attestaion_s *>(nullptr),
-                __compareWAuthnPubkeyCredentialAttestionS);
+                __compareWAuthnPubkeyCredentialAttestationS);
+    __testSerialization(static_cast<wauthn_pubkey_credential_attestation_s *>(nullptr),
+                __compareWAuthnPubkeyCredentialAttestationS);
 }
-TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestaion_s_N1)
+TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestation_s_N1)
 {// serialize: invalid member
-    wauthn_pubkey_credential_attestaion_s data1 = TestCommonData::pubkeyCredentialAttestation;
+    wauthn_pubkey_credential_attestation_s data1 = TestCommonData::pubkeyCredentialAttestation;
     data1.type = static_cast<wauthn_pubkey_cred_type_e>(0x00FFFFFF);
     __testSerializeForInvalidMember(&data1);
 
-    wauthn_pubkey_credential_attestaion_s data2 = TestCommonData::pubkeyCredentialAttestation;
+    wauthn_pubkey_credential_attestation_s data2 = TestCommonData::pubkeyCredentialAttestation;
     data2.authenticator_attachment = static_cast<wauthn_authenticator_attachment_e>(0x00FFFFFF);
     __testSerializeForInvalidMember(&data2);
 }
-TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestaion_s_N2)
+TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestation_s_N2)
 {// deserialize: for too large length
-    wauthn_pubkey_credential_attestaion_s *deserialized = nullptr;
+    wauthn_pubkey_credential_attestation_s *deserialized = nullptr;
     __testDeserializeForTooLongLength(deserialized);
 }
-TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestaion_s_N3)
+TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestation_s_N3)
 {// deserialize: for invalid type
-    wauthn_pubkey_credential_attestaion_s data = TestCommonData::pubkeyCredentialAttestation;
+    wauthn_pubkey_credential_attestation_s data = TestCommonData::pubkeyCredentialAttestation;
     data.type = static_cast<wauthn_pubkey_cred_type_e>(0x00FFFFFF);
     __testDeserializeInvalidMember(data);
 }
-TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestaion_s_N4)
+TEST_F(WAuthnSerializationTest, wauthn_pubkey_credential_attestation_s_N4)
 {// deserialize: for invalid authenticator_attachment
-    wauthn_pubkey_credential_attestaion_s data = TestCommonData::pubkeyCredentialAttestation;
+    wauthn_pubkey_credential_attestation_s data = TestCommonData::pubkeyCredentialAttestation;
     data.authenticator_attachment = static_cast<wauthn_authenticator_attachment_e>(0x00FFFFFF);
     __testDeserializeInvalidMember(data);
 }
@@ -1111,7 +1111,7 @@ TEST_F(WAuthnSerializationTest, wauthn_client_data_s_N3)
 }
 
 template<typename T, typename U, typename FT, typename FU>
-void __testMultipleSerialization(T first, U second, FT cmpfirst, FU cmpsecond,
+void __testMultipleSerialization(T first, U second, FT cmp_first, FU cmp_second,
                                  T deserialized_first, U deserialized_second)
 {
     MessageBuffer buffer;
@@ -1122,25 +1122,25 @@ void __testMultipleSerialization(T first, U second, FT cmpfirst, FU cmpsecond,
     buffer.ModeStreaming();
     Deserialization::Deserialize(buffer, &deserialized_first, &deserialized_second);
 
-    EXPECT_EQ(cmpfirst(first, deserialized_first), true);
-    EXPECT_EQ(cmpsecond(second, deserialized_second), true);
+    EXPECT_EQ(cmp_first(first, deserialized_first), true);
+    EXPECT_EQ(cmp_second(second, deserialized_second), true);
 }
 
 template<typename T, typename U, typename FT, typename FU>
-void __testMultipleSerialization(T first, U second, FT cmpfirst, FU cmpsecond)
+void __testMultipleSerialization(T first, U second, FT cmp_first, FU cmp_second)
 {
     T deserialized_first = nullptr;
     U deserialized_second = nullptr;
-    __testMultipleSerialization(first, second, cmpfirst, cmpsecond,
+    __testMultipleSerialization(first, second, cmp_first, cmp_second,
                                 deserialized_first, deserialized_second);
 }
 
 template<typename T, typename U, typename FT, typename FU>
-void __testMultipleSerializationWAuthErrorE(T first, U second, FT cmpfirst, FU cmpsecond)
+void __testMultipleSerializationWAuthErrorE(T first, U second, FT cmp_first, FU cmp_second)
 {
     T deserialized_first = nullptr;
     U deserialized_second = WAUTHN_ERROR_NONE;
-    __testMultipleSerialization(first, second, cmpfirst, cmpsecond,
+    __testMultipleSerialization(first, second, cmp_first, cmp_second,
                                 deserialized_first, deserialized_second);
 }
 
@@ -1164,11 +1164,11 @@ TEST_F(WAuthnSerializationTest, multiple_serialization_gareq_P)
 
 TEST_F(WAuthnSerializationTest, multiple_serialization_mcres_P)
 {
-    wauthn_pubkey_credential_attestaion_s *pubkeyCred = &TestCommonData::pubkeyCredentialAttestation;
+    wauthn_pubkey_credential_attestation_s *pubkeyCred = &TestCommonData::pubkeyCredentialAttestation;
     wauthn_error_e result = WAUTHN_ERROR_PERMISSION_DENIED;
 
     __testMultipleSerializationWAuthErrorE(pubkeyCred, result,
-            __compareWAuthnPubkeyCredentialAttestionS, __compareWAuthErrorE);
+            __compareWAuthnPubkeyCredentialAttestationS, __compareWAuthErrorE);
 }
 
 TEST_F(WAuthnSerializationTest, multiple_serialization_gares_P)
index 5d15d58e2190fb974fe21f1802395fab35a936f4..aabc1526942a07b1d8ad96c869b7b7204a8095be 100644 (file)
@@ -95,10 +95,10 @@ TEST_F(SocketManagerTest, mainloop_P)
         sleep(1);
         ret = 0;
     } catch (...) {
-        std::cout << "Error in starting service, unknown exception occured" << std::endl;
+        std::cout << "Error in starting service, unknown exception occurred" << std::endl;
         ret = -1;
     }
     EXPECT_EQ(ret, 0);
 }
 
-} // namespace WebAuthn
\ No newline at end of file
+} // namespace WebAuthn
index 0ec3b39be9713edc93594588b07afe5cd96b3d78..aa6aee8b9aab8a05aa4234f5a71505a359878423 100644 (file)
@@ -51,7 +51,7 @@ namespace TestCommonData {
     const char *name = "test name";
     const char *id = "test id";
     wauthn_rp_entity_s rpEntity = {name, id};
-    wauthn_rp_entity_s emptyRpEntiy = {nullptr, nullptr};
+    wauthn_rp_entity_s emptyRpEntity = {nullptr, nullptr};
 
     unsigned char idRaw[06] = {0x01, 0x02, 0x03, 0x04, };
     wauthn_const_buffer_s bufferId = {idRaw, sizeof(idRaw)};
@@ -134,9 +134,9 @@ namespace TestCommonData {
     wauthn_const_buffer_s authenticatorName = {authenticatorNameRaw, sizeof(authenticatorNameRaw)};
     wauthn_const_buffer_s authPubkey = {authPubkeyRaw, sizeof(authPubkeyRaw)};
     wauthn_const_buffer_s tunnelServerDomain = {tunnelServerDomainRaw, sizeof(tunnelServerDomainRaw)};
-    wauthn_hybrid_linked_data_s hybirdLinkedData = {&contactId, &linkId, &linkSecret, &authenticatorPubkey,
+    wauthn_hybrid_linked_data_s hybridLinkedData = {&contactId, &linkId, &linkSecret, &authenticatorPubkey,
                                 &authenticatorName, &signature, &authPubkey, &tunnelServerDomain};
-    wauthn_hybrid_linked_data_s emptyHybirdLinkedData = {nullptr, nullptr, nullptr, nullptr,
+    wauthn_hybrid_linked_data_s emptyHybridLinkedData = {nullptr, nullptr, nullptr, nullptr,
                                             nullptr, nullptr, nullptr, nullptr};
 
     unsigned char bufferRaw0[06] = {0x01, 0x02, 0x03, 0x04, };
@@ -155,7 +155,7 @@ namespace TestCommonData {
     wauthn_attestation_pref_e attestation = AP_DIRECT;
     wauthn_pubkey_cred_creation_options_s pubkeyCredCreationOptions = {&rpEntity, &userEntity,
             &pubkeyCredParams2, timeout, &pubkeyCredDescriptors2, &authenticatorSelCri, &pubkeyCredHints2,
-            attestation, &attestationFormats1, &authenticationExts2, &hybirdLinkedData};
+            attestation, &attestationFormats1, &authenticationExts2, &hybridLinkedData};
     wauthn_pubkey_cred_creation_options_s pubkeyCredCreationOptionsWithQR = {&rpEntity, &userEntity,
             &pubkeyCredParams2, timeout, &pubkeyCredDescriptors2, &authenticatorSelCri, &pubkeyCredHints2,
             attestation, &attestationFormats1, &authenticationExts2, nullptr};
@@ -165,20 +165,20 @@ namespace TestCommonData {
     const char *rpId = "test RP ID";
     wauthn_pubkey_cred_request_options_s pubkeyCredRequestOptions = {timeout, const_cast<char *>(rpId),
             &pubkeyCredDescriptors2, user_verification, &pubkeyCredHints2, attestation, &attestationFormats1,
-            &authenticationExts2, &hybirdLinkedData};
+            &authenticationExts2, &hybridLinkedData};
     wauthn_pubkey_cred_request_options_s pubkeyCredRequestOptionsWithQR = {timeout, const_cast<char *>(rpId),
             &pubkeyCredDescriptors2, user_verification, &pubkeyCredHints2, attestation, &attestationFormats1,
             &authenticationExts2, nullptr};
     wauthn_pubkey_cred_request_options_s emptyPubkeyCredRequestOptions = {0, nullptr,
             nullptr, UVR_NONE, nullptr, AP_NONE, nullptr, nullptr, nullptr};
 
-    wauthn_pubkey_credential_attestaion_s pubkeyCredentialAttestation = {&bufferId, pubkeyCredType, &bufferId0,
-            &authenticatorAttestationResponse, attachment, &authenticationExts2, &hybirdLinkedData};
-    wauthn_pubkey_credential_attestaion_s emptyPubkeyCredentialAttestation = {nullptr, pubkeyCredType, nullptr,
+    wauthn_pubkey_credential_attestation_s pubkeyCredentialAttestation = {&bufferId, pubkeyCredType, &bufferId0,
+            &authenticatorAttestationResponse, attachment, &authenticationExts2, &hybridLinkedData};
+    wauthn_pubkey_credential_attestation_s emptyPubkeyCredentialAttestation = {nullptr, pubkeyCredType, nullptr,
             nullptr, attachment, nullptr, nullptr};
 
     wauthn_pubkey_credential_assertion_s pubkeyCredentialAssertion = {&bufferId, pubkeyCredType, &bufferId0,
-            &authenticatorAssertionResponse, attachment, &authenticationExts2, &hybirdLinkedData};
+            &authenticatorAssertionResponse, attachment, &authenticationExts2, &hybridLinkedData};
     wauthn_pubkey_credential_assertion_s emptyPubkeyCredentialAssertion = {nullptr, pubkeyCredType, nullptr,
             nullptr, attachment, nullptr, nullptr};
 
@@ -187,4 +187,4 @@ namespace TestCommonData {
     wauthn_client_data_s emptyClientData = {nullptr, hashAlg};
 } // namespace TestCommonData
 
-} // namespace WebAuthn
\ No newline at end of file
+} // namespace WebAuthn
index ef8b961a8da37b1f518dab83232339e0af8746e8..5d9f3e21789413c759f732973e72b4a9f3c73711 100644 (file)
@@ -59,7 +59,7 @@ inline void test_cb_display_qrcode(const char *qr_contents, void *user_data)
 }
 
 inline void test_cb_mc_response(
-    const wauthn_pubkey_credential_attestaion_s *pubkey_cred,
+    const wauthn_pubkey_credential_attestation_s *pubkey_cred,
     wauthn_error_e result,
     void *user_data)
 {
@@ -122,7 +122,7 @@ namespace TestCommonData {
     extern const char *name;
     extern const char *id;
     extern wauthn_rp_entity_s rpEntity;
-    extern wauthn_rp_entity_s emptyRpEntiy;
+    extern wauthn_rp_entity_s emptyRpEntity;
 
     extern unsigned char idRaw[06];
     extern wauthn_const_buffer_s bufferId;
@@ -200,8 +200,8 @@ namespace TestCommonData {
     extern wauthn_const_buffer_s authenticatorName;
     extern wauthn_const_buffer_s authPubkey;
     extern wauthn_const_buffer_s tunnelServerDomain;
-    extern wauthn_hybrid_linked_data_s hybirdLinkedData;
-    extern wauthn_hybrid_linked_data_s emptyHybirdLinkedData;
+    extern wauthn_hybrid_linked_data_s hybridLinkedData;
+    extern wauthn_hybrid_linked_data_s emptyHybridLinkedData;
 
     extern unsigned char bufferRaw0[06];
     extern unsigned char bufferRaw1[16];
@@ -224,8 +224,8 @@ namespace TestCommonData {
     extern wauthn_pubkey_cred_request_options_s pubkeyCredRequestOptionsWithQR;
     extern wauthn_pubkey_cred_request_options_s emptyPubkeyCredRequestOptions;
 
-    extern wauthn_pubkey_credential_attestaion_s pubkeyCredentialAttestation;
-    extern wauthn_pubkey_credential_attestaion_s emptyPubkeyCredentialAttestation;
+    extern wauthn_pubkey_credential_attestation_s pubkeyCredentialAttestation;
+    extern wauthn_pubkey_credential_attestation_s emptyPubkeyCredentialAttestation;
 
     extern wauthn_pubkey_credential_assertion_s pubkeyCredentialAssertion;
     extern wauthn_pubkey_credential_assertion_s emptyPubkeyCredentialAssertion;
@@ -235,4 +235,4 @@ namespace TestCommonData {
     extern wauthn_client_data_s emptyClientData;
 } // namespace TestCommonData
 
-} // namespace WebAuthn
\ No newline at end of file
+} // namespace WebAuthn