@types/chrome 0.0.271 → 0.0.273

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +90 -23
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (http://developer.chrome.com/e
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Sat, 14 Sep 2024 10:37:02 GMT
11
+ * Last updated: Sun, 29 Sep 2024 20:36:13 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
 
14
14
  # Credits
chrome/index.d.ts CHANGED
@@ -3211,7 +3211,7 @@ declare namespace chrome.enterprise.platformKeys {
3211
3211
  export interface Token {
3212
3212
  /**
3213
3213
  * Uniquely identifies this Token.
3214
- * Static IDs are "user" and "system", referring to the platform's user-specific and the system-wide hardware token, respectively. Any other tokens (with other identifiers) might be returned by enterprise.platformKeys.getTokens.
3214
+ * Static IDs are `user` and `system`, referring to the platform's user-specific and the system-wide hardware token, respectively. Any other tokens (with other identifiers) might be returned by enterprise.platformKeys.getTokens.
3215
3215
  */
3216
3216
  id: string;
3217
3217
  /**
@@ -3240,7 +3240,7 @@ declare namespace chrome.enterprise.platformKeys {
3240
3240
  * Which Enterprise Key to challenge.
3241
3241
  * @since Chrome 110
3242
3242
  */
3243
- scope: Scope;
3243
+ scope: `${Scope}`;
3244
3244
  /**
3245
3245
  * If present, registers the challenged key with the specified scope's token.
3246
3246
  * The key can then be associated with a certificate and used like any other signing key.
@@ -3254,20 +3254,26 @@ declare namespace chrome.enterprise.platformKeys {
3254
3254
  /**
3255
3255
  * Which algorithm the registered key should use.
3256
3256
  */
3257
- algorithm: Algorithm;
3257
+ algorithm: `${Algorithm}`;
3258
3258
  }
3259
3259
 
3260
3260
  /**
3261
- * @since Chrome 110
3262
3261
  * Type of key to generate.
3262
+ * @since Chrome 110
3263
3263
  */
3264
- type Algorithm = "RSA" | "ECDSA";
3264
+ export enum Algorithm {
3265
+ ECDSA = "ECDSA",
3266
+ RSA = "RSA",
3267
+ }
3265
3268
 
3266
3269
  /**
3267
- * @since Chrome 110
3268
3270
  * Whether to use the Enterprise User Key or the Enterprise Machine Key.
3271
+ * @since Chrome 110
3269
3272
  */
3270
- type Scope = "USER" | "MACHINE";
3273
+ export enum Scope {
3274
+ USER = "USER",
3275
+ MACHINE = "MACHINE",
3276
+ }
3271
3277
 
3272
3278
  /**
3273
3279
  * Returns the available Tokens. In a regular user's session the list will always contain the user's token with id "user". If a system-wide TPM token is available, the returned list will also contain the system-wide token with id "system". The system-wide token will be the same for all sessions on this device (device in the sense of e.g. a Chromebook).
@@ -3275,6 +3281,7 @@ declare namespace chrome.enterprise.platformKeys {
3275
3281
  * Parameter tokens: The list of available tokens.
3276
3282
  */
3277
3283
  export function getTokens(callback: (tokens: Token[]) => void): void;
3284
+
3278
3285
  /**
3279
3286
  * Returns the list of all client certificates available from the given token. Can be used to check for the existence and expiration of client certificates that are usable for a certain authentication.
3280
3287
  * @param tokenId The id of a Token returned by getTokens.
@@ -3282,6 +3289,7 @@ declare namespace chrome.enterprise.platformKeys {
3282
3289
  * Parameter certificates: The list of certificates, each in DER encoding of a X.509 certificate.
3283
3290
  */
3284
3291
  export function getCertificates(tokenId: string, callback: (certificates: ArrayBuffer[]) => void): void;
3292
+
3285
3293
  /**
3286
3294
  * Imports certificate to the given token if the certified key is already stored in this token. After a successful certification request, this function should be used to store the obtained certificate and to make it available to the operating system and browser for authentication.
3287
3295
  * @param tokenId The id of a Token returned by getTokens.
@@ -3289,6 +3297,7 @@ declare namespace chrome.enterprise.platformKeys {
3289
3297
  * @param callback Called back when this operation is finished.
3290
3298
  */
3291
3299
  export function importCertificate(tokenId: string, certificate: ArrayBuffer, callback?: () => void): void;
3300
+
3292
3301
  /**
3293
3302
  * Removes certificate from the given token if present. Should be used to remove obsolete certificates so that they are not considered during authentication and do not clutter the certificate choice. Should be used to free storage in the certificate store.
3294
3303
  * @param tokenId The id of a Token returned by getTokens.
@@ -3296,6 +3305,7 @@ declare namespace chrome.enterprise.platformKeys {
3296
3305
  * @param callback Called back when this operation is finished.
3297
3306
  */
3298
3307
  export function removeCertificate(tokenId: string, certificate: ArrayBuffer, callback?: () => void): void;
3308
+
3299
3309
  /**
3300
3310
  * Challenges a hardware-backed Enterprise Machine Key and emits the response as part of a remote attestation protocol. Only useful on Chrome OS and in conjunction with the Verified Access Web API which both issues challenges and verifies responses. A successful verification by the Verified Access Web API is a strong signal of all of the following:
3301
3311
  *
@@ -3311,6 +3321,7 @@ declare namespace chrome.enterprise.platformKeys {
3311
3321
  * @since Chrome 110
3312
3322
  */
3313
3323
  export function challengeKey(options: ChallengeKeyOptions, callback: (response: ArrayBuffer) => void): void;
3324
+
3314
3325
  /**
3315
3326
  * @deprecated Deprecated since Chrome 110, use enterprise.platformKeys.challengeKey instead.
3316
3327
  *
@@ -3328,11 +3339,13 @@ declare namespace chrome.enterprise.platformKeys {
3328
3339
  * @param callback Called back with the challenge response.
3329
3340
  * @since Chrome 50
3330
3341
  */
3342
+
3331
3343
  export function challengeMachineKey(
3332
3344
  challenge: ArrayBuffer,
3333
3345
  registerKey: boolean,
3334
3346
  callback: (response: ArrayBuffer) => void,
3335
3347
  ): void;
3348
+
3336
3349
  export function challengeMachineKey(challenge: ArrayBuffer, callback: (response: ArrayBuffer) => void): void;
3337
3350
  /**
3338
3351
  * @deprecated Deprecated since Chrome 110, use enterprise.platformKeys.challengeKey instead.
@@ -3351,6 +3364,7 @@ declare namespace chrome.enterprise.platformKeys {
3351
3364
  * @param callback Called back with the challenge response.
3352
3365
  * @since Chrome 50
3353
3366
  */
3367
+
3354
3368
  export function challengeUserKey(
3355
3369
  challenge: ArrayBuffer,
3356
3370
  registerKey: boolean,
@@ -3411,6 +3425,32 @@ declare namespace chrome.enterprise.deviceAttributes {
3411
3425
  export function getDeviceHostname(callback: (hostname: string) => void): void;
3412
3426
  }
3413
3427
 
3428
+ ////////////////////
3429
+ // Enterprise Hardware Platform
3430
+ ////////////////////
3431
+ /**
3432
+ * Use the chrome.enterprise.hardwarePlatform API to get the manufacturer and model of the hardware platform where the browser runs.
3433
+ *
3434
+ * Permissions: "enterprise.hardwarePlatform"
3435
+ *
3436
+ * Note: This API is only for extensions pre-installed by policy.
3437
+ * @platform ChromeOS only
3438
+ * @since Chrome 71
3439
+ */
3440
+ declare namespace chrome.enterprise.hardwarePlatform {
3441
+ export interface HardwarePlatformInfo {
3442
+ manufacturer: string;
3443
+ model: string;
3444
+ }
3445
+
3446
+ /**
3447
+ * Obtains the manufacturer and model for the hardware platform and, if the extension is authorized, returns it via callback.
3448
+ * Can return its result via Promise in Manifest V3 or later since Chrome 96.
3449
+ */
3450
+ export function getHardwarePlatformInfo(): Promise<HardwarePlatformInfo>;
3451
+ export function getHardwarePlatformInfo(callback: (info: HardwarePlatformInfo) => void): void;
3452
+ }
3453
+
3414
3454
  ////////////////////
3415
3455
  // Enterprise Networking Attributes
3416
3456
  ////////////////////
@@ -6607,14 +6647,31 @@ declare namespace chrome.platformKeys {
6607
6647
  ////////////////////
6608
6648
  /**
6609
6649
  * Use the chrome.power API to override the system's power management features.
6610
- * Permissions: "power"
6650
+ * Permissions: "power"
6611
6651
  * @since Chrome 27
6612
6652
  */
6613
6653
  declare namespace chrome.power {
6614
- /** Requests that power management be temporarily disabled. |level| describes the degree to which power management should be disabled. If a request previously made by the same app is still active, it will be replaced by the new request. */
6615
- export function requestKeepAwake(level: string): void;
6654
+ export enum Level {
6655
+ /** Prevents the display from being turned off or dimmed, or the system from sleeping in response to user inactivity */
6656
+ DISPLAY = "display",
6657
+ /** Prevents the system from sleeping in response to user inactivity. */
6658
+ SYSTEM = "system",
6659
+ }
6660
+
6661
+ /** Requests that power management be temporarily disabled. `level` describes the degree to which power management should be disabled. If a request previously made by the same app is still active, it will be replaced by the new request. */
6662
+ export function requestKeepAwake(level: `${Level}`): void;
6663
+
6616
6664
  /** Releases a request previously made via requestKeepAwake(). */
6617
6665
  export function releaseKeepAwake(): void;
6666
+
6667
+ /**
6668
+ * Reports a user activity in order to awake the screen from a dimmed or turned off state or from a screensaver. Exits the screensaver if it is currently active.
6669
+ * Can return its result via Promise in Manifest V3 or later.
6670
+ * @platform ChromeOS only
6671
+ * @since Chrome 113
6672
+ */
6673
+ export function reportActivity(): Promise<void>;
6674
+ export function reportActivity(callback: () => void): void;
6618
6675
  }
6619
6676
 
6620
6677
  ////////////////////
@@ -8357,6 +8414,11 @@ declare namespace chrome.sessions {
8357
8414
  * @since Chrome 20
8358
8415
  */
8359
8416
  declare namespace chrome.storage {
8417
+ /** NoInfer for old TypeScript versions */
8418
+ type NoInferX<T> = T[][T extends any ? 0 : never];
8419
+ // The next line prevents things without the export keyword from being automatically exported (like NoInferX)
8420
+ export {};
8421
+
8360
8422
  export interface StorageArea {
8361
8423
  /**
8362
8424
  * Gets the amount of space (in bytes) being used by one or more items.
@@ -8370,14 +8432,17 @@ declare namespace chrome.storage {
8370
8432
  * @return A Promise that resolves with a number
8371
8433
  * @since MV3
8372
8434
  */
8373
- getBytesInUse(keys?: string | string[] | null): Promise<number>;
8435
+ getBytesInUse<T = { [key: string]: any }>(keys?: keyof T | Array<keyof T> | null): Promise<number>;
8374
8436
  /**
8375
8437
  * Gets the amount of space (in bytes) being used by one or more items.
8376
8438
  * @param keys Optional. A single key or list of keys to get the total usage for. An empty list will return 0. Pass in null to get the total usage of all of storage.
8377
8439
  * @param callback Callback with the amount of space being used by storage, or on failure (in which case runtime.lastError will be set).
8378
8440
  * Parameter bytesInUse: Amount of space being used in storage, in bytes.
8379
8441
  */
8380
- getBytesInUse(keys: string | string[] | null, callback: (bytesInUse: number) => void): void;
8442
+ getBytesInUse<T = { [key: string]: any }>(
8443
+ keys: keyof T | Array<keyof T> | null,
8444
+ callback: (bytesInUse: number) => void,
8445
+ ): void;
8381
8446
  /**
8382
8447
  * Removes all items from storage.
8383
8448
  * @return A void Promise
@@ -8397,7 +8462,7 @@ declare namespace chrome.storage {
8397
8462
  * @return A void Promise
8398
8463
  * @since MV3
8399
8464
  */
8400
- set(items: { [key: string]: any }): Promise<void>;
8465
+ set<T = { [key: string]: any }>(items: Partial<T>): Promise<void>;
8401
8466
  /**
8402
8467
  * Sets multiple items.
8403
8468
  * @param items An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected.
@@ -8405,7 +8470,7 @@ declare namespace chrome.storage {
8405
8470
  * @param callback Optional.
8406
8471
  * Callback on success, or on failure (in which case runtime.lastError will be set).
8407
8472
  */
8408
- set(items: { [key: string]: any }, callback: () => void): void;
8473
+ set<T = { [key: string]: any }>(items: Partial<T>, callback: () => void): void;
8409
8474
  /**
8410
8475
  * Removes one or more items from storage.
8411
8476
  * @param keys A single key or a list of keys for items to remove.
@@ -8413,20 +8478,20 @@ declare namespace chrome.storage {
8413
8478
  * @return A void Promise
8414
8479
  * @since MV3
8415
8480
  */
8416
- remove(keys: string | string[]): Promise<void>;
8481
+ remove<T = { [key: string]: any }>(keys: keyof T | Array<keyof T>): Promise<void>;
8417
8482
  /**
8418
8483
  * Removes one or more items from storage.
8419
8484
  * @param keys A single key or a list of keys for items to remove.
8420
8485
  * @param callback Optional.
8421
8486
  * Callback on success, or on failure (in which case runtime.lastError will be set).
8422
8487
  */
8423
- remove(keys: string | string[], callback: () => void): void;
8488
+ remove<T = { [key: string]: any }>(keys: keyof T | Array<keyof T>, callback: () => void): void;
8424
8489
  /**
8425
8490
  * Gets the entire contents of storage.
8426
8491
  * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
8427
8492
  * Parameter items: Object with items in their key-value mappings.
8428
8493
  */
8429
- get(callback: (items: { [key: string]: any }) => void): void;
8494
+ get<T = { [key: string]: any }>(callback: (items: T) => void): void;
8430
8495
  /**
8431
8496
  * Gets one or more items from storage.
8432
8497
  * @param keys A single key to get, list of keys to get, or a dictionary specifying default values.
@@ -8434,7 +8499,9 @@ declare namespace chrome.storage {
8434
8499
  * @return A Promise that resolves with an object containing items
8435
8500
  * @since MV3
8436
8501
  */
8437
- get(keys?: string | string[] | { [key: string]: any } | null): Promise<{ [key: string]: any }>;
8502
+ get<T = { [key: string]: any }>(
8503
+ keys?: NoInferX<keyof T> | Array<NoInferX<keyof T>> | Partial<NoInferX<T>> | null,
8504
+ ): Promise<T>;
8438
8505
  /**
8439
8506
  * Gets one or more items from storage.
8440
8507
  * @param keys A single key to get, list of keys to get, or a dictionary specifying default values.
@@ -8442,9 +8509,9 @@ declare namespace chrome.storage {
8442
8509
  * @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
8443
8510
  * Parameter items: Object with items in their key-value mappings.
8444
8511
  */
8445
- get(
8446
- keys: string | string[] | { [key: string]: any } | null,
8447
- callback: (items: { [key: string]: any }) => void,
8512
+ get<T = { [key: string]: any }>(
8513
+ keys: NoInferX<keyof T> | Array<NoInferX<keyof T>> | Partial<NoInferX<T>> | null,
8514
+ callback: (items: T) => void,
8448
8515
  ): void;
8449
8516
  /**
8450
8517
  * Sets the desired access level for the storage area. The default will be only trusted contexts.
@@ -8513,12 +8580,12 @@ declare namespace chrome.storage {
8513
8580
  extends chrome.events.Event<(changes: { [key: string]: StorageChange }) => void>
8514
8581
  {}
8515
8582
 
8516
- type AreaName = keyof Pick<typeof chrome.storage, "sync" | "local" | "managed" | "session">;
8583
+ export type AreaName = keyof Pick<typeof chrome.storage, "sync" | "local" | "managed" | "session">;
8517
8584
  export interface StorageChangedEvent
8518
8585
  extends chrome.events.Event<(changes: { [key: string]: StorageChange }, areaName: AreaName) => void>
8519
8586
  {}
8520
8587
 
8521
- type AccessLevel = keyof typeof AccessLevel;
8588
+ export type AccessLevel = keyof typeof AccessLevel;
8522
8589
 
8523
8590
  /** The storage area's access level. */
8524
8591
  export var AccessLevel: {
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.271",
3
+ "version": "0.0.273",
4
4
  "description": "TypeScript definitions for chrome",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -93,6 +93,6 @@
93
93
  "@types/filesystem": "*",
94
94
  "@types/har-format": "*"
95
95
  },
96
- "typesPublisherContentHash": "2d78bd0f0e42e12eb3a7a794724c743148b1befe10cc038d78381a0fdf1f7998",
96
+ "typesPublisherContentHash": "2a75c93252a186c037a6da9faff445b85ad221b8e56562fb415f9e440ff51096",
97
97
  "typeScriptVersion": "4.8"
98
98
  }