Jun Choi | d159e2e | 2018-01-05 20:50:59 | [diff] [blame] | 1 | // 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 | |
jdoerrie | 98ee9e3 | 2018-02-05 22:03:44 | [diff] [blame] | 5 | #ifndef DEVICE_FIDO_PUBLIC_KEY_CREDENTIAL_RP_ENTITY_H_ |
| 6 | #define DEVICE_FIDO_PUBLIC_KEY_CREDENTIAL_RP_ENTITY_H_ |
Jun Choi | d159e2e | 2018-01-05 20:50:59 | [diff] [blame] | 7 | |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
Balazs Engedy | d531bf4 | 2018-03-12 22:51:42 | [diff] [blame] | 11 | #include "base/component_export.h" |
Jun Choi | b4438bc | 2018-02-27 00:20:34 | [diff] [blame] | 12 | #include "base/macros.h" |
Jun Choi | d159e2e | 2018-01-05 20:50:59 | [diff] [blame] | 13 | #include "base/optional.h" |
Adam Langley | e0e46cdf | 2018-10-29 19:23:16 | [diff] [blame] | 14 | #include "components/cbor/values.h" |
Jun Choi | d159e2e | 2018-01-05 20:50:59 | [diff] [blame] | 15 | #include "url/gurl.h" |
| 16 | |
| 17 | namespace 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 Engedy | d531bf4 | 2018-03-12 22:51:42 | [diff] [blame] | 22 | class COMPONENT_EXPORT(DEVICE_FIDO) PublicKeyCredentialRpEntity { |
Jun Choi | d159e2e | 2018-01-05 20:50:59 | [diff] [blame] | 23 | public: |
Jun Choi | 09664c0 | 2018-06-23 01:37:00 | [diff] [blame] | 24 | static base::Optional<PublicKeyCredentialRpEntity> CreateFromCBORValue( |
Adam Langley | b4f12f9 | 2018-10-26 21:00:02 | [diff] [blame] | 25 | const cbor::Value& cbor); |
Jun Choi | 09664c0 | 2018-06-23 01:37:00 | [diff] [blame] | 26 | |
Jun Choi | b4438bc | 2018-02-27 00:20:34 | [diff] [blame] | 27 | explicit PublicKeyCredentialRpEntity(std::string rp_id); |
Jun Choi | 1c36cd8 | 2018-03-28 00:32:42 | [diff] [blame] | 28 | PublicKeyCredentialRpEntity(const PublicKeyCredentialRpEntity& other); |
Jun Choi | b4438bc | 2018-02-27 00:20:34 | [diff] [blame] | 29 | PublicKeyCredentialRpEntity(PublicKeyCredentialRpEntity&& other); |
Jun Choi | 1c36cd8 | 2018-03-28 00:32:42 | [diff] [blame] | 30 | PublicKeyCredentialRpEntity& operator=( |
| 31 | const PublicKeyCredentialRpEntity& other); |
Jun Choi | b4438bc | 2018-02-27 00:20:34 | [diff] [blame] | 32 | PublicKeyCredentialRpEntity& operator=(PublicKeyCredentialRpEntity&& other); |
| 33 | ~PublicKeyCredentialRpEntity(); |
Jun Choi | d159e2e | 2018-01-05 20:50:59 | [diff] [blame] | 34 | |
Adam Langley | b4f12f9 | 2018-10-26 21:00:02 | [diff] [blame] | 35 | cbor::Value ConvertToCBOR() const; |
Jun Choi | d159e2e | 2018-01-05 20:50:59 | [diff] [blame] | 36 | |
Jun Choi | b4438bc | 2018-02-27 00:20:34 | [diff] [blame] | 37 | 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 Choi | d159e2e | 2018-01-05 20:50:59 | [diff] [blame] | 44 | private: |
| 45 | std::string rp_id_; |
| 46 | base::Optional<std::string> rp_name_; |
| 47 | base::Optional<GURL> rp_icon_url_; |
Jun Choi | d159e2e | 2018-01-05 20:50:59 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | } // namespace device |
| 51 | |
jdoerrie | 98ee9e3 | 2018-02-05 22:03:44 | [diff] [blame] | 52 | #endif // DEVICE_FIDO_PUBLIC_KEY_CREDENTIAL_RP_ENTITY_H_ |