Index: chrome/common/extensions/api/easy_unlock_private.idl |
diff --git a/chrome/common/extensions/api/easy_unlock_private.idl b/chrome/common/extensions/api/easy_unlock_private.idl |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ba152d5876e57dd8acdba5dc8aa72c1b67d44095 |
--- /dev/null |
+++ b/chrome/common/extensions/api/easy_unlock_private.idl |
@@ -0,0 +1,80 @@ |
+// 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. |
+ |
+// <code>chrome.easyUnlockPrivate</code> API that provides hooks to Chrome to |
+// be used by Easy Unlock component app. |
+[nodoc] namespace easyUnlockPrivate { |
+ // Callback for crypto methods that return a single array buffer. |
+ callback DataCallback = void(optional ArrayBuffer data); |
+ |
+ // Callback for method that generates an encryption key pair. |
+ callback KeyPairCallback = void(optional ArrayBuffer public_key, |
+ optional ArrayBuffer private_key); |
+ |
+ interface Functions { |
+ // 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. |
+ // |secretKey|: The symetric key used to sign and, if needed, encrypt the |
+ // message content. |
+ // |associatedData|: 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. |
+ // |publicMetadata|: Metadata to be added to the message header. |
+ // |encrypt|: Whether the message should be encrypted. If set |secretKey| |
+ // will be used for encryption. |
+ // |callback|: Function returning the created message bytes. On failure, |
+ // the returned value will not be set. |
+ static void createSecureMessage( |
+ ArrayBuffer payload, |
+ ArrayBuffer secretKey, |
+ ArrayBuffer associatedData, |
+ ArrayBuffer publicMetadata, |
+ boolean encrypt, |
+ 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. |
+ // |secretKey|: Symetric key to be used to authenticate the message sender |
+ // and decrypt the message (if needed). |
+ // |associatedData|: The data associated with the message. For the message |
+ // to be succesfully verified, the message should have been created with |
+ // the same associated data. |
+ // |encrypted|: Whether the message is encrypted. |
+ // |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 secretKey, |
+ ArrayBuffer associatedData, |
+ boolean encrypted, |
+ DataCallback callback); |
+ }; |
+}; |