blob: d7a7d23a28eb55396a5d1c328849e1384bd4a38c [file] [log] [blame]
Jun Choid159e2e2018-01-05 20:50:591// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
jdoerrie98ee9e32018-02-05 22:03:445#ifndef DEVICE_FIDO_PUBLIC_KEY_CREDENTIAL_RP_ENTITY_H_
6#define DEVICE_FIDO_PUBLIC_KEY_CREDENTIAL_RP_ENTITY_H_
Jun Choid159e2e2018-01-05 20:50:597
8#include <string>
9#include <vector>
10
Balazs Engedyd531bf42018-03-12 22:51:4211#include "base/component_export.h"
Jun Choib4438bc2018-02-27 00:20:3412#include "base/macros.h"
Jun Choid159e2e2018-01-05 20:50:5913#include "base/optional.h"
Adam Langleye0e46cdf2018-10-29 19:23:1614#include "components/cbor/values.h"
Jun Choid159e2e2018-01-05 20:50:5915#include "url/gurl.h"
16
17namespace device {
18
19// Data structure containing information about relying party that invoked
20// WebAuth API. Includes a relying party id, an optional relying party name,,
21// and optional relying party display image url.
Balazs Engedyd531bf42018-03-12 22:51:4222class COMPONENT_EXPORT(DEVICE_FIDO) PublicKeyCredentialRpEntity {
Jun Choid159e2e2018-01-05 20:50:5923 public:
Jun Choi09664c02018-06-23 01:37:0024 static base::Optional<PublicKeyCredentialRpEntity> CreateFromCBORValue(
Adam Langleyb4f12f92018-10-26 21:00:0225 const cbor::Value& cbor);
Jun Choi09664c02018-06-23 01:37:0026
Jun Choib4438bc2018-02-27 00:20:3427 explicit PublicKeyCredentialRpEntity(std::string rp_id);
Jun Choi1c36cd82018-03-28 00:32:4228 PublicKeyCredentialRpEntity(const PublicKeyCredentialRpEntity& other);
Jun Choib4438bc2018-02-27 00:20:3429 PublicKeyCredentialRpEntity(PublicKeyCredentialRpEntity&& other);
Jun Choi1c36cd82018-03-28 00:32:4230 PublicKeyCredentialRpEntity& operator=(
31 const PublicKeyCredentialRpEntity& other);
Jun Choib4438bc2018-02-27 00:20:3432 PublicKeyCredentialRpEntity& operator=(PublicKeyCredentialRpEntity&& other);
33 ~PublicKeyCredentialRpEntity();
Jun Choid159e2e2018-01-05 20:50:5934
Adam Langleyb4f12f92018-10-26 21:00:0235 cbor::Value ConvertToCBOR() const;
Jun Choid159e2e2018-01-05 20:50:5936
Jun Choib4438bc2018-02-27 00:20:3437 PublicKeyCredentialRpEntity& SetRpName(std::string rp_name);
38 PublicKeyCredentialRpEntity& SetRpIconUrl(GURL icon_url);
39
40 const std::string& rp_id() const { return rp_id_; }
41 const base::Optional<std::string>& rp_name() const { return rp_name_; }
42 const base::Optional<GURL>& rp_icon_url() const { return rp_icon_url_; }
43
Jun Choid159e2e2018-01-05 20:50:5944 private:
45 std::string rp_id_;
46 base::Optional<std::string> rp_name_;
47 base::Optional<GURL> rp_icon_url_;
Jun Choid159e2e2018-01-05 20:50:5948};
49
50} // namespace device
51
jdoerrie98ee9e32018-02-05 22:03:4452#endif // DEVICE_FIDO_PUBLIC_KEY_CREDENTIAL_RP_ENTITY_H_