Changeset 237983 in webkit


Ignore:
Timestamp:
Nov 8, 2018 2:29:58 AM (5 years ago)
Author:
jiewen_tan@apple.com
Message:

[WebAuthN] Import CTAP device request/response converters from Chromium
https://bugs.webkit.org/show_bug.cgi?id=190784
<rdar://problem/45460333>

Reviewed by Brent Fulgham.

Source/WebCore:

This patch imports Chromium's CTAP device request/response converters:
https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#message-encoding

  1. It directly imports the following files and suit them to WebKit's coding style:

https://cs.chromium.org/chromium/src/device/fido/device_response_converter.cc?l=20&rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
https://cs.chromium.org/chromium/src/device/fido/device_response_converter.h?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
https://cs.chromium.org/chromium/src/device/fido/authenticator_get_info_response.cc?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
https://cs.chromium.org/chromium/src/device/fido/authenticator_get_info_response.h?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
https://cs.chromium.org/chromium/src/device/fido/authenticator_supported_options.cc?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
https://cs.chromium.org/chromium/src/device/fido/authenticator_supported_options.h?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
https://cs.chromium.org/chromium/src/device/fido/ctap_request_unittest.cc?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
https://cs.chromium.org/chromium/src/device/fido/ctap_response_unittest.cc?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
https://cs.chromium.org/chromium/src/device/fido/fido_test_data.h?l=1&rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45

  1. It gathers the following methods into DeviceRequestConverter:

CtapGetAssertionRequest::EncodeAsCBOR()
CtapMakeCredentialRequest::EncodeAsCBOR()
PublicKeyCredentialDescriptor::ConvertToCBOR()
PublicKeyCredentialParams::ConvertToCBOR()
PublicKeyCredentialRpEntity::ConvertToCBOR()
PublicKeyCredentialUserEntity::ConvertToCBOR()

  1. It also apply a patch from Chromium to CBORValue:

https://chromium.googlesource.com/chromium/src/+/7b6fbff35cd8e4d508f08e1cd93b4aa0a0dc402c%5E%21/

Besides importing things from Chromium, it also implements UserVerificationRequirement for both
PublicKeyCredentialCreationOptions and PublicKeyCredentialRequestOptions such that both options
can specify more dimensions of a desired authenticator.

Covered by API tests.

  • CMakeLists.txt:
  • DerivedSources.make:
  • Modules/webauthn/PublicKeyCredentialCreationOptions.h:

(WebCore::PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::encode const):
(WebCore::PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::decode):

  • Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
  • Modules/webauthn/PublicKeyCredentialRequestOptions.h:

(WebCore::PublicKeyCredentialRequestOptions::encode const):
(WebCore::PublicKeyCredentialRequestOptions::decode):

  • Modules/webauthn/PublicKeyCredentialRequestOptions.idl:
  • Modules/webauthn/UserVerificationRequirement.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.idl.
  • Modules/webauthn/UserVerificationRequirement.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.idl.
  • Modules/webauthn/cbor/CBORValue.cpp:

(cbor::CBORValue::CBORValue):
(cbor::CBORValue::getBool const):

  • Modules/webauthn/cbor/CBORValue.h:
  • Modules/webauthn/fido/AuthenticatorGetInfoResponse.cpp: Added.

(fido::toArrayValue):
(fido::AuthenticatorGetInfoResponse::AuthenticatorGetInfoResponse):
(fido::AuthenticatorGetInfoResponse::setMaxMsgSize):
(fido::AuthenticatorGetInfoResponse::setPinProtocols):
(fido::AuthenticatorGetInfoResponse::setExtensions):
(fido::AuthenticatorGetInfoResponse::setOptions):
(fido::encodeAsCBOR):

  • Modules/webauthn/fido/AuthenticatorGetInfoResponse.h: Added.
  • Modules/webauthn/fido/AuthenticatorSupportedOptions.cpp: Added.

(fido::AuthenticatorSupportedOptions::setSupportsResidentKey):
(fido::AuthenticatorSupportedOptions::setUserVerificationAvailability):
(fido::AuthenticatorSupportedOptions::setUserPresenceRequired):
(fido::AuthenticatorSupportedOptions::setClientPinAvailability):
(fido::AuthenticatorSupportedOptions::setIsPlatformDevice):
(fido::convertToCBOR):

  • Modules/webauthn/fido/AuthenticatorSupportedOptions.h: Added.
  • Modules/webauthn/fido/DeviceRequestConverter.cpp: Added.

(fido::convertRpEntityToCBOR):
(fido::convertUserEntityToCBOR):
(fido::convertParametersToCBOR):
(fido::convertDescriptorToCBOR):
(fido::encodeMakeCredenitalRequestAsCBOR):
(fido::encodeGetAssertionRequestAsCBOR):
(fido::encodeEmptyAuthenticatorRequest):

  • Modules/webauthn/fido/DeviceRequestConverter.h: Copied from Source/WebCore/Modules/webauthn/fido/FidoConstants.h.
  • Modules/webauthn/fido/DeviceResponseConverter.cpp: Added.

(fido::convertStringToProtocolVersion):
(fido::getResponseCode):
(fido::getCredentialId):
(fido::readCTAPMakeCredentialResponse):
(fido::readCTAPGetAssertionResponse):
(fido::readCTAPGetInfoResponse):

  • Modules/webauthn/fido/DeviceResponseConverter.h: Copied from Source/WebCore/Modules/webauthn/fido/FidoConstants.cpp.
  • Modules/webauthn/fido/FidoConstants.cpp:

(fido::isCtapDeviceResponseCode):
(fido::publicKeyCredentialTypeToString):

  • Modules/webauthn/fido/FidoConstants.h:
  • Sources.txt:
  • WebCore.xcodeproj/project.pbxproj:

Tools:

  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebCore/CBORValueTest.cpp:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebCore/CtapRequestTest.cpp: Added.

