if (SYSTEM_INFO_ERROR_NONE
!= system_info_get_platform_bool(feature, &is_supported)) {
- LogError("Failed to check feature " << feature);
+ LogWarning("Failed to check feature " << feature);
return WAUTHN_ERROR_UNKNOWN;
}
if (!is_supported) {
- LogError("Unsupported feature " << feature);
+ LogWarning("Unsupported feature " << feature);
return WAUTHN_ERROR_NOT_SUPPORTED;
}
return WAUTHN_ERROR_NONE;
#endif
}
+
+int check_network_features() {
+ if ((has_feature(TELEPHONY) != WAUTHN_ERROR_NONE) &&
+ has_feature(WIFI) != WAUTHN_ERROR_NONE &&
+ has_feature(ETHERNET) != WAUTHN_ERROR_NONE)
+ return WAUTHN_ERROR_NOT_SUPPORTED;
+ return WAUTHN_ERROR_NONE;
+}
+
+int check_features() {
+#ifdef NO_FEATURE_CHECK
+ LogWarning("Skip to check features");
+ return WAUTHN_ERROR_NONE;
+#else
+ int ret = WAUTHN_ERROR_NONE;
+ if (((ret = has_feature(WEBAUTHN)) != WAUTHN_ERROR_NONE) ||
+ ((ret = has_feature(BLUETOOTH)) != WAUTHN_ERROR_NONE) ||
+ ((ret = check_network_features()) != WAUTHN_ERROR_NONE))
+ {
+ LogError("Features are not supported");
+ return ret;
+ }
+ return WAUTHN_ERROR_NONE;
+#endif
+}
} // namespace
#define WEBAUTHN_API __attribute__((visibility("default")))
int wauthn_set_api_version(int api_version_number) {
int ret = has_feature(WEBAUTHN);
if (ret != WAUTHN_ERROR_NONE)
+ {
+ LogError(get_error_message(ret));
return ret;
+ }
if (api_version_number != WAUTHN_API_VERSION_NUMBER)
return WAUTHN_ERROR_NOT_SUPPORTED;
int wauthn_supported_authenticators(unsigned int *supported) {
int ret = has_feature(WEBAUTHN);
if (ret != WAUTHN_ERROR_NONE)
+ {
+ LogError(get_error_message(ret));
return ret;
+ }
if (supported == nullptr)
return WAUTHN_ERROR_INVALID_PARAMETER;
int wauthn_make_credential(const wauthn_client_data_s *client_data,
const wauthn_pubkey_cred_creation_options_s *options,
wauthn_mc_callbacks_s *callbacks) {
- int ret = WAUTHN_ERROR_NONE;
- if (((ret = has_feature(WEBAUTHN)) != WAUTHN_ERROR_NONE) ||
- ((ret = has_feature(BLUETOOTH)) != WAUTHN_ERROR_NONE) || (
- ((ret = has_feature(TELEPHONY)) != WAUTHN_ERROR_NONE) &&
- ((ret = has_feature(WIFI)) != WAUTHN_ERROR_NONE) &&
- ((ret = has_feature(ETHERNET)) != WAUTHN_ERROR_NONE)))
+ int ret = check_features();
+ if (ret != WAUTHN_ERROR_NONE)
return ret;
return try_catch([&]() -> int {
int wauthn_get_assertion(const wauthn_client_data_s *client_data,
const wauthn_pubkey_cred_request_options_s *options,
wauthn_ga_callbacks_s *callbacks) {
- int ret = WAUTHN_ERROR_NONE;
- if (((ret = has_feature(WEBAUTHN)) != WAUTHN_ERROR_NONE) ||
- ((ret = has_feature(BLUETOOTH)) != WAUTHN_ERROR_NONE) || (
- ((ret = has_feature(TELEPHONY)) != WAUTHN_ERROR_NONE) &&
- ((ret = has_feature(WIFI)) != WAUTHN_ERROR_NONE) &&
- ((ret = has_feature(ETHERNET)) != WAUTHN_ERROR_NONE)))
+ int ret = check_features();
+ if (ret != WAUTHN_ERROR_NONE)
return ret;
return try_catch([&]() -> int {
int wauthn_cancel() {
int ret = has_feature(WEBAUTHN);
if (ret != WAUTHN_ERROR_NONE)
+ {
+ LogError(get_error_message(ret));
return ret;
+ }
return try_catch([&]() -> int {
ClientRequest request(WebAuthnCall::CANCEL);