Commit 92ac2271 authored by James Hawkins's avatar James Hawkins Committed by Commit Bot

extensions/EasyUnlockPrivateApi: Remove unused methods.

R=hansberry@chromium.org, tbarzic@chromium.org

Bug: none
Test: none
Change-Id: I0a02c8bc0cd6a5a38f88ead70d6876f9014045ce
Reviewed-on: https://chromium-review.googlesource.com/1012449Reviewed-by: default avatarRyan Hansberry <hansberry@chromium.org>
Reviewed-by: default avatarToni Barzic <tbarzic@chromium.org>
Commit-Queue: James Hawkins <jhawkins@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550804}
parent 475c1a2b
...@@ -916,9 +916,6 @@ static_library("extensions") { ...@@ -916,9 +916,6 @@ static_library("extensions") {
"api/easy_unlock_private/easy_unlock_private_connection.h", "api/easy_unlock_private/easy_unlock_private_connection.h",
"api/easy_unlock_private/easy_unlock_private_connection_manager.cc", "api/easy_unlock_private/easy_unlock_private_connection_manager.cc",
"api/easy_unlock_private/easy_unlock_private_connection_manager.h", "api/easy_unlock_private/easy_unlock_private_connection_manager.h",
"api/easy_unlock_private/easy_unlock_private_crypto_delegate.h",
"api/easy_unlock_private/easy_unlock_private_crypto_delegate_chromeos.cc",
"api/easy_unlock_private/easy_unlock_private_crypto_delegate_stub.cc",
"api/enterprise_device_attributes/enterprise_device_attributes_api.cc", "api/enterprise_device_attributes/enterprise_device_attributes_api.cc",
"api/enterprise_device_attributes/enterprise_device_attributes_api.h", "api/enterprise_device_attributes/enterprise_device_attributes_api.h",
"api/enterprise_platform_keys/enterprise_platform_keys_api.cc", "api/enterprise_platform_keys/enterprise_platform_keys_api.cc",
......
...@@ -27,8 +27,6 @@ class BrowserContext; ...@@ -27,8 +27,6 @@ class BrowserContext;
namespace cryptauth { namespace cryptauth {
class Connection; class Connection;
class ExternalDeviceInfo;
class SecureMessageDelegate;
} }
namespace proximity_auth { namespace proximity_auth {
...@@ -38,7 +36,6 @@ class BluetoothLowEnergyConnectionFinder; ...@@ -38,7 +36,6 @@ class BluetoothLowEnergyConnectionFinder;
namespace extensions { namespace extensions {
class EasyUnlockPrivateConnectionManager; class EasyUnlockPrivateConnectionManager;
class EasyUnlockPrivateCryptoDelegate;
class EasyUnlockPrivateAPI : public BrowserContextKeyedAPI { class EasyUnlockPrivateAPI : public BrowserContextKeyedAPI {
public: public:
...@@ -50,8 +47,6 @@ class EasyUnlockPrivateAPI : public BrowserContextKeyedAPI { ...@@ -50,8 +47,6 @@ class EasyUnlockPrivateAPI : public BrowserContextKeyedAPI {
explicit EasyUnlockPrivateAPI(content::BrowserContext* context); explicit EasyUnlockPrivateAPI(content::BrowserContext* context);
~EasyUnlockPrivateAPI() override; ~EasyUnlockPrivateAPI() override;
EasyUnlockPrivateCryptoDelegate* GetCryptoDelegate();
EasyUnlockPrivateConnectionManager* get_connection_manager() { EasyUnlockPrivateConnectionManager* get_connection_manager() {
return connection_manager_.get(); return connection_manager_.get();
} }
...@@ -65,8 +60,6 @@ class EasyUnlockPrivateAPI : public BrowserContextKeyedAPI { ...@@ -65,8 +60,6 @@ class EasyUnlockPrivateAPI : public BrowserContextKeyedAPI {
// KeyedService implementation. // KeyedService implementation.
void Shutdown() override; void Shutdown() override;
std::unique_ptr<EasyUnlockPrivateCryptoDelegate> crypto_delegate_;
std::unique_ptr<EasyUnlockPrivateConnectionManager> connection_manager_; std::unique_ptr<EasyUnlockPrivateConnectionManager> connection_manager_;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateAPI); DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateAPI);
...@@ -89,198 +82,6 @@ class EasyUnlockPrivateGetStringsFunction : public UIThreadExtensionFunction { ...@@ -89,198 +82,6 @@ class EasyUnlockPrivateGetStringsFunction : public UIThreadExtensionFunction {
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetStringsFunction); DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetStringsFunction);
}; };
class EasyUnlockPrivatePerformECDHKeyAgreementFunction
: public UIThreadExtensionFunction {
public:
EasyUnlockPrivatePerformECDHKeyAgreementFunction();
protected:
~EasyUnlockPrivatePerformECDHKeyAgreementFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnData(const std::string& secret_key);
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.performECDHKeyAgreement",
EASYUNLOCKPRIVATE_PERFORMECDHKEYAGREEMENT)
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivatePerformECDHKeyAgreementFunction);
};
class EasyUnlockPrivateGenerateEcP256KeyPairFunction
: public UIThreadExtensionFunction {
public:
EasyUnlockPrivateGenerateEcP256KeyPairFunction();
protected:
~EasyUnlockPrivateGenerateEcP256KeyPairFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnData(const std::string& public_key,
const std::string& private_key);
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.generateEcP256KeyPair",
EASYUNLOCKPRIVATE_GENERATEECP256KEYPAIR)
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGenerateEcP256KeyPairFunction);
};
class EasyUnlockPrivateCreateSecureMessageFunction
: public UIThreadExtensionFunction {
public:
EasyUnlockPrivateCreateSecureMessageFunction();
protected:
~EasyUnlockPrivateCreateSecureMessageFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnData(const std::string& message);
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.createSecureMessage",
EASYUNLOCKPRIVATE_CREATESECUREMESSAGE)
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateCreateSecureMessageFunction);
};
class EasyUnlockPrivateUnwrapSecureMessageFunction
: public UIThreadExtensionFunction {
public:
EasyUnlockPrivateUnwrapSecureMessageFunction();
protected:
~EasyUnlockPrivateUnwrapSecureMessageFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
private:
void OnData(const std::string& data);
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.unwrapSecureMessage",
EASYUNLOCKPRIVATE_UNWRAPSECUREMESSAGE)
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateUnwrapSecureMessageFunction);
};
class EasyUnlockPrivateGetPermitAccessFunction
: public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getPermitAccess",
EASYUNLOCKPRIVATE_GETPERMITACCESS)
EasyUnlockPrivateGetPermitAccessFunction();
protected:
~EasyUnlockPrivateGetPermitAccessFunction() override;
// Writes the user's public and private key in base64 form to the
// |user_public_key| and |user_private_key| fields. Exposed for testing.
virtual void GetKeyPairForExperiment(std::string* user_public_key,
std::string* user_private_key);
private:
// ExtensionFunction:
ResponseAction Run() override;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetPermitAccessFunction);
};
class EasyUnlockPrivateClearPermitAccessFunction
: public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.clearPermitAccess",
EASYUNLOCKPRIVATE_CLEARPERMITACCESS)
EasyUnlockPrivateClearPermitAccessFunction();
private:
~EasyUnlockPrivateClearPermitAccessFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateClearPermitAccessFunction);
};
class EasyUnlockPrivateSetRemoteDevicesFunction
: public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.setRemoteDevices",
EASYUNLOCKPRIVATE_SETREMOTEDEVICES)
EasyUnlockPrivateSetRemoteDevicesFunction();
private:
~EasyUnlockPrivateSetRemoteDevicesFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateSetRemoteDevicesFunction);
};
class EasyUnlockPrivateGetRemoteDevicesFunction
: public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getRemoteDevices",
EASYUNLOCKPRIVATE_GETREMOTEDEVICES)
EasyUnlockPrivateGetRemoteDevicesFunction();
protected:
~EasyUnlockPrivateGetRemoteDevicesFunction() override;
// Returns the user's private key used for the native experiment.
// Exposed for testing.
virtual std::string GetUserPrivateKey();
// Returns the user's unlock keys used for the native experiment.
// Exposed for testing.
virtual std::vector<cryptauth::ExternalDeviceInfo> GetUnlockKeys();
private:
// ExtensionFunction:
ResponseAction Run() override;
// Callback when the PSK of a device is derived.
void OnPSKDerivedForDevice(const cryptauth::ExternalDeviceInfo& device,
const std::string& persistent_symmetric_key);
// The permit id of the user. Used for the native experiment.
std::string permit_id_;
// The expected number of devices to return. Used for the native experiment.
size_t expected_devices_count_;
// Working list of the devices to return. Used for the native experiment.
std::unique_ptr<base::ListValue> remote_devices_;
// Used to derive devices' PSK. Used for the native experiment.
std::unique_ptr<cryptauth::SecureMessageDelegate>
secure_message_delegate_;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetRemoteDevicesFunction);
};
class EasyUnlockPrivateGetUserInfoFunction : public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getUserInfo",
EASYUNLOCKPRIVATE_GETUSERINFO)
EasyUnlockPrivateGetUserInfoFunction();
private:
~EasyUnlockPrivateGetUserInfoFunction() override;
// ExtensionFunction:
ResponseAction Run() override;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetUserInfoFunction);
};
class EasyUnlockPrivateShowErrorBubbleFunction class EasyUnlockPrivateShowErrorBubbleFunction
: public UIThreadExtensionFunction { : public UIThreadExtensionFunction {
public: public:
......
// Copyright 2014 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 CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CRYPTO_DELEGATE_H_
#define CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CRYPTO_DELEGATE_H_
#include <memory>
#include <string>
#include "base/callback.h"
#include "chrome/common/extensions/api/easy_unlock_private.h"
namespace extensions {
// Wrapper around EasyUnlock dbus client on Chrome OS. The methods read
// extension function pearameters and invoke the associated EasyUnlock dbus
// client methods. On non-Chrome OS platforms, the methods are stubbed out.
class EasyUnlockPrivateCryptoDelegate {
public:
typedef base::Callback<void(const std::string& data)> DataCallback;
typedef base::Callback<void(const std::string& public_key,
const std::string& private_key)>
KeyPairCallback;
virtual ~EasyUnlockPrivateCryptoDelegate() {}
// Creates platform specific delegate instance. Non Chrome OS implementations
// currently do nothing but invoke callbacks with empty data.
static std::unique_ptr<EasyUnlockPrivateCryptoDelegate> Create();
// See chromeos/dbus/easy_unlock_client.h for info on these methods.
virtual void GenerateEcP256KeyPair(const KeyPairCallback& callback) = 0;
virtual void PerformECDHKeyAgreement(
const api::easy_unlock_private::PerformECDHKeyAgreement::Params& params,
const DataCallback& callback) = 0;
virtual void CreateSecureMessage(
const api::easy_unlock_private::CreateSecureMessage::Params& params,
const DataCallback& callback) = 0;
virtual void UnwrapSecureMessage(
const api::easy_unlock_private::UnwrapSecureMessage::Params& params,
const DataCallback& callback) = 0;
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_CRYPTO_DELEGATE_H_
// Copyright 2014 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.
#include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate.h"
#include "base/macros.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/easy_unlock_client.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
namespace extensions {
namespace easy_unlock_private = api::easy_unlock_private;
namespace {
// Converts encryption type to a string representation used by EasyUnlock dbus
// client.
std::string EncryptionTypeToString(easy_unlock_private::EncryptionType type) {
switch (type) {
case easy_unlock_private::ENCRYPTION_TYPE_AES_256_CBC:
return easy_unlock::kEncryptionTypeAES256CBC;
default:
return easy_unlock::kEncryptionTypeNone;
}
}
// Converts signature type to a string representation used by EasyUnlock dbus
// client.
std::string SignatureTypeToString(easy_unlock_private::SignatureType type) {
switch (type) {
case easy_unlock_private::SIGNATURE_TYPE_ECDSA_P256_SHA256:
return easy_unlock::kSignatureTypeECDSAP256SHA256;
case easy_unlock_private::SIGNATURE_TYPE_HMAC_SHA256:
// Fall through to default.
default:
return easy_unlock::kSignatureTypeHMACSHA256;
}
}
// ChromeOS specific EasyUnlockPrivateCryptoDelegate implementation.
class EasyUnlockPrivateCryptoDelegateChromeOS
: public extensions::EasyUnlockPrivateCryptoDelegate {
public:
EasyUnlockPrivateCryptoDelegateChromeOS()
: dbus_client_(
chromeos::DBusThreadManager::Get()->GetEasyUnlockClient()) {
}
~EasyUnlockPrivateCryptoDelegateChromeOS() override {}
void GenerateEcP256KeyPair(const KeyPairCallback& callback) override {
dbus_client_->GenerateEcP256KeyPair(callback);
}
void PerformECDHKeyAgreement(
const easy_unlock_private::PerformECDHKeyAgreement::Params& params,
const DataCallback& callback) override {
dbus_client_->PerformECDHKeyAgreement(
std::string(params.private_key.begin(), params.private_key.end()),
std::string(params.public_key.begin(), params.public_key.end()),
callback);
}
void CreateSecureMessage(
const easy_unlock_private::CreateSecureMessage::Params& params,
const DataCallback& callback) override {
chromeos::EasyUnlockClient::CreateSecureMessageOptions options;
options.key.assign(params.key.begin(), params.key.end());
if (params.options.associated_data) {
options.associated_data.assign(params.options.associated_data->begin(),
params.options.associated_data->end());
}
if (params.options.public_metadata) {
options.public_metadata.assign(params.options.public_metadata->begin(),
params.options.public_metadata->end());
}
if (params.options.verification_key_id) {
options.verification_key_id.assign(
params.options.verification_key_id->begin(),
params.options.verification_key_id->end());
}
if (params.options.decryption_key_id) {
options.decryption_key_id.assign(
params.options.decryption_key_id->begin(),
params.options.decryption_key_id->end());
}
options.encryption_type =
EncryptionTypeToString(params.options.encrypt_type);
options.signature_type =
SignatureTypeToString(params.options.sign_type);
dbus_client_->CreateSecureMessage(
std::string(params.payload.begin(), params.payload.end()), options,
callback);
}
void UnwrapSecureMessage(
const easy_unlock_private::UnwrapSecureMessage::Params& params,
const DataCallback& callback) override {
chromeos::EasyUnlockClient::UnwrapSecureMessageOptions options;
options.key.assign(params.key.begin(), params.key.end());
if (params.options.associated_data) {
options.associated_data.assign(params.options.associated_data->begin(),
params.options.associated_data->end());
}
options.encryption_type =
EncryptionTypeToString(params.options.encrypt_type);
options.signature_type =
SignatureTypeToString(params.options.sign_type);
dbus_client_->UnwrapSecureMessage(
std::string(params.secure_message.begin(), params.secure_message.end()),
options, callback);
}
private:
chromeos::EasyUnlockClient* dbus_client_;
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateCryptoDelegateChromeOS);
};
} // namespace
// static
std::unique_ptr<EasyUnlockPrivateCryptoDelegate>
EasyUnlockPrivateCryptoDelegate::Create() {
return std::unique_ptr<EasyUnlockPrivateCryptoDelegate>(
new EasyUnlockPrivateCryptoDelegateChromeOS());
}
} // namespace extensions
// Copyright 2014 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.
#include "base/macros.h"
#include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_crypto_delegate.h"
namespace extensions {
namespace easy_unlock_private = api::easy_unlock_private;
namespace {
// Stub EasyUnlockPrivateCryptoDelegate implementation.
class EasyUnlockPrivateCryptoDelegateStub
: public extensions::EasyUnlockPrivateCryptoDelegate {
public:
EasyUnlockPrivateCryptoDelegateStub() {}
~EasyUnlockPrivateCryptoDelegateStub() override {}
void GenerateEcP256KeyPair(const KeyPairCallback& callback) override {
callback.Run("", "");
}
void PerformECDHKeyAgreement(
const easy_unlock_private::PerformECDHKeyAgreement::Params& params,
const DataCallback& callback) override {
callback.Run("");
}
void CreateSecureMessage(
const easy_unlock_private::CreateSecureMessage::Params& params,
const DataCallback& callback) override {
callback.Run("");
}
void UnwrapSecureMessage(
const easy_unlock_private::UnwrapSecureMessage::Params& params,
const DataCallback& callback) override {
callback.Run("");
}
private:
DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateCryptoDelegateStub);
};
} // namespace
// static
std::unique_ptr<EasyUnlockPrivateCryptoDelegate>
EasyUnlockPrivateCryptoDelegate::Create() {
return std::unique_ptr<EasyUnlockPrivateCryptoDelegate>(
new EasyUnlockPrivateCryptoDelegateStub());
}
} // namespace extensions
...@@ -5,127 +5,8 @@ ...@@ -5,127 +5,8 @@
// <code>chrome.easyUnlockPrivate</code> API that provides hooks to Chrome to // <code>chrome.easyUnlockPrivate</code> API that provides hooks to Chrome to
// be used by Easy Unlock component app. // be used by Easy Unlock component app.
namespace easyUnlockPrivate { namespace easyUnlockPrivate {
// Signature algorithms supported by the crypto library methods used by
// Easy Unlock.
enum SignatureType {
HMAC_SHA256,
ECDSA_P256_SHA256
};
// Encryption algorithms supported by the crypto library methods used by
// Easy Unlock.
enum EncryptionType {
AES_256_CBC
};
// Type of a permit. All lower case to match permit.PermitRecord.Type.
enum PermitType {access, license};
enum ConnectionStatus {DISCONNECTED, IN_PROGRESS, CONNECTED}; enum ConnectionStatus {DISCONNECTED, IN_PROGRESS, CONNECTED};
// Options that can be passed to |unwrapSecureMessage| method.
dictionary UnwrapSecureMessageOptions {
// The data associated with the message. For the message to be succesfully
// verified, the message should have been created with the same associated
// data.
ArrayBuffer? associatedData;
// The encryption algorithm that should be used to decrypt the message.
// Should not be set for a cleartext message.
EncryptionType? encryptType;
// The algorithm to be used to verify signature contained in the message.
// Defaults to |HMAC_SHA256|. |ECDSA_P256_SHA256| can currently be used
// only with cleartext messages.
SignatureType? signType;
};
dictionary CreateSecureMessageOptions {
// Data associated with the message. The data will not be sent with the
// message, but the message recepient will use the same data on its side
// to verify the message.
ArrayBuffer? associatedData;
// Metadata to be added to the message header.
ArrayBuffer? publicMetadata;
// Verification key id added to the message header. Should be set if the
// message is signed using |ECDSA_P256_SHA256|. Used by the message
// recepient to determine which key should be used to verify the message
// signature.
ArrayBuffer? verificationKeyId;
// Decryption key id added to the message header. Used by the message
// recepient to determine which key should be used to decrypt the message.
ArrayBuffer? decryptionKeyId;
// The encryption algorithm that should be used to encrypt the message.
// Should not be set for a cleartext message.
EncryptionType? encryptType;
// The algorithm to be used to sign the message.
// Defaults to |HMAC_SHA256|. |ECDSA_P256_SHA256| can currently be used
// only with cleartext messages.
SignatureType? signType;
};
// A permit record contains the credentials used to request or grant
// authorization of a permit.
dictionary PermitRecord {
// ID of the permit, which identifies the service/application that these
// permit records are used in.
DOMString permitId;
// An identifier for this record that should be unique among all other
// records of the same permit.
DOMString id;
// Type of the record.
PermitType type;
// Websafe base64 encoded payload data of the record.
DOMString data;
};
// Device information that can be authenticated for Easy unlock.
dictionary Device {
// The name of the device.
DOMString? name;
// The permit record of the device.
PermitRecord? permitRecord;
// Websafe base64 encoded persistent symmetric key.
DOMString? psk;
};
// The information about a user associated with Easy unlock service.
dictionary UserInfo {
// The user id.
DOMString userId;
// A stable identifier for the user and device. If a user is removed and
// added to the same device, this id will remain the same. However, this id
// will be different if another user is added to the same device or if the
// same user is added on another device.
DOMString deviceUserId;
// Whether the user is logged in. If not logged in, the app is running on
// the signin screen.
boolean loggedIn;
// Whether to require the remote device to be in very close proximity before
// allowing unlock (~1 feet).
boolean requireCloseProximity;
// Whether all data needed to use Easy unlock service has been loaded for
// the user.
boolean dataReady;
// Whether the |kEnableBluetoothLowEnergyDiscovery| switch is enabled.
boolean bleDiscoveryEnabled;
};
// A range. // A range.
dictionary Range { dictionary Range {
long start; long start;
...@@ -140,31 +21,12 @@ namespace easyUnlockPrivate { ...@@ -140,31 +21,12 @@ namespace easyUnlockPrivate {
long height; long height;
}; };
// Callback for crypto methods that return a single array buffer.
callback DataCallback = void(optional ArrayBuffer data);
// An empty callback used purely for signalling success vs. failure. // An empty callback used purely for signalling success vs. failure.
callback EmptyCallback = void(); callback EmptyCallback = void();
// Callback for the getStrings() method. // Callback for the getStrings() method.
callback GetStringsCallback = void(object strings); callback GetStringsCallback = void(object strings);
// Callback for method that generates an encryption key pair.
callback KeyPairCallback = void(optional ArrayBuffer public_key,
optional ArrayBuffer private_key);
// Callback for the getPermitAccess() method.
callback GetPermitAccessCallback = void(optional PermitRecord permitAccess);
// Callback for the getRemoteDevices() method.
callback GetRemoteDevicesCallback = void(Device[] devices);
// Callback for the |getUserInfo()| method. Note that the callback argument is
// a list for future use (on signin screen there may be more than one user
// associated with the easy unlock service). Currently the method returns at
// most one user.
callback GetUserInfoCallback = void(UserInfo[] users);
// Callback for the |FindSetupConnectionCallback| method. // Callback for the |FindSetupConnectionCallback| method.
// |connectionId|: The identifier of the connection found. To be used in // |connectionId|: The identifier of the connection found. To be used in
// future calls refering to this connection. // future calls refering to this connection.
...@@ -180,79 +42,6 @@ namespace easyUnlockPrivate { ...@@ -180,79 +42,6 @@ namespace easyUnlockPrivate {
// Perhaps this should be extracted to a common API instead? // Perhaps this should be extracted to a common API instead?
static void getStrings(GetStringsCallback callback); static void getStrings(GetStringsCallback callback);
// Generates a ECDSA key pair for P256 curve.
// Public key will be in format recognized by secure wire transport protocol
// used by Easy Unlock app. Otherwise, the exact format for both key should
// should be considered obfuscated to the app. The app should not use them
// directly, but through this API.
// |callback|: Callback with the generated keys. On failure, none of the
// keys will be set.
static void generateEcP256KeyPair(KeyPairCallback callback);
// Given a private key and a public ECDSA key from different asymetric key
// pairs, it generates a symetric encryption key using EC Diffie-Hellman
// scheme.
// |privateKey|: A private key generated by the app using
// |generateEcP256KeyPair|.
// |publicKey|: A public key that should be in the same format as the
// public key generated by |generateEcP256KeyPair|. Generally not the
// one paired with |private_key|.
// |callback|: Function returning the generated secret symetric key.
// On failure, the returned value will not be set.
static void performECDHKeyAgreement(ArrayBuffer privateKey,
ArrayBuffer publicKey,
DataCallback callback);
// Creates a secure, signed message in format used by Easy Unlock app to
// establish secure communication channel over unsecure connection.
// |payload|: The payload the create message should carry.
// |key|: The key used to sign the message content. If encryption algorithm
// is set in |options| the same key will be used to encrypt the message.
// |options|: Additional (optional) parameters used to create the message.
// |callback|: Function returning the created message bytes. On failure,
// the returned value will not be set.
static void createSecureMessage(
ArrayBuffer payload,
ArrayBuffer key,
CreateSecureMessageOptions options,
DataCallback callback);
// Authenticates and, if needed, decrypts a secure message. The message is
// in the same format as the one created by |createSecureMessage|.
// |secureMessage|: The message to be unwrapped.
// |key|: Key to be used to authenticate the message sender. If encryption
// algorithm is set in |options|, the same key will be used to decrypt
// the message.
// |options|: Additional (optional) parameters used to unwrap the message.
// |callback|: Function returning an array buffer containing cleartext
// message header and body. They are returned in a single buffer in
// format used inside the message. If the massage authentication or
// decryption fails, the returned value will not be set.
static void unwrapSecureMessage(
ArrayBuffer secureMessage,
ArrayBuffer key,
UnwrapSecureMessageOptions options,
DataCallback callback);
// Gets the permit record for the local device.
static void getPermitAccess(GetPermitAccessCallback callback);
// Clears the permit record for the local device.
static void clearPermitAccess(optional EmptyCallback callback);
// Saves the remote device list.
// |devices|: The list of remote devices to be saved.
// |callback|: Called to indicate success or failure.
static void setRemoteDevices(Device[] devices,
optional EmptyCallback callback);
// Gets the remote device list.
static void getRemoteDevices(GetRemoteDevicesCallback callback);
// Retrieves information about the user associated with the Easy unlock
// service.
static void getUserInfo(GetUserInfoCallback callback);
// Shows an error bubble with the given |message|, anchored to an edge of // Shows an error bubble with the given |message|, anchored to an edge of
// the given |anchorRect| -- typically the right edge, but possibly a // the given |anchorRect| -- typically the right edge, but possibly a
// different edge if there is not space for the bubble to the right of the // different edge if there is not space for the bubble to the right of the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment