From 2485c414a1db9f5928539a8b7c1a70db7d279b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Petri=C8=99or?= Date: Tue, 7 Jul 2020 19:52:14 +0200 Subject: [PATCH] [chrome] Add chrome.enterprise.networkingAttributes and update chrome.platformKeys (#45683) * Update chrome.enterprise.networkingAttributes and chrome.platformKeys * Add since Chrome 85 comment Co-authored-by: pokutuna * Add API works only on Chrome OS comment Co-authored-by: pokutuna Co-authored-by: pokutuna --- types/chrome/index.d.ts | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index ce804aa81f..d8fe278112 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -2588,6 +2588,33 @@ declare namespace chrome.enterprise.deviceAttributes { export function getDeviceAnnotatedLocation(callback: (annotatedLocation: string) => void): void; } +//////////////////// +// Enterprise Networking Attributes +//////////////////// +/** + * Use the chrome.enterprise.networkingAttributes API to read information about your current network. Note: This API is only available to extensions force-installed by enterprise policy. + * Important: This API works only on Chrome OS. + * @since Chrome 85. + */ +declare namespace chrome.enterprise.networkingAttributes { + export interface NetworkDetails { + /** The device's MAC address. */ + macAddress: string; + /** Optional. The device's local IPv4 address (undefined if not configured). */ + ipv4?: string; + /** Optional. The device's local IPv6 address (undefined if not configured). */ + ipv6?: string; + } + + /** + * Retrieves the network details of the device's default network. If the user is not affiliated or the device is not connected to a network, runtime.lastError will be set with a failure reason. + * @param callback Called with the device's default network's NetworkDetails. + * The callback parameter should be a function that looks like this: + * function(NetworkDetails networkAddresses) {...}; + */ + export function getNetworkDetails(callback: (networkDetails: NetworkDetails) => void): void; +} + //////////////////// // Events //////////////////// @@ -5080,6 +5107,18 @@ declare namespace chrome.platformKeys { * Optional parameter privateKey: Might be null if this extension does not have access to it. */ export function getKeyPair(certificate: ArrayBuffer, parameters: Object, callback: (publicKey: CryptoKey, privateKey: CryptoKey | null) => void): void; + /** + * Passes the key pair of publicKeySpkiDer for usage with platformKeys.subtleCrypto to callback. + * @param publicKeySpkiDer A DER-encoded X.509 SubjectPublicKeyInfo, obtained e.g. by calling WebCrypto's exportKey function with format="spki". + * @param parameters Provides signature and hash algorithm parameters, in addition to those fixed by the key itself. The same parameters are accepted as by WebCrypto's importKey function, e.g. RsaHashedImportParams for a RSASSA-PKCS1-v1_5 key. For RSASSA-PKCS1-v1_5 keys, we need to also pass a "hash" parameter { "hash": { "name": string } }. The "hash" parameter represents the name of the hashing algorithm to be used in the digest operation before a sign. It is possible to pass "none" as the hash name, in which case the sign function will apply PKCS#1 v1.5 padding and but not hash the given data. + * Currently, this function only supports the "RSASSA-PKCS1-v1_5" algorithm with one of the hashing algorithms "none", "SHA-1", "SHA-256", "SHA-384", and "SHA-512". + * @param callback The public and private CryptoKey of a certificate which can only be used with platformKeys.subtleCrypto. + * The callback parameter should be a function that looks like this: + * function(object publicKey, object privateKey) {...}; + * Optional parameter privateKey: Might be null if this extension does not have access to it. + * @since Chrome 85. + */ + export function getKeyPairBySpki(publicKeySpkiDer: ArrayBuffer, parameters: Object, callback: (publicKey: CryptoKey, privateKey: CryptoKey | null) => void): void; /** An implementation of WebCrypto's SubtleCrypto that allows crypto operations on keys of client certificates that are available to this extension. */ export function subtleCrypto(): SubtleCrypto; /**