From e8c8f288bc232b455d60bb85220d01ba5d6bf47c Mon Sep 17 00:00:00 2001 From: Nikolai Ommundsen Date: Thu, 23 Aug 2018 14:09:05 +0200 Subject: [PATCH] chrome.enterprise tests --- types/chrome-apps/test/index.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/types/chrome-apps/test/index.ts b/types/chrome-apps/test/index.ts index 6537914a5e..5fde0c2e36 100644 --- a/types/chrome-apps/test/index.ts +++ b/types/chrome-apps/test/index.ts @@ -703,6 +703,14 @@ if (deviceAttr.getDirectoryDeviceId && deviceAttr.getDeviceAssetId) { } } +chrome.enterprise.deviceAttributes.getDirectoryDeviceId((deviceId) => { + return deviceId.substring(0, deviceId.length - 1); +}) +chrome.enterprise.deviceAttributes.getDeviceSerialNumber((sn) => console.log(sn.trim())); +chrome.enterprise.deviceAttributes.getDeviceAssetId((assetId) => console.log(assetId.toLowerCase())); +chrome.enterprise.deviceAttributes.getDeviceAnnotatedLocation((loc) => loc.charAt(0)); + + // ENTERPRISE - PLATFORM KEYS if (chrome.enterprise.platformKeys.getTokens) { @@ -712,6 +720,31 @@ if (chrome.enterprise.platformKeys.getTokens) { } } } +const tokenId = 'tokenid....'; +chrome.enterprise.platformKeys.importCertificate(tokenId, new ArrayBuffer(8), () => { }); +chrome.enterprise.platformKeys.getCertificates(tokenId, (certificates) => { + certificates.map((cert) => { + chrome.enterprise.platformKeys.removeCertificate(tokenId, cert, () => { }); + }); +}); +chrome.enterprise.platformKeys.getTokens((tokens) => { + const algorithm = { + name: "RSASSA-PKCS1-v1_5", + // RsaHashedKeyGenParams + modulusLength: 2048, + publicExponent: + new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537 + hash: { + name: "SHA-1", + } + }; + tokens.map(token => { + token.subtleCrypto.generateKey(algorithm, false, ["sign"]).then((val) => { + + }) + }); +}); + // #endregion chrome.enterprise // #region chrome.Event