OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/cryptauth/eid_generator.h" | 5 #include "components/cryptauth/eid_generator.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 base::TimeDelta::FromHours(2).InMilliseconds(); | 32 base::TimeDelta::FromHours(2).InMilliseconds(); |
33 const int32_t kNumBytesInEidValue = 2; | 33 const int32_t kNumBytesInEidValue = 2; |
34 const int64_t kNumMsInEidSeedPeriod = | 34 const int64_t kNumMsInEidSeedPeriod = |
35 base::TimeDelta::FromDays(14).InMilliseconds(); | 35 base::TimeDelta::FromDays(14).InMilliseconds(); |
36 | 36 |
37 // Midnight on 1/1/2020. | 37 // Midnight on 1/1/2020. |
38 const int64_t kDefaultCurrentPeriodStart = 1577836800000L; | 38 const int64_t kDefaultCurrentPeriodStart = 1577836800000L; |
39 // 1:43am on 1/1/2020. | 39 // 1:43am on 1/1/2020. |
40 const int64_t kDefaultCurrentTime = 1577843000000L; | 40 const int64_t kDefaultCurrentTime = 1577843000000L; |
41 | 41 |
42 // Base64 encoded values for: "firstSeed", "secondSeed", "thirdSeed" and | 42 // The Base64 encoded values of these raw data strings are, respectively: |
43 // "fourthSeed". | 43 // "Zmlyc3RTZWVk", "c2Vjb25kU2VlZA==", "dGhpcmRTZWVk","Zm91cnRoU2VlZA==". |
44 const std::string kFirstSeed = "Zmlyc3RTZWVk"; | 44 const std::string kFirstSeed = "firstSeed"; |
45 const std::string kSecondSeed = "c2Vjb25kU2VlZA=="; | 45 const std::string kSecondSeed = "secondSeed"; |
46 const std::string kThirdSeed = "dGhpcmRTZWVk"; | 46 const std::string kThirdSeed = "thirdSeed"; |
47 const std::string kFourthSeed = "Zm91cnRoU2VlZA=="; | 47 const std::string kFourthSeed = "fourthSeed"; |
48 | 48 |
49 const std::string kDefaultAdvertisingDevicePublicKey = "publicKey"; | 49 const std::string kDefaultAdvertisingDevicePublicKey = "publicKey"; |
50 | 50 |
51 static BeaconSeed CreateBeaconSeed(const std::string& data, | 51 static BeaconSeed CreateBeaconSeed(const std::string& data, |
52 const int64_t start_timestamp_ms, | 52 const int64_t start_timestamp_ms, |
53 const int64_t end_timestamp_ms) { | 53 const int64_t end_timestamp_ms) { |
54 BeaconSeed seed; | 54 BeaconSeed seed; |
55 seed.set_data(data); | 55 seed.set_data(data); |
56 seed.set_start_time_millis(start_timestamp_ms); | 56 seed.set_start_time_millis(start_timestamp_ms); |
57 seed.set_end_time_millis(end_timestamp_ms); | 57 seed.set_end_time_millis(end_timestamp_ms); |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 EidGenerator::DataWithTimestamp data_with_timestamp( | 761 EidGenerator::DataWithTimestamp data_with_timestamp( |
762 "data", /* start */ 1000L, /* end */ 2000L); | 762 "data", /* start */ 1000L, /* end */ 2000L); |
763 EXPECT_FALSE(data_with_timestamp.ContainsTime(999L)); | 763 EXPECT_FALSE(data_with_timestamp.ContainsTime(999L)); |
764 EXPECT_TRUE(data_with_timestamp.ContainsTime(1000L)); | 764 EXPECT_TRUE(data_with_timestamp.ContainsTime(1000L)); |
765 EXPECT_TRUE(data_with_timestamp.ContainsTime(1500L)); | 765 EXPECT_TRUE(data_with_timestamp.ContainsTime(1500L)); |
766 EXPECT_TRUE(data_with_timestamp.ContainsTime(1999L)); | 766 EXPECT_TRUE(data_with_timestamp.ContainsTime(1999L)); |
767 EXPECT_FALSE(data_with_timestamp.ContainsTime(2000L)); | 767 EXPECT_FALSE(data_with_timestamp.ContainsTime(2000L)); |
768 } | 768 } |
769 | 769 |
770 } // namespace cryptauth | 770 } // namespace cryptauth |
OLD | NEW |