summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/credentialmanager/authenticator_attestation_response.cc
blob: a75213c62afc6f5fc410f206ed2e36e36f97a5c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/modules/credentialmanager/authenticator_attestation_response.h"

#include "third_party/blink/renderer/modules/credentialmanager/credential_manager_type_converters.h"

namespace blink {

AuthenticatorAttestationResponse::AuthenticatorAttestationResponse(
    DOMArrayBuffer* client_data_json,
    DOMArrayBuffer* attestation_object,
    Vector<mojom::AuthenticatorTransport> transports)
    : AuthenticatorResponse(client_data_json),
      attestation_object_(attestation_object),
      transports_(std::move(transports)) {}

AuthenticatorAttestationResponse::~AuthenticatorAttestationResponse() = default;

Vector<String> AuthenticatorAttestationResponse::getTransports() const {
  Vector<String> ret;
  for (auto transport : transports_) {
    ret.emplace_back(mojo::ConvertTo<String>(transport));
  }
  std::sort(ret.begin(), ret.end(), WTF::CodeUnitCompareLessThan);
  return ret;
}

void AuthenticatorAttestationResponse::Trace(Visitor* visitor) {
  visitor->Trace(attestation_object_);
  AuthenticatorResponse::Trace(visitor);
}

}  // namespace blink