(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebCore/CtapResponseTest.cpp: Added.

(TestWebKitAPI::getTestCorruptedSignResponse):
(TestWebKitAPI::getTestCredentialRawIdBytes):
(TestWebKitAPI::convertToVector):
(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebCore/FidoTestData.h: Added.
Location:
trunk
Files:
9 added
16 edited
4 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r237981 r237983  
    439439    Modules/webauthn/PublicKeyCredentialRequestOptions.idl
    440440    Modules/webauthn/PublicKeyCredentialType.idl
     441    Modules/webauthn/UserVerificationRequirement.idl
    441442
    442443    Modules/webdatabase/DOMWindowWebDatabase.idl
  • trunk/Source/WebCore/ChangeLog

    r237981 r237983  
     12018-11-08  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        [WebAuthN] Import CTAP device request/response converters from Chromium
     4        https://bugs.webkit.org/show_bug.cgi?id=190784
     5        <rdar://problem/45460333>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        This patch imports Chromium's CTAP device request/response converters:
     10        https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#message-encoding
     11        1. It directly imports the following files and suit them to WebKit's coding style:
     12        https://cs.chromium.org/chromium/src/device/fido/device_response_converter.cc?l=20&rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
     13        https://cs.chromium.org/chromium/src/device/fido/device_response_converter.h?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
     14        https://cs.chromium.org/chromium/src/device/fido/authenticator_get_info_response.cc?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
     15        https://cs.chromium.org/chromium/src/device/fido/authenticator_get_info_response.h?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
     16        https://cs.chromium.org/chromium/src/device/fido/authenticator_supported_options.cc?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
     17        https://cs.chromium.org/chromium/src/device/fido/authenticator_supported_options.h?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
     18        https://cs.chromium.org/chromium/src/device/fido/ctap_request_unittest.cc?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
     19        https://cs.chromium.org/chromium/src/device/fido/ctap_response_unittest.cc?rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
     20        https://cs.chromium.org/chromium/src/device/fido/fido_test_data.h?l=1&rcl=098dfd90850ffa84c27a884ab75edd2d99c4ec45
     21        2. It gathers the following methods into DeviceRequestConverter:
     22        CtapGetAssertionRequest::EncodeAsCBOR()
     23        CtapMakeCredentialRequest::EncodeAsCBOR()
     24        PublicKeyCredentialDescriptor::ConvertToCBOR()
     25        PublicKeyCredentialParams::ConvertToCBOR()
     26        PublicKeyCredentialRpEntity::ConvertToCBOR()
     27        PublicKeyCredentialUserEntity::ConvertToCBOR()
     28        3. It also apply a patch from Chromium to CBORValue:
     29        https://chromium.googlesource.com/chromium/src/+/7b6fbff35cd8e4d508f08e1cd93b4aa0a0dc402c%5E%21/
     30
     31        Besides importing things from Chromium, it also implements UserVerificationRequirement for both
     32        PublicKeyCredentialCreationOptions and PublicKeyCredentialRequestOptions such that both options
     33        can specify more dimensions of a desired authenticator.
     34
     35        Covered by API tests.
     36
     37        * CMakeLists.txt:
     38        * DerivedSources.make:
     39        * Modules/webauthn/PublicKeyCredentialCreationOptions.h:
     40        (WebCore::PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::encode const):
     41        (WebCore::PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::decode):
     42        * Modules/webauthn/PublicKeyCredentialCreationOptions.idl:
     43        * Modules/webauthn/PublicKeyCredentialRequestOptions.h:
     44        (WebCore::PublicKeyCredentialRequestOptions::encode const):
     45        (WebCore::PublicKeyCredentialRequestOptions::decode):
     46        * Modules/webauthn/PublicKeyCredentialRequestOptions.idl:
     47        * Modules/webauthn/UserVerificationRequirement.h: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.idl.
     48        * Modules/webauthn/UserVerificationRequirement.idl: Copied from Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.idl.
     49        * Modules/webauthn/cbor/CBORValue.cpp:
     50        (cbor::CBORValue::CBORValue):
     51        (cbor::CBORValue::getBool const):
     52        * Modules/webauthn/cbor/CBORValue.h:
     53        * Modules/webauthn/fido/AuthenticatorGetInfoResponse.cpp: Added.
     54        (fido::toArrayValue):
     55        (fido::AuthenticatorGetInfoResponse::AuthenticatorGetInfoResponse):
     56        (fido::AuthenticatorGetInfoResponse::setMaxMsgSize):
     57        (fido::AuthenticatorGetInfoResponse::setPinProtocols):
     58        (fido::AuthenticatorGetInfoResponse::setExtensions):
     59        (fido::AuthenticatorGetInfoResponse::setOptions):
     60        (fido::encodeAsCBOR):
     61        * Modules/webauthn/fido/AuthenticatorGetInfoResponse.h: Added.
     62        * Modules/webauthn/fido/AuthenticatorSupportedOptions.cpp: Added.
     63        (fido::AuthenticatorSupportedOptions::setSupportsResidentKey):
     64        (fido::AuthenticatorSupportedOptions::setUserVerificationAvailability):
     65        (fido::AuthenticatorSupportedOptions::setUserPresenceRequired):
     66        (fido::AuthenticatorSupportedOptions::setClientPinAvailability):
     67        (fido::AuthenticatorSupportedOptions::setIsPlatformDevice):
     68        (fido::convertToCBOR):
     69        * Modules/webauthn/fido/AuthenticatorSupportedOptions.h: Added.
     70        * Modules/webauthn/fido/DeviceRequestConverter.cpp: Added.
     71        (fido::convertRpEntityToCBOR):
     72        (fido::convertUserEntityToCBOR):
     73        (fido::convertParametersToCBOR):
     74        (fido::convertDescriptorToCBOR):
     75        (fido::encodeMakeCredenitalRequestAsCBOR):
     76        (fido::encodeGetAssertionRequestAsCBOR):
     77        (fido::encodeEmptyAuthenticatorRequest):
     78        * Modules/webauthn/fido/DeviceRequestConverter.h: Copied from Source/WebCore/Modules/webauthn/fido/FidoConstants.h.
     79        * Modules/webauthn/fido/DeviceResponseConverter.cpp: Added.
     80        (fido::convertStringToProtocolVersion):
     81        (fido::getResponseCode):
     82        (fido::getCredentialId):
     83        (fido::readCTAPMakeCredentialResponse):
     84        (fido::readCTAPGetAssertionResponse):
     85        (fido::readCTAPGetInfoResponse):
     86        * Modules/webauthn/fido/DeviceResponseConverter.h: Copied from Source/WebCore/Modules/webauthn/fido/FidoConstants.cpp.
     87        * Modules/webauthn/fido/FidoConstants.cpp:
     88        (fido::isCtapDeviceResponseCode):
     89        (fido::publicKeyCredentialTypeToString):
     90        * Modules/webauthn/fido/FidoConstants.h:
     91        * Sources.txt:
     92        * WebCore.xcodeproj/project.pbxproj:
     93
    1942018-11-07  Justin Michaud  <justin_michaud@apple.com>
    295
  • trunk/Source/WebCore/DerivedSources.make

    r237981 r237983  
    359359    $(WebCore)/Modules/webauthn/PublicKeyCredentialRequestOptions.idl \
    360360    $(WebCore)/Modules/webauthn/PublicKeyCredentialType.idl \
     361    $(WebCore)/Modules/webauthn/UserVerificationRequirement.idl \
    361362    $(WebCore)/Modules/webdatabase/DOMWindowWebDatabase.idl \
    362363    $(WebCore)/Modules/webdatabase/Database.idl \
  • trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.h

    r237074 r237983  
    3131#include "PublicKeyCredentialDescriptor.h"
    3232#include "PublicKeyCredentialType.h"
     33#include "UserVerificationRequirement.h"
    3334#include <wtf/CrossThreadCopier.h>
    3435#include <wtf/Forward.h>
     
    6667
    6768    struct AuthenticatorSelectionCriteria {
    68         AuthenticatorAttachment authenticatorAttachment;
     69        std::optional<AuthenticatorAttachment> authenticatorAttachment;
     70        bool requireResidentKey { false };
     71        UserVerificationRequirement userVerification { UserVerificationRequirement::Preferred };
    6972
    7073        template<class Encoder> void encode(Encoder&) const;
     
    106109void PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria::encode(Encoder& encoder) const
    107110{
    108     encoder << authenticatorAttachment;
     111    encoder << authenticatorAttachment << requireResidentKey << userVerification;
    109112}
    110113
     
    113116{
    114117    PublicKeyCredentialCreationOptions::AuthenticatorSelectionCriteria result;
    115     if (!decoder.decodeEnum(result.authenticatorAttachment))
     118
     119    std::optional<std::optional<AuthenticatorAttachment>> authenticatorAttachment;
     120    decoder >> authenticatorAttachment;
     121    if (!authenticatorAttachment)
     122        return std::nullopt;
     123    result.authenticatorAttachment = WTFMove(*authenticatorAttachment);
     124
     125    std::optional<bool> requireResidentKey;
     126    decoder >> requireResidentKey;
     127    if (!requireResidentKey)
     128        return std::nullopt;
     129    result.requireResidentKey = *requireResidentKey;
     130
     131    if (!decoder.decodeEnum(result.userVerification))
    116132        return std::nullopt;
    117133    return result;
  • trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialCreationOptions.idl

    r236481 r237983  
    7575] dictionary AuthenticatorSelectionCriteria {
    7676    AuthenticatorAttachment      authenticatorAttachment;
    77     // We don't allow RPs to set the following values at this stage.
    78     // Hence, those options are always { true, "required" }.
    79     // boolean                      requireResidentKey = false;
    80     // UserVerificationRequirement  userVerification = "preferred";
     77    boolean                      requireResidentKey = false;
     78    UserVerificationRequirement  userVerification = "preferred";
    8179};
    8280
  • trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.h

    r236842 r237983  
    3030#include "BufferSource.h"
    3131#include "PublicKeyCredentialDescriptor.h"
     32#include "UserVerificationRequirement.h"
    3233#include <wtf/Forward.h>
    3334
     
    3940    mutable String rpId;
    4041    Vector<PublicKeyCredentialDescriptor> allowCredentials;
     42    UserVerificationRequirement userVerification { UserVerificationRequirement::Preferred };
    4143
    4244    template<class Encoder> void encode(Encoder&) const;
     
    4850void PublicKeyCredentialRequestOptions::encode(Encoder& encoder) const
    4951{
    50     encoder << timeout << rpId << allowCredentials;
     52    encoder << timeout << rpId << allowCredentials << userVerification;
    5153}
    5254
     
    6668    if (!decoder.decode(result.allowCredentials))
    6769        return std::nullopt;
     70
     71    std::optional<UserVerificationRequirement> userVerification;
     72    decoder >> userVerification;
     73    if (!userVerification)
     74        return std::nullopt;
     75    result.userVerification = WTFMove(*userVerification);
     76
    6877    return result;
    6978}
  • trunk/Source/WebCore/Modules/webauthn/PublicKeyCredentialRequestOptions.idl

    r227764 r237983  
    3131    USVString rpId;
    3232    sequence<PublicKeyCredentialDescriptor> allowCredentials = [];
    33     // Always "required" at this stage
    34     // UserVerificationRequirement userVerification = "preferred";
     33    UserVerificationRequirement userVerification = "preferred";
    3534    // Not support yet.
    3635    // AuthenticationExtensions extensions;
  • trunk/Source/WebCore/Modules/webauthn/UserVerificationRequirement.h

    r237982 r237983  
    2424 */
    2525
    26 [
    27     Conditional=WEB_AUTHN,
    28 ] dictionary PublicKeyCredentialRequestOptions {
    29     required BufferSource challenge;
    30     unsigned long timeout;
    31     USVString rpId;
    32     sequence<PublicKeyCredentialDescriptor> allowCredentials = [];
    33     // Always "required" at this stage
    34     // UserVerificationRequirement userVerification = "preferred";
    35     // Not support yet.
    36     // AuthenticationExtensions extensions;
     26#pragma once
     27
     28#if ENABLE(WEB_AUTHN)
     29
     30#include <wtf/EnumTraits.h>
     31
     32namespace WebCore {
     33
     34enum class UserVerificationRequirement {
     35    Required,
     36    Preferred,
     37    Discouraged
    3738};
     39
     40} // namespace WebCore
     41
     42namespace WTF {
     43
     44template<> struct EnumTraits<WebCore::UserVerificationRequirement> {
     45    using values = EnumValues<
     46        WebCore::UserVerificationRequirement,
     47        WebCore::UserVerificationRequirement::Required,
     48        WebCore::UserVerificationRequirement::Preferred,
     49        WebCore::UserVerificationRequirement::Discouraged
     50    >;
     51};
     52
     53} // namespace WTF
     54
     55#endif // ENABLE(WEB_AUTHN)
  • trunk/Source/WebCore/Modules/webauthn/UserVerificationRequirement.idl

    r237982 r237983  
    2626[
    2727    Conditional=WEB_AUTHN,
    28 ] dictionary PublicKeyCredentialRequestOptions {
    29     required BufferSource challenge;
    30     unsigned long timeout;
    31     USVString rpId;
    32     sequence<PublicKeyCredentialDescriptor> allowCredentials = [];
    33     // Always "required" at this stage
    34     // UserVerificationRequirement userVerification = "preferred";
    35     // Not support yet.
    36     // AuthenticationExtensions extensions;
     28    ImplementedAs=UserVerificationRequirement
     29] enum UserVerificationRequirement {
     30    "required",
     31    "preferred",
     32    "discouraged"
    3733};
  • trunk/Source/WebCore/Modules/webauthn/cbor/CBORValue.cpp

    r235861 r237983  
    154154}
    155155
     156CBORValue::CBORValue(bool inBool)
     157    : m_type(Type::SimpleValue)
     158{
     159    m_simpleValue = inBool ? CBORValue::SimpleValue::TrueValue : CBORValue::SimpleValue::FalseValue;
     160}
     161
    156162CBORValue& CBORValue::operator=(CBORValue&& that)
    157163{
     
    241247}
    242248
     249bool CBORValue::getBool() const
     250{
     251    ASSERT(isBool());
     252    return m_simpleValue == SimpleValue::TrueValue;
     253}
     254
    243255void CBORValue::internalMoveConstructFrom(CBORValue&& that)
    244256{
  • trunk/Source/WebCore/Modules/webauthn/cbor/CBORValue.h

    r235861 r237983  
    139139
    140140    explicit CBORValue(SimpleValue);
     141    explicit CBORValue(bool);
    141142
    142143    CBORValue& operator=(CBORValue&&);
     
    162163    bool isMap() const { return type() == Type::Map; }
    163164    bool isSimple() const { return type() == Type::SimpleValue; }
     165    bool isBool() const { return isSimple() && (m_simpleValue == SimpleValue::TrueValue || m_simpleValue == SimpleValue::FalseValue); }
    164166
    165167    // These will all fatally assert if the type doesn't match.
    166168    SimpleValue getSimpleValue() const;
     169    bool getBool() const;
    167170    const int64_t& getInteger() const;
    168171    const int64_t& getUnsigned() const;
  • trunk/Source/WebCore/Modules/webauthn/fido/DeviceRequestConverter.h

    r237982 r237983  
    1 // Copyright 2018 The Chromium Authors. All rights reserved.
     1// Copyright 2017 The Chromium Authors. All rights reserved.
    22// Copyright (C) 2018 Apple Inc. All rights reserved.
    33//
     
    3232#if ENABLE(WEB_AUTHN)
    3333
     34#include "AuthenticatorSupportedOptions.h"
     35#include "FidoConstants.h"
     36#include <wtf/Forward.h>
     37
     38namespace WebCore {
     39struct PublicKeyCredentialCreationOptions;
     40struct PublicKeyCredentialRequestOptions;
     41}
     42
    3443namespace fido {
    3544
    36 // Commands supported by CTAPHID device as specified in
    37 // https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#ctaphid-commands
    38 enum class FidoHidDeviceCommand : uint8_t {
    39     kMsg = 0x03,
    40     kCbor = 0x10,
    41     kInit = 0x06,
    42     kPing = 0x01,
    43     kCancel = 0x11,
    44     kError = 0x3F,
    45     kKeepAlive = 0x3B,
    46     kWink = 0x08,
    47     kLock = 0x04,
    48 };
     45// Serializes MakeCredential request parameter into CBOR encoded map with
     46// integer keys and CBOR encoded values as defined by the CTAP spec.
     47// https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#authenticatorMakeCredential
     48WEBCORE_EXPORT Vector<uint8_t> encodeMakeCredenitalRequestAsCBOR(const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialCreationOptions&, AuthenticatorSupportedOptions::UserVerificationAvailability);
    4949
    50 bool isFidoHidDeviceCommand(FidoHidDeviceCommand cmd);
     50// Serializes GetAssertion request parameter into CBOR encoded map with
     51// integer keys and CBOR encoded values as defined by the CTAP spec.
     52// https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#authenticatorGetAssertion
     53WEBCORE_EXPORT Vector<uint8_t> encodeGetAssertionRequestAsCBOR(const Vector<uint8_t>& hash, const WebCore::PublicKeyCredentialRequestOptions&, AuthenticatorSupportedOptions::UserVerificationAvailability);
    5154
    52 // HID transport specific constants.
    53 const size_t kHidPacketSize = 64;
    54 const uint32_t kHidBroadcastChannel = 0xffffffff;
    55 const size_t kHidInitPacketHeaderSize = 7;
    56 const size_t kHidContinuationPacketHeader = 5;
    57 const size_t kHidMaxPacketSize = 64;
    58 const size_t kHidInitPacketDataSize = kHidMaxPacketSize - kHidInitPacketHeaderSize;
    59 const size_t kHidContinuationPacketDataSize = kHidMaxPacketSize - kHidContinuationPacketHeader;
    60 
    61 const uint8_t kHidMaxLockSeconds = 10;
    62 
    63 // Messages are limited to an initiation packet and 128 continuation packets.
    64 const size_t kHidMaxMessageSize = 7609;
     55// Represents CTAP requests with empty parameters, including
     56// AuthenticatorGetInfo, AuthenticatorCancel, AuthenticatorReset and
     57// AuthenticatorGetNextAssertion commands.
     58WEBCORE_EXPORT Vector<uint8_t> encodeEmptyAuthenticatorRequest(CtapRequestCommand);
    6559
    6660} // namespace fido
  • trunk/Source/WebCore/Modules/webauthn/fido/DeviceResponseConverter.h

    r237982 r237983  
    2828// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929
    30 #include "config.h"
    31 #include "FidoConstants.h"
     30#pragma once
    3231
    3332#if ENABLE(WEB_AUTHN)
    3433
     34#include "AuthenticatorGetInfoResponse.h"
     35#include "FidoConstants.h"
     36#include "PublicKeyCredentialData.h"
     37
     38// Converts response from authenticators to CTAPResponse objects. If the
     39// response of the authenticator does not conform to format specified by the
     40// CTAP protocol, null optional is returned.
    3541namespace fido {
    3642
    37 bool isFidoHidDeviceCommand(FidoHidDeviceCommand cmd)
    38 {
    39     switch (cmd) {
    40     case FidoHidDeviceCommand::kMsg:
    41     case FidoHidDeviceCommand::kCbor:
    42     case FidoHidDeviceCommand::kInit:
    43     case FidoHidDeviceCommand::kPing:
    44     case FidoHidDeviceCommand::kCancel:
    45     case FidoHidDeviceCommand::kError:
    46     case FidoHidDeviceCommand::kKeepAlive:
    47     case FidoHidDeviceCommand::kWink:
    48     case FidoHidDeviceCommand::kLock:
    49         return true;
    50     default:
    51         return false;
    52     }
    53 }
     43// Parses response code from response received from the authenticator. If
     44// unknown response code value is received, then CTAP2_ERR_OTHER is returned.
     45WEBCORE_EXPORT CtapDeviceResponseCode getResponseCode(const Vector<uint8_t>&);
     46
     47// De-serializes CBOR encoded response, checks for valid CBOR map formatting,
     48// and converts response to AuthenticatorMakeCredentialResponse object with
     49// CBOR map keys that conform to format of attestation object defined by the
     50// WebAuthN spec : https://w3c.github.io/webauthn/#fig-attStructs
     51WEBCORE_EXPORT std::optional<WebCore::PublicKeyCredentialData> readCTAPMakeCredentialResponse(const Vector<uint8_t>&);
     52
     53// De-serializes CBOR encoded response to AuthenticatorGetAssertion /
     54// AuthenticatorGetNextAssertion request to AuthenticatorGetAssertionResponse
     55// object.
     56// FIXME(190783): Probably need to remake AuthenticatorResponse to include more fields like numberOfCredentials,
     57// and use it here instead of PublicKeyCredentialData.
     58WEBCORE_EXPORT std::optional<WebCore::PublicKeyCredentialData> readCTAPGetAssertionResponse(const Vector<uint8_t>&);
     59
     60// De-serializes CBOR encoded response to AuthenticatorGetInfo request to
     61// AuthenticatorGetInfoResponse object.
     62WEBCORE_EXPORT std::optional<AuthenticatorGetInfoResponse> readCTAPGetInfoResponse(const Vector<uint8_t>&);
    5463
    5564} // namespace fido
  • trunk/Source/WebCore/Modules/webauthn/fido/FidoConstants.cpp

    r236976 r237983  
    3434
    3535namespace fido {
     36using namespace WebCore;
     37
     38bool isCtapDeviceResponseCode(CtapDeviceResponseCode code)
     39{
     40    switch (code) {
     41    case CtapDeviceResponseCode::kSuccess:
     42    case CtapDeviceResponseCode::kCtap1ErrInvalidCommand:
     43    case CtapDeviceResponseCode::kCtap1ErrInvalidParameter:
     44    case CtapDeviceResponseCode::kCtap1ErrInvalidLength:
     45    case CtapDeviceResponseCode::kCtap1ErrInvalidSeq:
     46    case CtapDeviceResponseCode::kCtap1ErrTimeout:
     47    case CtapDeviceResponseCode::kCtap1ErrChannelBusy:
     48    case CtapDeviceResponseCode::kCtap1ErrLockRequired:
     49    case CtapDeviceResponseCode::kCtap1ErrInvalidChannel:
     50    case CtapDeviceResponseCode::kCtap2ErrCBORParsing:
     51    case CtapDeviceResponseCode::kCtap2ErrUnexpectedType:
     52    case CtapDeviceResponseCode::kCtap2ErrInvalidCBOR:
     53    case CtapDeviceResponseCode::kCtap2ErrInvalidCBORType:
     54    case CtapDeviceResponseCode::kCtap2ErrMissingParameter:
     55    case CtapDeviceResponseCode::kCtap2ErrLimitExceeded:
     56    case CtapDeviceResponseCode::kCtap2ErrUnsupportedExtension:
     57    case CtapDeviceResponseCode::kCtap2ErrTooManyElements:
     58    case CtapDeviceResponseCode::kCtap2ErrExtensionNotSupported:
     59    case CtapDeviceResponseCode::kCtap2ErrCredentialExcluded:
     60    case CtapDeviceResponseCode::kCtap2ErrProcesssing:
     61    case CtapDeviceResponseCode::kCtap2ErrInvalidCredential:
     62    case CtapDeviceResponseCode::kCtap2ErrUserActionPending:
     63    case CtapDeviceResponseCode::kCtap2ErrOperationPending:
     64    case CtapDeviceResponseCode::kCtap2ErrNoOperations:
     65    case CtapDeviceResponseCode::kCtap2ErrUnsupportedAlgorithms:
     66    case CtapDeviceResponseCode::kCtap2ErrOperationDenied:
     67    case CtapDeviceResponseCode::kCtap2ErrKeyStoreFull:
     68    case CtapDeviceResponseCode::kCtap2ErrNotBusy:
     69    case CtapDeviceResponseCode::kCtap2ErrNoOperationPending:
     70    case CtapDeviceResponseCode::kCtap2ErrUnsupportedOption:
     71    case CtapDeviceResponseCode::kCtap2ErrInvalidOption:
     72    case CtapDeviceResponseCode::kCtap2ErrKeepAliveCancel:
     73    case CtapDeviceResponseCode::kCtap2ErrNoCredentials:
     74    case CtapDeviceResponseCode::kCtap2ErrUserActionTimeout:
     75    case CtapDeviceResponseCode::kCtap2ErrNotAllowed:
     76    case CtapDeviceResponseCode::kCtap2ErrPinInvalid:
     77    case CtapDeviceResponseCode::kCtap2ErrPinBlocked:
     78    case CtapDeviceResponseCode::kCtap2ErrPinAuthInvalid:
     79    case CtapDeviceResponseCode::kCtap2ErrPinAuthBlocked:
     80    case CtapDeviceResponseCode::kCtap2ErrPinNotSet:
     81    case CtapDeviceResponseCode::kCtap2ErrPinRequired:
     82    case CtapDeviceResponseCode::kCtap2ErrPinPolicyViolation:
     83    case CtapDeviceResponseCode::kCtap2ErrPinTokenExpired:
     84    case CtapDeviceResponseCode::kCtap2ErrRequestTooLarge:
     85    case CtapDeviceResponseCode::kCtap2ErrOther:
     86    case CtapDeviceResponseCode::kCtap2ErrSpecLast:
     87    case CtapDeviceResponseCode::kCtap2ErrExtensionFirst:
     88    case CtapDeviceResponseCode::kCtap2ErrExtensionLast:
     89    case CtapDeviceResponseCode::kCtap2ErrVendorFirst:
     90    case CtapDeviceResponseCode::kCtap2ErrVendorLast:
     91        return true;
     92    default:
     93        return false;
     94    }
     95}
    3696
    3797bool isFidoHidDeviceCommand(FidoHidDeviceCommand cmd)
     
    53113}
    54114
     115const char* publicKeyCredentialTypeToString(PublicKeyCredentialType type)
     116{
     117    switch (type) {
     118    case PublicKeyCredentialType::PublicKey:
     119        return kPublicKey;
     120    }
     121    ASSERT_NOT_REACHED();
     122    return kPublicKey;
     123}
     124
    55125} // namespace fido
    56126
  • trunk/Source/WebCore/Modules/webauthn/fido/FidoConstants.h

    r236976 r237983  
    3232#if ENABLE(WEB_AUTHN)
    3333
     34#include "PublicKeyCredentialType.h"
     35
    3436namespace fido {
     37
     38enum class ProtocolVersion {
     39    kCtap,
     40    kU2f,
     41    kUnknown,
     42};
     43
     44// Length of the SHA-256 hash of the RP ID asssociated with the credential:
     45// https://www.w3.org/TR/webauthn/#sec-authenticator-data
     46constexpr size_t kRpIdHashLength = 32;
     47
     48// Length of the flags:
     49// https://www.w3.org/TR/webauthn/#sec-authenticator-data
     50constexpr size_t kFlagsLength = 1;
     51
     52// Length of the signature counter, 32-bit unsigned big-endian integer:
     53// https://www.w3.org/TR/webauthn/#sec-authenticator-data
     54constexpr size_t kSignCounterLength = 4;
     55
     56// Length of the AAGUID of the authenticator:
     57// https://www.w3.org/TR/webauthn/#sec-attested-credential-data
     58constexpr size_t kAaguidLength = 16;
     59
     60// Length of the byte length L of Credential ID, 16-bit unsigned big-endian
     61// integer: https://www.w3.org/TR/webauthn/#sec-attested-credential-data
     62constexpr size_t kCredentialIdLengthLength = 2;
     63
     64// CTAP protocol device response code, as specified in
     65// https://fidoalliance.org/specs/fido-v2.0-ps-20170927/fido-client-to-authenticator-protocol-v2.0-ps-20170927.html#error-responses
     66enum class CtapDeviceResponseCode : uint8_t {
     67    kSuccess = 0x00,
     68    kCtap1ErrInvalidCommand = 0x01,
     69    kCtap1ErrInvalidParameter = 0x02,
     70    kCtap1ErrInvalidLength = 0x03,
     71    kCtap1ErrInvalidSeq = 0x04,
     72    kCtap1ErrTimeout = 0x05,
     73    kCtap1ErrChannelBusy = 0x06,
     74    kCtap1ErrLockRequired = 0x0A,
     75    kCtap1ErrInvalidChannel = 0x0B,
     76    kCtap2ErrCBORParsing = 0x10,
     77    kCtap2ErrUnexpectedType = 0x11,
     78    kCtap2ErrInvalidCBOR = 0x12,
     79    kCtap2ErrInvalidCBORType = 0x13,
     80    kCtap2ErrMissingParameter = 0x14,
     81    kCtap2ErrLimitExceeded = 0x15,
     82    kCtap2ErrUnsupportedExtension = 0x16,
     83    kCtap2ErrTooManyElements = 0x17,
     84    kCtap2ErrExtensionNotSupported = 0x18,
     85    kCtap2ErrCredentialExcluded = 0x19,
     86    kCtap2ErrProcesssing = 0x21,
     87    kCtap2ErrInvalidCredential = 0x22,
     88    kCtap2ErrUserActionPending = 0x23,
     89    kCtap2ErrOperationPending = 0x24,
     90    kCtap2ErrNoOperations = 0x25,
     91    kCtap2ErrUnsupportedAlgorithms = 0x26,
     92    kCtap2ErrOperationDenied = 0x27,
     93    kCtap2ErrKeyStoreFull = 0x28,
     94    kCtap2ErrNotBusy = 0x29,
     95    kCtap2ErrNoOperationPending = 0x2A,
     96    kCtap2ErrUnsupportedOption = 0x2B,
     97    kCtap2ErrInvalidOption = 0x2C,
     98    kCtap2ErrKeepAliveCancel = 0x2D,
     99    kCtap2ErrNoCredentials = 0x2E,
     100    kCtap2ErrUserActionTimeout = 0x2F,
     101    kCtap2ErrNotAllowed = 0x30,
     102    kCtap2ErrPinInvalid = 0x31,
     103    kCtap2ErrPinBlocked = 0x32,
     104    kCtap2ErrPinAuthInvalid = 0x33,
     105    kCtap2ErrPinAuthBlocked = 0x34,
     106    kCtap2ErrPinNotSet = 0x35,
     107    kCtap2ErrPinRequired = 0x36,
     108    kCtap2ErrPinPolicyViolation = 0x37,
     109    kCtap2ErrPinTokenExpired = 0x38,
     110    kCtap2ErrRequestTooLarge = 0x39,
     111    kCtap2ErrOther = 0x7F,
     112    kCtap2ErrSpecLast = 0xDF,
     113    kCtap2ErrExtensionFirst = 0xE0,
     114    kCtap2ErrExtensionLast = 0xEF,
     115    kCtap2ErrVendorFirst = 0xF0,
     116    kCtap2ErrVendorLast = 0xFF
     117};
     118
     119bool isCtapDeviceResponseCode(CtapDeviceResponseCode);
    35120
    36121// Commands supported by CTAPHID device as specified in
     
    48133};
    49134
    50 bool isFidoHidDeviceCommand(FidoHidDeviceCommand cmd);
     135bool isFidoHidDeviceCommand(FidoHidDeviceCommand);
     136
     137// String key values for CTAP request optional parameters and
     138// AuthenticatorGetInfo response.
     139const char kResidentKeyMapKey[] = "rk";
     140const char kUserVerificationMapKey[] = "uv";
     141const char kUserPresenceMapKey[] = "up";
     142const char kClientPinMapKey[] = "clientPin";
     143const char kPlatformDeviceMapKey[] = "plat";
     144const char kEntityIdMapKey[] = "id";
     145const char kEntityNameMapKey[] = "name";
     146const char kDisplayNameMapKey[] = "displayName";
     147const char kIconUrlMapKey[] = "icon";
     148const char kCredentialTypeMapKey[] = "type";
     149const char kCredentialAlgorithmMapKey[] = "alg";
     150// Keys for storing credential descriptor information in CBOR map.
     151const char kCredentialIdKey[] = "id";
     152const char kCredentialTypeKey[] = "type";
    51153
    52154// HID transport specific constants.
     
    64166const size_t kHidMaxMessageSize = 7609;
    65167
     168// Authenticator API commands supported by CTAP devices, as specified in
     169// https://fidoalliance.org/specs/fido-v2.0-rd-20170927/fido-client-to-authenticator-protocol-v2.0-rd-20170927.html#authenticator-api
     170enum class CtapRequestCommand : uint8_t {
     171    kAuthenticatorMakeCredential = 0x01,
     172    kAuthenticatorGetAssertion = 0x02,
     173    kAuthenticatorGetNextAssertion = 0x08,
     174    kAuthenticatorGetInfo = 0x04,
     175    kAuthenticatorClientPin = 0x06,
     176    kAuthenticatorReset = 0x07,
     177};
     178
     179// String key values for attestation object as a response to MakeCredential
     180// request.
     181const char kFormatKey[] = "fmt";
     182const char kAttestationStatementKey[] = "attStmt";
     183const char kAuthDataKey[] = "authData";
     184const char kNoneAttestationValue[] = "none";
     185
     186// String representation of public key credential enum.
     187// https://w3c.github.io/webauthn/#credentialType
     188const char kPublicKey[] = "public-key";
     189
     190const char* publicKeyCredentialTypeToString(WebCore::PublicKeyCredentialType);
     191
     192// FIXME: Add url to the official spec once it's standardized.
     193const char kCtap2Version[] = "FIDO_2_0";
     194const char kU2fVersion[] = "U2F_V2";
     195
    66196} // namespace fido
    67197
  • trunk/Source/WebCore/Sources.txt

    r237981 r237983  
    260260Modules/webauthn/cbor/CBORValue.cpp
    261261Modules/webauthn/cbor/CBORWriter.cpp
     262Modules/webauthn/fido/AuthenticatorGetInfoResponse.cpp
     263Modules/webauthn/fido/AuthenticatorSupportedOptions.cpp
     264Modules/webauthn/fido/DeviceRequestConverter.cpp
     265Modules/webauthn/fido/DeviceResponseConverter.cpp
    262266Modules/webauthn/fido/FidoConstants.cpp
    263267Modules/webauthn/fido/FidoHidMessage.cpp
     
    31803184JSUIEventInit.cpp
    31813185JSURLSearchParams.cpp
     3186JSUserVerificationRequirement.cpp
    31823187JSVRDisplay.cpp
    31833188JSVRDisplayCapabilities.cpp
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r237981 r237983  
    17681768                5721A98B1ECE57040081295A /* CryptoAlgorithmRsaPssParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5721A9881ECE57040081295A /* CryptoAlgorithmRsaPssParams.h */; };
    17691769                572A7F211C6E5719009C6149 /* SimulatedClick.h in Headers */ = {isa = PBXBuildFile; fileRef = 572A7F201C6E5719009C6149 /* SimulatedClick.h */; };
     1770                572B401F21757A64000AD43E /* DeviceRequestConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 572B401D21757A64000AD43E /* DeviceRequestConverter.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1771                572B402C21769020000AD43E /* JSUserVerificationRequirement.h in Headers */ = {isa = PBXBuildFile; fileRef = 572B402A2176901F000AD43E /* JSUserVerificationRequirement.h */; };
     1772                572B40362176A922000AD43E /* UserVerificationRequirement.h in Headers */ = {isa = PBXBuildFile; fileRef = 572B402321768D85000AD43E /* UserVerificationRequirement.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1773                572B403A21772581000AD43E /* DeviceResponseConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 572B40372177256C000AD43E /* DeviceResponseConverter.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1774                572B404021780171000AD43E /* AuthenticatorSupportedOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 572B403E21780170000AD43E /* AuthenticatorSupportedOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1775                572B40422178114A000AD43E /* AuthenticatorGetInfoResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 572B403C2177FB61000AD43E /* AuthenticatorGetInfoResponse.h */; settings = {ATTRIBUTES = (Private, ); }; };
    17701776                57303BB92006C6EE00355965 /* CBORValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 57303BB42006C6ED00355965 /* CBORValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
    17711777                57303BBA2006C6EE00355965 /* CBORWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 57303BB52006C6ED00355965 /* CBORWriter.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    86178623                572A7F201C6E5719009C6149 /* SimulatedClick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimulatedClick.h; sourceTree = "<group>"; };
    86188624                572A7F221C6E5A66009C6149 /* SimulatedClick.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimulatedClick.cpp; sourceTree = "<group>"; };
     8625                572B401D21757A64000AD43E /* DeviceRequestConverter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DeviceRequestConverter.h; sourceTree = "<group>"; };
     8626                572B401E21757A64000AD43E /* DeviceRequestConverter.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceRequestConverter.cpp; sourceTree = "<group>"; };
     8627                572B402321768D85000AD43E /* UserVerificationRequirement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserVerificationRequirement.h; sourceTree = "<group>"; };
     8628                572B402521768D85000AD43E /* UserVerificationRequirement.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = UserVerificationRequirement.idl; sourceTree = "<group>"; };
     8629                572B402A2176901F000AD43E /* JSUserVerificationRequirement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSUserVerificationRequirement.h; sourceTree = "<group>"; };
     8630                572B402B2176901F000AD43E /* JSUserVerificationRequirement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSUserVerificationRequirement.cpp; sourceTree = "<group>"; };
     8631                572B40372177256C000AD43E /* DeviceResponseConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceResponseConverter.h; sourceTree = "<group>"; };
     8632                572B40382177256C000AD43E /* DeviceResponseConverter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceResponseConverter.cpp; sourceTree = "<group>"; };
     8633                572B403B2177FB60000AD43E /* AuthenticatorGetInfoResponse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticatorGetInfoResponse.cpp; sourceTree = "<group>"; };
     8634                572B403C2177FB61000AD43E /* AuthenticatorGetInfoResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticatorGetInfoResponse.h; sourceTree = "<group>"; };
     8635                572B403D2178016F000AD43E /* AuthenticatorSupportedOptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticatorSupportedOptions.cpp; sourceTree = "<group>"; };
     8636                572B403E21780170000AD43E /* AuthenticatorSupportedOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticatorSupportedOptions.h; sourceTree = "<group>"; };
    86198637                57303BB42006C6ED00355965 /* CBORValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBORValue.h; sourceTree = "<group>"; };
    86208638                57303BB52006C6ED00355965 /* CBORWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CBORWriter.h; sourceTree = "<group>"; };
     
    1920719225                        isa = PBXGroup;
    1920819226                        children = (
     19227                                572B403B2177FB60000AD43E /* AuthenticatorGetInfoResponse.cpp */,
     19228                                572B403C2177FB61000AD43E /* AuthenticatorGetInfoResponse.h */,
     19229                                572B403D2178016F000AD43E /* AuthenticatorSupportedOptions.cpp */,
     19230                                572B403E21780170000AD43E /* AuthenticatorSupportedOptions.h */,
     19231                                572B401E21757A64000AD43E /* DeviceRequestConverter.cpp */,
     19232                                572B401D21757A64000AD43E /* DeviceRequestConverter.h */,
     19233                                572B40382177256C000AD43E /* DeviceResponseConverter.cpp */,
     19234                                572B40372177256C000AD43E /* DeviceResponseConverter.h */,
    1920919235                                57BAF2872167D2F7008E954E /* FidoConstants.cpp */,
    1921019236                                578A4C0B2167D29600D08F34 /* FidoConstants.h */,
     
    1928619312                                57303BEA20097F4000355965 /* PublicKeyCredentialType.h */,
    1928719313                                57303BF02009846100355965 /* PublicKeyCredentialType.idl */,
     19314                                572B402321768D85000AD43E /* UserVerificationRequirement.h */,
     19315                                572B402521768D85000AD43E /* UserVerificationRequirement.idl */,
    1928819316                        );
    1928919317                        path = webauthn;
     
    1931119339                                57303BFA2009913500355965 /* JSPublicKeyCredentialType.cpp */,
    1931219340                                57303BF92009913400355965 /* JSPublicKeyCredentialType.h */,
     19341                                572B402B2176901F000AD43E /* JSUserVerificationRequirement.cpp */,
     19342                                572B402A2176901F000AD43E /* JSUserVerificationRequirement.h */,
    1931319343                        );
    1931419344                        name = WebAuthN;
     
    2783127861                                57303C4620105D2F00355965 /* AuthenticatorCoordinator.h in Headers */,
    2783227862                                5760827220215A5500116678 /* AuthenticatorCoordinatorClient.h in Headers */,
     27863                                572B40422178114A000AD43E /* AuthenticatorGetInfoResponse.h in Headers */,
    2783327864                                57303BD220087A8300355965 /* AuthenticatorResponse.h in Headers */,
     27865                                572B404021780171000AD43E /* AuthenticatorSupportedOptions.h in Headers */,
    2783427866                                57DCED9021487FF70016B847 /* AuthenticatorTransport.h in Headers */,
    2783527867                                A501920E132EBF2E008BFE55 /* Autocapitalize.h in Headers */,
     
    2835428386                                590E1B4911E4EF4B0069F784 /* DeviceOrientationData.h in Headers */,
    2835528387                                59A85EA4119D68EC00DEF1EF /* DeviceOrientationEvent.h in Headers */,
     28388                                572B401F21757A64000AD43E /* DeviceRequestConverter.h in Headers */,
     28389                                572B403A21772581000AD43E /* DeviceResponseConverter.h in Headers */,
    2835628390                                267725FD1A5B3AD9003C24DD /* DFA.h in Headers */,
    2835728391                                5CD9F5661AA0F73C00DA45FF /* DFABytecode.h in Headers */,
     
    2983829872                                7C73FB12191EF6F4007DE061 /* JSUserMessageHandler.h in Headers */,
    2983929873                                7C73FB0D191EF5A8007DE061 /* JSUserMessageHandlersNamespace.h in Headers */,
     29874                                572B402C21769020000AD43E /* JSUserVerificationRequirement.h in Headers */,
    2984029875                                15C77093100D3CA8005BA267 /* JSValidityState.h in Headers */,
    2984129876                                BE8EF04B171C9014009B48C3 /* JSVideoTrack.h in Headers */,
     
    3149531530                                BC8BF15A1058141800A40A07 /* UserStyleSheetTypes.h in Headers */,
    3149631531                                BCDF317C11F8D683003C5BF8 /* UserTypingGestureIndicator.h in Headers */,
     31532                                572B40362176A922000AD43E /* UserVerificationRequirement.h in Headers */,
    3149731533                                55AF14E61EAAC59B0026EEAA /* UTIRegistry.h in Headers */,
    3149831534                                1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */,
  • trunk/Tools/ChangeLog

    r237972 r237983  
     12018-11-08  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        [WebAuthN] Import CTAP device request/response converters from Chromium
     4        https://bugs.webkit.org/show_bug.cgi?id=190784
     5        <rdar://problem/45460333>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     10        * TestWebKitAPI/Tests/WebCore/CBORValueTest.cpp:
     11        (TestWebKitAPI::TEST):
     12        * TestWebKitAPI/Tests/WebCore/CtapRequestTest.cpp: Added.
     13        (TestWebKitAPI::TEST):
     14        * TestWebKitAPI/Tests/WebCore/CtapResponseTest.cpp: Added.
     15        (TestWebKitAPI::getTestCorruptedSignResponse):
     16        (TestWebKitAPI::getTestCredentialRawIdBytes):
     17        (TestWebKitAPI::convertToVector):
     18        (TestWebKitAPI::TEST):
     19        * TestWebKitAPI/Tests/WebCore/FidoTestData.h: Added.
     20
    1212018-11-07  Caio Lima  <ticaiolima@gmail.com>
    222
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r237969 r237983  
    247247                5714ECBD1CA8C22A00051AC8 /* DownloadRequestOriginalURL2.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5714ECBC1CA8C21800051AC8 /* DownloadRequestOriginalURL2.html */; };
    248248                571F7FD01F2961FB00946648 /* IndexedDBStructuredCloneBackwardCompatibility.sqlite3-wal in Copy Resources */ = {isa = PBXBuildFile; fileRef = 571F7FCF1F2961E100946648 /* IndexedDBStructuredCloneBackwardCompatibility.sqlite3-wal */; };
     249                572B403421769A88000AD43E /* CtapRequestTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 572B403321769A88000AD43E /* CtapRequestTest.cpp */; };
     250                572B404421781B43000AD43E /* CtapResponseTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 572B404321781B42000AD43E /* CtapResponseTest.cpp */; };
    249251                57303BC9200824D300355965 /* CBORValueTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57303BAC2006C56000355965 /* CBORValueTest.cpp */; };
    250252                57303BCA20082C0100355965 /* CBORWriterTest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57303BAB2006C55400355965 /* CBORWriterTest.cpp */; };
     
    15621564                5714ECBC1CA8C21800051AC8 /* DownloadRequestOriginalURL2.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DownloadRequestOriginalURL2.html; sourceTree = "<group>"; };
    15631565                571F7FCF1F2961E100946648 /* IndexedDBStructuredCloneBackwardCompatibility.sqlite3-wal */ = {isa = PBXFileReference; lastKnownFileType = file; path = "IndexedDBStructuredCloneBackwardCompatibility.sqlite3-wal"; sourceTree = "<group>"; };
     1566                572B403321769A88000AD43E /* CtapRequestTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CtapRequestTest.cpp; sourceTree = "<group>"; };
     1567                572B40352176A029000AD43E /* FidoTestData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FidoTestData.h; sourceTree = "<group>"; };
     1568                572B404321781B42000AD43E /* CtapResponseTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CtapResponseTest.cpp; sourceTree = "<group>"; };
    15641569                57303BAB2006C55400355965 /* CBORWriterTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CBORWriterTest.cpp; sourceTree = "<group>"; };
    15651570                57303BAC2006C56000355965 /* CBORValueTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CBORValueTest.cpp; sourceTree = "<group>"; };
     
    25532558                                7CB184C41AA3F2100066EDFD /* ContentExtensions.cpp */,
    25542559                                CD5451E919E41F9D0016936F /* CSSParser.cpp */,
     2560                                572B403321769A88000AD43E /* CtapRequestTest.cpp */,
     2561                                572B404321781B42000AD43E /* CtapResponseTest.cpp */,
    25552562                                260BA5781B1D2E7B004FA07C /* DFACombiner.cpp */,
    25562563                                260BA57A1B1D2EE2004FA07C /* DFAHelpers.h */,
     
    25582565                                3151180F1DB1ADD500176304 /* ExtendedColor.cpp */,
    25592566                                579651E6216BFD53006EBFE5 /* FidoHidMessageTest.cpp */,
     2567                                572B40352176A029000AD43E /* FidoTestData.h */,
    25602568                                7A32D7491F02151500162C44 /* FileMonitor.cpp */,
    25612569                                41973B5A1AF2286A006C7B36 /* FileSystem.cpp */,
     
    37933801                                7AEAD47F1E20116C00416EFE /* CrossPartitionFileSchemeAccess.mm in Sources */,
    37943802                                7CCE7EDB1A411A9200447C4C /* CSSParser.cpp in Sources */,
     3803                                572B403421769A88000AD43E /* CtapRequestTest.cpp in Sources */,
     3804                                572B404421781B43000AD43E /* CtapResponseTest.cpp in Sources */,
    37953805                                7AC7B57020D9BA5B002C09A0 /* CustomBundleObject.mm in Sources */,
    37963806                                7AC7B56D20D9769F002C09A0 /* CustomBundleParameter.mm in Sources */,
  • trunk/Tools/TestWebKitAPI/Tests/WebCore/CBORValueTest.cpp

    r235861 r237983  
    149149}
    150150
     151TEST(CBORValueTest, ConstructSimpleBooleanValue)
     152{
     153    CBORValue trueValue(true);
     154    ASSERT_EQ(CBORValue::Type::SimpleValue, trueValue.type());
     155    EXPECT_TRUE(trueValue.getBool());
     156
     157    CBORValue falseValue(false);
     158    ASSERT_EQ(CBORValue::Type::SimpleValue, falseValue.type());
     159    EXPECT_FALSE(falseValue.getBool());
     160}
     161
    151162// Test copy constructors
    152163TEST(CBORValueTest, CopyUnsigned)
Note: See TracChangeset for help on using the changeset viewer.