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

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: change GetEid to take RemoteDevice 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 uint8_t EidSeed[32];
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. If this seed is different from the current_seed_, then
49 // re-seed the generator. Otherwise generate based on time and stuff.
50 uint16_t GetEid(const RemoteDevice& device) { return 42; }
Kyle Horimoto 2016/07/29 03:15:39 1) Your function should take a public key as a par
jingxuy 2016/07/29 18:45:43 I thought we agreed on it take RemoteDevice? But I
Kyle Horimoto 2016/07/29 19:04:18 The public key of the local device as well as meta
jingxuy 2016/07/29 20:26:01 what's the type of public key? Are you talking abo
Kyle Horimoto 2016/07/29 21:07:45 Yep, though it needs to be converted into a data a
51
52 protected:
53 BluetoothLowEnergyEidGenerator(){};
54 };
55
56 } // namespace weave
57
58 } // namespace proximity_auth
59
60 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698