OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // <code>chrome.easyUnlockPrivate</code> API that provides hooks to Chrome to | 5 // <code>chrome.easyUnlockPrivate</code> API that provides hooks to Chrome to |
6 // be used by Easy Unlock component app. | 6 // be used by Easy Unlock component app. |
7 [nodoc] namespace easyUnlockPrivate { | 7 [nodoc] namespace easyUnlockPrivate { |
8 // Signature algorithms supported by the crypto library methods used by | 8 // Signature algorithms supported by the crypto library methods used by |
9 // Easy Unlock. | 9 // Easy Unlock. |
10 enum SignatureType { | 10 enum SignatureType { |
11 HMAC_SHA256, | 11 HMAC_SHA256, |
12 ECDSA_P256_SHA256 | 12 ECDSA_P256_SHA256 |
13 }; | 13 }; |
14 | 14 |
15 // Encryption algorithms supported by the crypto library methods used by | 15 // Encryption algorithms supported by the crypto library methods used by |
16 // Easy Unlock. | 16 // Easy Unlock. |
17 enum EncryptionType { | 17 enum EncryptionType { |
18 AES_256_CBC | 18 AES_256_CBC |
19 }; | 19 }; |
20 | 20 |
21 // Type of a permit. | |
22 enum PermitType {access, license}; | |
tbarzic
2014/08/14 17:43:23
other enums are in all caps
xiyuan
2014/08/14 22:09:19
This has to match the enum defined in permit.Permi
| |
23 | |
21 // Options that can be passed to |unwrapSecureMessage| method. | 24 // Options that can be passed to |unwrapSecureMessage| method. |
22 dictionary UnwrapSecureMessageOptions { | 25 dictionary UnwrapSecureMessageOptions { |
23 // The data associated with the message. For the message to be succesfully | 26 // The data associated with the message. For the message to be succesfully |
24 // verified, the message should have been created with the same associated | 27 // verified, the message should have been created with the same associated |
25 // data. | 28 // data. |
26 ArrayBuffer? associatedData; | 29 ArrayBuffer? associatedData; |
27 | 30 |
28 // The encryption algorithm that should be used to decrypt the message. | 31 // The encryption algorithm that should be used to decrypt the message. |
29 // Should not be set for a cleartext message. | 32 // Should not be set for a cleartext message. |
30 EncryptionType? encryptType; | 33 EncryptionType? encryptType; |
(...skipping 22 matching lines...) Expand all Loading... | |
53 // The encryption algorithm that should be used to encrypt the message. | 56 // The encryption algorithm that should be used to encrypt the message. |
54 // Should not be set for a cleartext message. | 57 // Should not be set for a cleartext message. |
55 EncryptionType? encryptType; | 58 EncryptionType? encryptType; |
56 | 59 |
57 // The algorithm to be used to sign the message. | 60 // The algorithm to be used to sign the message. |
58 // Defaults to |HMAC_SHA256|. |ECDSA_P256_SHA256| can currently be used | 61 // Defaults to |HMAC_SHA256|. |ECDSA_P256_SHA256| can currently be used |
59 // only with cleartext messages. | 62 // only with cleartext messages. |
60 SignatureType? signType; | 63 SignatureType? signType; |
61 }; | 64 }; |
62 | 65 |
66 // A permit record contains the credentials used to request or grant | |
67 // authorization of a permit. | |
68 dictionary PermitRecord { | |
69 // The id of the permit record. | |
70 DOMString permitId; | |
71 | |
72 // An identifier for this record that should be unique among all other | |
73 // records of the same permit. | |
74 DOMString id; | |
75 | |
76 // Type of the record. | |
77 PermitType type; | |
78 | |
79 // Base64 encoded payload data of the record. | |
80 DOMString data; | |
81 }; | |
82 | |
83 // Device information that can be authenticated for Easy unlock. | |
84 dictionary Device { | |
85 // The Bluetooth address of the device. | |
86 DOMString bluetoothAddress; | |
87 | |
88 // The name of the device. | |
89 DOMString? name; | |
90 | |
91 // The permit record of the device. | |
92 PermitRecord? permitRecord; | |
93 | |
94 // Base64 encoded persistent symmetric key. | |
95 DOMString? psk; | |
96 }; | |
97 | |
63 // Callback for crypto methods that return a single array buffer. | 98 // Callback for crypto methods that return a single array buffer. |
64 callback DataCallback = void(optional ArrayBuffer data); | 99 callback DataCallback = void(optional ArrayBuffer data); |
65 | 100 |
66 // An empty callback used purely for signalling success vs. failure. | 101 // An empty callback used purely for signalling success vs. failure. |
67 callback EmptyCallback = void(); | 102 callback EmptyCallback = void(); |
68 | 103 |
69 // Callback for the getStrings() method. | 104 // Callback for the getStrings() method. |
70 callback GetStringsCallback = void(object strings); | 105 callback GetStringsCallback = void(object strings); |
71 | 106 |
72 // Callback for method that generates an encryption key pair. | 107 // Callback for method that generates an encryption key pair. |
73 callback KeyPairCallback = void(optional ArrayBuffer public_key, | 108 callback KeyPairCallback = void(optional ArrayBuffer public_key, |
74 optional ArrayBuffer private_key); | 109 optional ArrayBuffer private_key); |
75 | 110 |
111 // Callback for the getPermitAccess() method. | |
112 callback GetPermitAccessCallback = void(optional PermitRecord permitAccess); | |
113 | |
114 // Callback for the getRemoteDevices() method. | |
115 callback GetRemoteDevicesCallback = void(Device[] devices); | |
116 | |
76 interface Functions { | 117 interface Functions { |
77 // Gets localized strings required to render the API. | 118 // Gets localized strings required to render the API. |
78 // | 119 // |
79 // |callback| : Called with a dictionary mapping names to resource strings. | 120 // |callback| : Called with a dictionary mapping names to resource strings. |
80 // TODO(isherman): This is essentially copied from identity_private.idl. | 121 // TODO(isherman): This is essentially copied from identity_private.idl. |
81 // Perhaps this should be extracted to a common API instead? | 122 // Perhaps this should be extracted to a common API instead? |
82 static void getStrings(GetStringsCallback callback); | 123 static void getStrings(GetStringsCallback callback); |
83 | 124 |
84 // Generates a ECDSA key pair for P256 curve. | 125 // Generates a ECDSA key pair for P256 curve. |
85 // Public key will be in format recognized by secure wire transport protocol | 126 // Public key will be in format recognized by secure wire transport protocol |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 // Connects to the SDP service on a device, given just the device's | 179 // Connects to the SDP service on a device, given just the device's |
139 // Bluetooth address. This function is useful as a faster alternative to | 180 // Bluetooth address. This function is useful as a faster alternative to |
140 // Bluetooth discovery, when you already know the remote device's Bluetooth | 181 // Bluetooth discovery, when you already know the remote device's Bluetooth |
141 // address. A successful call to this function has the side-effect of | 182 // address. A successful call to this function has the side-effect of |
142 // registering the device with the Bluetooth daemon, making it available for | 183 // registering the device with the Bluetooth daemon, making it available for |
143 // future outgoing connections. | 184 // future outgoing connections. |
144 // |deviceAddress|: The Bluetooth address of the device to connect to. | 185 // |deviceAddress|: The Bluetooth address of the device to connect to. |
145 // |callback|: Called to indicate success or failure. | 186 // |callback|: Called to indicate success or failure. |
146 static void seekBluetoothDeviceByAddress(DOMString deviceAddress, | 187 static void seekBluetoothDeviceByAddress(DOMString deviceAddress, |
147 optional EmptyCallback callback); | 188 optional EmptyCallback callback); |
189 | |
190 // Saves the permit record for the local device. | |
191 // |permitAccess|: The permit record to be saved. | |
192 // |callback|: Called to indicate success or failure. | |
193 static void setPermitAccess(PermitRecord permitAccess, | |
194 optional EmptyCallback callback); | |
195 | |
196 // Gets the permit record for the local device. | |
197 static void getPermitAccess(GetPermitAccessCallback callback); | |
198 | |
199 // Clears the permit record for the local device. | |
200 static void clearPermitAccess(optional EmptyCallback callback); | |
201 | |
202 // Saves the remote device list. | |
203 // |devices|: The list of remote devices to be saved. | |
204 // |callback|: Called to indicate success or failure. | |
205 static void setRemoteDevices(Device[] devices, | |
206 optional EmptyCallback callback); | |
207 | |
208 // Gets the remote device list. | |
209 static void getRemoteDevices(GetRemoteDevicesCallback callback); | |
210 }; | |
211 | |
212 interface Events { | |
213 // Fired when a turn-off flow has finished successfully. | |
214 static void onTurnOffFlowFinished(); | |
148 }; | 215 }; |
149 }; | 216 }; |
OLD | NEW |