| Index: components/proximity_auth/ble/bluetooth_low_energy_eid_generator.h
|
| diff --git a/components/proximity_auth/ble/bluetooth_low_energy_eid_generator.h b/components/proximity_auth/ble/bluetooth_low_energy_eid_generator.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f1d9269ced66edab2167376ab7cb61eafa06d449
|
| --- /dev/null
|
| +++ b/components/proximity_auth/ble/bluetooth_low_energy_eid_generator.h
|
| @@ -0,0 +1,63 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_EID_GENERATOR_H_
|
| +#define COMPONENTS_PROXIMITY_AUTH_BLE_BLUETOOTH_LOW_ENERGY_WEAVE_EID_GENERATOR_H_
|
| +
|
| +#include <stddef.h>
|
| +#include <stdint.h>
|
| +
|
| +#include <memory>
|
| +
|
| +#include "components/proximity_auth/remote_device.h"
|
| +
|
| +namespace proximity_auth {
|
| +namespace weave {
|
| +
|
| +// Represent a EID generator for a single device.
|
| +// EID is ephemeral id needed to be included for the advertisement for security
|
| +// and privacy reasons.
|
| +// It has the repsonsiblity of getting the correct EID seed out of the
|
| +// RemoteDevice and encode the seed with the timestamp to get the EID
|
| +class BluetoothLowEnergyEidGenerator {
|
| + public:
|
| + class Factory {
|
| + public:
|
| + // TODO(jingxuy): this is just stop compiler from complaining.
|
| + static std::unique_ptr<BluetoothLowEnergyEidGenerator> NewInstance() {
|
| + return std::unique_ptr<BluetoothLowEnergyEidGenerator>(
|
| + new BluetoothLowEnergyEidGenerator());
|
| + }
|
| +
|
| + // Exposed for testing.
|
| + static void SetInstanceForTesting(Factory* factory);
|
| +
|
| + protected:
|
| + // Exposed for testing.
|
| + virtual std::unique_ptr<BluetoothLowEnergyEidGenerator> BuildInstance();
|
| +
|
| + private:
|
| + static Factory* factory_instance_;
|
| + };
|
| +
|
| + typedef std::vector<uint8_t> AdvertisementContent;
|
| +
|
| + // TODO(tether-dev): Make this actually generate EID.
|
| + // This function should look at the time and get the correct seed out of the
|
| + // remote device and use this seed to generate the EID.
|
| + AdvertisementContent GetAdvertisementContent(const RemoteDevice& device,
|
| + std::string public_key) {
|
| + std::vector<uint8_t> rtn{1, 2, 3, 4};
|
| + return rtn;
|
| + }
|
| +
|
| + protected:
|
| + BluetoothLowEnergyEidGenerator(){};
|
| +};
|
| +
|
| +} // namespace weave
|
| +
|
| +} // namespace proximity_auth
|
| +
|
| +#endif
|
|
|