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 { |
(...skipping 26 matching lines...) Expand all Loading... |
37 // A phone eligible to unlock the device is detected, but it is not allowed | 37 // A phone eligible to unlock the device is detected, but it is not allowed |
38 // to unlock the device because it doesn't have lock screen enabled. | 38 // to unlock the device because it doesn't have lock screen enabled. |
39 PHONE_UNLOCKABLE, | 39 PHONE_UNLOCKABLE, |
40 // A phone eligible to unlock the device is detected, but it's not close | 40 // A phone eligible to unlock the device is detected, but it's not close |
41 // enough to be allowed to unlock the device. | 41 // enough to be allowed to unlock the device. |
42 PHONE_NOT_NEARBY, | 42 PHONE_NOT_NEARBY, |
43 // The devie can be unlocked using Easy Unlock. | 43 // The devie can be unlocked using Easy Unlock. |
44 AUTHENTICATED | 44 AUTHENTICATED |
45 }; | 45 }; |
46 | 46 |
| 47 // Type of a permit. All lower case to match permit.PermitRecord.Type. |
| 48 enum PermitType {access, license}; |
| 49 |
47 // Options that can be passed to |unwrapSecureMessage| method. | 50 // Options that can be passed to |unwrapSecureMessage| method. |
48 dictionary UnwrapSecureMessageOptions { | 51 dictionary UnwrapSecureMessageOptions { |
49 // The data associated with the message. For the message to be succesfully | 52 // The data associated with the message. For the message to be succesfully |
50 // verified, the message should have been created with the same associated | 53 // verified, the message should have been created with the same associated |
51 // data. | 54 // data. |
52 ArrayBuffer? associatedData; | 55 ArrayBuffer? associatedData; |
53 | 56 |
54 // The encryption algorithm that should be used to decrypt the message. | 57 // The encryption algorithm that should be used to decrypt the message. |
55 // Should not be set for a cleartext message. | 58 // Should not be set for a cleartext message. |
56 EncryptionType? encryptType; | 59 EncryptionType? encryptType; |
(...skipping 22 matching lines...) Expand all Loading... |
79 // The encryption algorithm that should be used to encrypt the message. | 82 // The encryption algorithm that should be used to encrypt the message. |
80 // Should not be set for a cleartext message. | 83 // Should not be set for a cleartext message. |
81 EncryptionType? encryptType; | 84 EncryptionType? encryptType; |
82 | 85 |
83 // The algorithm to be used to sign the message. | 86 // The algorithm to be used to sign the message. |
84 // Defaults to |HMAC_SHA256|. |ECDSA_P256_SHA256| can currently be used | 87 // Defaults to |HMAC_SHA256|. |ECDSA_P256_SHA256| can currently be used |
85 // only with cleartext messages. | 88 // only with cleartext messages. |
86 SignatureType? signType; | 89 SignatureType? signType; |
87 }; | 90 }; |
88 | 91 |
| 92 // A permit record contains the credentials used to request or grant |
| 93 // authorization of a permit. |
| 94 dictionary PermitRecord { |
| 95 // ID of the permit, which identifies the service/application that these |
| 96 // permit records are used in. |
| 97 DOMString permitId; |
| 98 |
| 99 // An identifier for this record that should be unique among all other |
| 100 // records of the same permit. |
| 101 DOMString id; |
| 102 |
| 103 // Type of the record. |
| 104 PermitType type; |
| 105 |
| 106 // Websafe base64 encoded payload data of the record. |
| 107 DOMString data; |
| 108 }; |
| 109 |
| 110 // Device information that can be authenticated for Easy unlock. |
| 111 dictionary Device { |
| 112 // The Bluetooth address of the device. |
| 113 DOMString bluetoothAddress; |
| 114 |
| 115 // The name of the device. |
| 116 DOMString? name; |
| 117 |
| 118 // The permit record of the device. |
| 119 PermitRecord? permitRecord; |
| 120 |
| 121 // Websafe base64 encoded persistent symmetric key. |
| 122 DOMString? psk; |
| 123 }; |
| 124 |
89 // Callback for crypto methods that return a single array buffer. | 125 // Callback for crypto methods that return a single array buffer. |
90 callback DataCallback = void(optional ArrayBuffer data); | 126 callback DataCallback = void(optional ArrayBuffer data); |
91 | 127 |
92 // An empty callback used purely for signalling success vs. failure. | 128 // An empty callback used purely for signalling success vs. failure. |
93 callback EmptyCallback = void(); | 129 callback EmptyCallback = void(); |
94 | 130 |
95 // Callback for the getStrings() method. | 131 // Callback for the getStrings() method. |
96 callback GetStringsCallback = void(object strings); | 132 callback GetStringsCallback = void(object strings); |
97 | 133 |
98 // Callback for method that generates an encryption key pair. | 134 // Callback for method that generates an encryption key pair. |
99 callback KeyPairCallback = void(optional ArrayBuffer public_key, | 135 callback KeyPairCallback = void(optional ArrayBuffer public_key, |
100 optional ArrayBuffer private_key); | 136 optional ArrayBuffer private_key); |
101 | 137 |
| 138 // Callback for the getPermitAccess() method. |
| 139 callback GetPermitAccessCallback = void(optional PermitRecord permitAccess); |
| 140 |
| 141 // Callback for the getRemoteDevices() method. |
| 142 callback GetRemoteDevicesCallback = void(Device[] devices); |
| 143 |
102 interface Functions { | 144 interface Functions { |
103 // Gets localized strings required to render the API. | 145 // Gets localized strings required to render the API. |
104 // | 146 // |
105 // |callback| : Called with a dictionary mapping names to resource strings. | 147 // |callback| : Called with a dictionary mapping names to resource strings. |
106 // TODO(isherman): This is essentially copied from identity_private.idl. | 148 // TODO(isherman): This is essentially copied from identity_private.idl. |
107 // Perhaps this should be extracted to a common API instead? | 149 // Perhaps this should be extracted to a common API instead? |
108 static void getStrings(GetStringsCallback callback); | 150 static void getStrings(GetStringsCallback callback); |
109 | 151 |
110 // Generates a ECDSA key pair for P256 curve. | 152 // Generates a ECDSA key pair for P256 curve. |
111 // Public key will be in format recognized by secure wire transport protocol | 153 // Public key will be in format recognized by secure wire transport protocol |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 // registering the device with the Bluetooth daemon, making it available for | 210 // registering the device with the Bluetooth daemon, making it available for |
169 // future outgoing connections. | 211 // future outgoing connections. |
170 // |deviceAddress|: The Bluetooth address of the device to connect to. | 212 // |deviceAddress|: The Bluetooth address of the device to connect to. |
171 // |callback|: Called to indicate success or failure. | 213 // |callback|: Called to indicate success or failure. |
172 static void seekBluetoothDeviceByAddress(DOMString deviceAddress, | 214 static void seekBluetoothDeviceByAddress(DOMString deviceAddress, |
173 optional EmptyCallback callback); | 215 optional EmptyCallback callback); |
174 | 216 |
175 // Updates the screenlock state to reflect the Easy Unlock app state. | 217 // Updates the screenlock state to reflect the Easy Unlock app state. |
176 static void updateScreenlockState(State state, | 218 static void updateScreenlockState(State state, |
177 optional EmptyCallback callback); | 219 optional EmptyCallback callback); |
| 220 |
| 221 // Saves the permit record for the local device. |
| 222 // |permitAccess|: The permit record to be saved. |
| 223 // |callback|: Called to indicate success or failure. |
| 224 static void setPermitAccess(PermitRecord permitAccess, |
| 225 optional EmptyCallback callback); |
| 226 |
| 227 // Gets the permit record for the local device. |
| 228 static void getPermitAccess(GetPermitAccessCallback callback); |
| 229 |
| 230 // Clears the permit record for the local device. |
| 231 static void clearPermitAccess(optional EmptyCallback callback); |
| 232 |
| 233 // Saves the remote device list. |
| 234 // |devices|: The list of remote devices to be saved. |
| 235 // |callback|: Called to indicate success or failure. |
| 236 static void setRemoteDevices(Device[] devices, |
| 237 optional EmptyCallback callback); |
| 238 |
| 239 // Gets the remote device list. |
| 240 static void getRemoteDevices(GetRemoteDevicesCallback callback); |
178 }; | 241 }; |
179 }; | 242 }; |
OLD | NEW |