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

Unified Diff: chrome/renderer/resources/extensions/enterprise_platform_keys_custom_bindings.js

Issue 214863002: Extension API enterprise.platformKeys. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Splitted custom_binding, added comments... Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/extensions/enterprise_platform_keys_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/enterprise_platform_keys_custom_bindings.js b/chrome/renderer/resources/extensions/enterprise_platform_keys_custom_bindings.js
new file mode 100644
index 0000000000000000000000000000000000000000..c4339e7ca3f722a3f94bd49c79523dbe9ed2f0e5
--- /dev/null
+++ b/chrome/renderer/resources/extensions/enterprise_platform_keys_custom_bindings.js
@@ -0,0 +1,32 @@
+// 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.
+
+// Custom binding for the enterprise.platformKeys API.
+
+// The platformKeys API consists of two major parts:
+// - the certificate management.
+// - the key generation and crypto operations and
+// The former is implemented without custom binding as static functions.
+// The latter is exposed by implementing WebCrypto's SubtleCrypto interface.
+// The internal API provides the key and crypto operations through static
+// functions expecting token IDs and this custom binding adds the SubtleCrypto
+// wrapper.
+// The Token object holds the token id and the SubtleCrypto member.
+
+var binding = require('binding').Binding.create('enterprise.platformKeys');
+var Token = require('enterprise.platformKeys.Token').Token;
+var internalAPI = require('enterprise.platformKeysInternal').binding;
+
+binding.registerCustomHook(function(api) {
+ var apiFunctions = api.apiFunctions;
+
+ var ret = apiFunctions.setHandleRequest('getTokens', function(callback) {
+ internalAPI.getTokens(function(tokenIds) {
+ callback($Array.map(tokenIds,
+ function(tokenId) { return new Token(tokenId); }));
+ });
+ });
+});
+
+exports.binding = binding.generate();

Powered by Google App Engine
This is Rietveld 408576698