Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: components/proximity_auth/ble/bluetooth_low_energy_eid_generator.h

Issue 2183523006: Chrome OS uWeave Characteristics Server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@migration
Patch Set: added channel Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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
5 #ifndef COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_EID_GENERATOR_H _
6 #define COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_EID_GENERATOR_H _
7
8 #include <stddef.h>
9 #include <stdint.h>
10
11 #include <memory>
12
13 #include "components/proximity_auth/remote_device.h"
14
15 namespace proximity_auth {
16 namespace weave {
17
18 // Represent a EID generator for a single device.
19 // EID is ephemeral id needed to be included for the advertisement for security
20 // and privacy reasons.
21 // It has the repsonsiblity of getting the correct EID seed out of the
22 // RemoteDevice and encode the seed with the timestamp to get the EID
23 class BluetoothLowEnergyEidGenerator {
24 public:
25 class Factory {
26 public:
27 // TODO(jingxuy): this is just stop compiler from complaining.
28 static std::unique_ptr<BluetoothLowEnergyEidGenerator> NewInstance() {
29 return std::unique_ptr<BluetoothLowEnergyEidGenerator>(
30 new BluetoothLowEnergyEidGenerator());
31 }
32
33 // Exposed for testing.
34 static void SetInstanceForTesting(Factory* factory);
35
36 protected:
37 // Exposed for testing.
38 virtual std::unique_ptr<BluetoothLowEnergyEidGenerator> BuildInstance();
39
40 private:
41 static Factory* factory_instance_;
42 };
43
44 typedef std::vector<uint8_t> AdvertisementContent;
45
46 // TODO(tether-dev): Make this actually generate EID.
47 // This function should look at the time and get the correct seed out of the
48 // remote device and use this seed to generate the EID.
49 AdvertisementContent GetAdvertisementContent(const RemoteDevice& device,
50 std::string public_key) {
51 std::vector<uint8_t> rtn{1, 2, 3, 4};
52 return rtn;
53 }
54
55 protected:
56 BluetoothLowEnergyEidGenerator(){};
57 };
58
59 } // namespace weave
60
61 } // namespace proximity_auth
62
63 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698