@wxt-dev/browser 0.0.326 → 0.0.328

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/gen/index.d.ts +48 -31
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wxt-dev/browser",
3
3
  "description": "Provides a cross-browser API for using extension APIs and types based on @types/chrome",
4
- "version": "0.0.326",
4
+ "version": "0.0.328",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
7
7
  "types": "src/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "src"
20
20
  ],
21
21
  "devDependencies": {
22
- "@types/chrome": "0.0.326",
22
+ "@types/chrome": "0.0.328",
23
23
  "fs-extra": "^11.3.0",
24
24
  "nano-spawn": "^0.2.0",
25
25
  "tsx": "4.19.4",
@@ -6941,6 +6941,11 @@ export namespace Browser {
6941
6941
  installType: string;
6942
6942
  /** The version of this extension, app, or theme. */
6943
6943
  version: string;
6944
+ /**
6945
+ * The version name of this extension, app, or theme if the manifest specified one.
6946
+ * @since Chrome 50
6947
+ */
6948
+ versionName?: string;
6944
6949
  /** The extension's unique identifier. */
6945
6950
  id: string;
6946
6951
  /**
@@ -7810,73 +7815,80 @@ export namespace Browser {
7810
7815
  export interface Match {
7811
7816
  /** The DER encoding of a X.509 certificate. */
7812
7817
  certificate: ArrayBuffer;
7813
- /** The KeyAlgorithm of the certified key. This contains algorithm parameters that are inherent to the key of the certificate (e.g. the key length). Other parameters like the hash function used by the sign function are not included. */
7818
+ /** The KeyAlgorithm of the certified key. This contains algorithm parameters that are inherent to the key of the certificate (e.g. the key length). Other parameters like the hash function used by the sign function are not included. */
7814
7819
  keyAlgorithm: KeyAlgorithm;
7815
7820
  }
7816
7821
 
7817
- export interface ClientCertificateSelectRequestDetails {
7818
- /** This field is a list of the types of certificates requested, sorted in order of the server's preference. Only certificates of a type contained in this list will be retrieved. If certificateTypes is the empty list, however, certificates of any type will be returned. */
7819
- certificateTypes: string[];
7822
+ export interface ClientCertificateRequest {
7823
+ /** This field is a list of the types of certificates requested, sorted in order of the server's preference. Only certificates of a type contained in this list will be retrieved. If `certificateTypes` is the empty list, however, certificates of any type will be returned. */
7824
+ certificateTypes: `${ClientCertificateType}`[];
7820
7825
  /** List of distinguished names of certificate authorities allowed by the server. Each entry must be a DER-encoded X.509 DistinguishedName. */
7821
7826
  certificateAuthorities: ArrayBuffer[];
7822
7827
  }
7823
7828
 
7824
- export interface ClientCertificateSelectDetails {
7829
+ export enum ClientCertificateType {
7830
+ ECDSA_SIGN = "ecdsaSign",
7831
+ RAS_SIGN = "rasSign",
7832
+ }
7833
+
7834
+ export interface SelectDetails {
7825
7835
  /** Only certificates that match this request will be returned. */
7826
- request: ClientCertificateSelectRequestDetails;
7827
- /**
7828
- * Optional.
7829
- * If given, the selectClientCertificates operates on this list. Otherwise, obtains the list of all certificates from the platform's certificate stores that are available to this extensions. Entries that the extension doesn't have permission for or which doesn't match the request, are removed.
7830
- */
7836
+ request: ClientCertificateRequest;
7837
+ /** If given, the `selectClientCertificates` operates on this list. Otherwise, obtains the list of all certificates from the platform's certificate stores that are available to this extensions. Entries that the extension doesn't have permission for or which doesn't match the request, are removed. */
7831
7838
  clientCerts?: ArrayBuffer[] | undefined;
7832
7839
  /** If true, the filtered list is presented to the user to manually select a certificate and thereby granting the extension access to the certificate(s) and key(s). Only the selected certificate(s) will be returned. If is false, the list is reduced to all certificates that the extension has been granted access to (automatically or manually). */
7833
7840
  interactive: boolean;
7834
7841
  }
7835
7842
 
7836
- export interface ServerCertificateVerificationDetails {
7843
+ export interface VerificationDetails {
7837
7844
  /** Each chain entry must be the DER encoding of a X.509 certificate, the first entry must be the server certificate and each entry must certify the entry preceding it. */
7838
7845
  serverCertificateChain: ArrayBuffer[];
7839
- /** The hostname of the server to verify the certificate for, e.g. the server that presented the serverCertificateChain. */
7846
+ /** The hostname of the server to verify the certificate for, e.g. the server that presented the `serverCertificateChain`. */
7840
7847
  hostname: string;
7841
7848
  }
7842
7849
 
7843
- export interface ServerCertificateVerificationResult {
7850
+ export interface VerificationResult {
7844
7851
  /** The result of the trust verification: true if trust for the given verification details could be established and false if trust is rejected for any reason. */
7845
7852
  trusted: boolean;
7846
7853
  /**
7847
7854
  * If the trust verification failed, this array contains the errors reported by the underlying network layer. Otherwise, this array is empty.
7855
+ *
7848
7856
  * Note: This list is meant for debugging only and may not contain all relevant errors. The errors returned may change in future revisions of this API, and are not guaranteed to be forwards or backwards compatible.
7849
7857
  */
7850
7858
  debug_errors: string[];
7851
7859
  }
7852
7860
 
7853
7861
  /**
7854
- * This function filters from a list of client certificates the ones that are known to the platform, match request and for which the extension has permission to access the certificate and its private key. If interactive is true, the user is presented a dialog where they can select from matching certificates and grant the extension access to the certificate. The selected/filtered client certificates will be passed to callback.
7855
- * Parameter matches: The list of certificates that match the request, that the extension has permission for and, if interactive is true, that were selected by the user.
7862
+ * This method filters from a list of client certificates the ones that are known to the platform, match `request` and for which the extension has permission to access the certificate and its private key. If `interactive` is true, the user is presented a dialog where they can select from matching certificates and grant the extension access to the certificate. The selected/filtered client certificates will be passed to `callback`.
7863
+ *
7864
+ * Can return its result via Promise in Manifest V3 or later since Chrome 121.
7856
7865
  */
7866
+ export function selectClientCertificates(details: SelectDetails): Promise<Match[]>;
7857
7867
  export function selectClientCertificates(
7858
- details: ClientCertificateSelectDetails,
7868
+ details: SelectDetails,
7859
7869
  callback: (matches: Match[]) => void,
7860
7870
  ): void;
7871
+
7861
7872
  /**
7862
- * Passes the key pair of certificate for usage with platformKeys.subtleCrypto to callback.
7863
- * @param certificate The certificate of a Match returned by selectClientCertificates.
7864
- * @param parameters Determines signature/hash algorithm parameters additionally to the parameters 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, additionally the parameters { 'hash': { 'name': 'none' } } are supported. The sign function will then apply PKCS#1 v1.5 padding and but not hash the given data.
7865
- * @param callback The public and private CryptoKey of a certificate which can only be used with platformKeys.subtleCrypto.
7866
- * Optional parameter privateKey: Might be null if this extension does not have access to it.
7873
+ * Passes the key pair of `certificate` for usage with {@link platformKeys.subtleCrypto} to `callback`.
7874
+ * @param certificate The certificate of a {@link Match} returned by {@link selectClientCertificates}.
7875
+ * @param parameters Determines signature/hash algorithm parameters additionally to the parameters 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 and `EcKeyImportParams` for EC key. Additionally for RSASSA-PKCS1-v1_5 keys, hashing algorithm name parameter can be specified with one of the following values: "none", "SHA-1", "SHA-256", "SHA-384", or "SHA-512", e.g. `{"hash": { "name": "none" } }`. The sign function will then apply PKCS#1 v1.5 padding but not hash the given data.
7876
+ *
7877
+ * Currently, this method only supports the "RSASSA-PKCS1-v1\_5" and "ECDSA" algorithms.
7867
7878
  */
7868
7879
  export function getKeyPair(
7869
7880
  certificate: ArrayBuffer,
7870
7881
  parameters: { [key: string]: unknown },
7871
7882
  callback: (publicKey: CryptoKey, privateKey: CryptoKey | null) => void,
7872
7883
  ): void;
7884
+
7873
7885
  /**
7874
- * Passes the key pair of publicKeySpkiDer for usage with platformKeys.subtleCrypto to callback.
7886
+ * Passes the key pair identified by `publicKeySpkiDer` for usage with {@link platformKeys.subtleCrypto} to `callback`.
7887
+ *
7875
7888
  * @param publicKeySpkiDer A DER-encoded X.509 SubjectPublicKeyInfo, obtained e.g. by calling WebCrypto's exportKey function with format="spki".
7876
- * @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.
7877
- * 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".
7878
- * @param callback The public and private CryptoKey of a certificate which can only be used with platformKeys.subtleCrypto.
7879
- * Optional parameter privateKey: Might be null if this extension does not have access to it.
7889
+ * @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](https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-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.
7890
+ *
7891
+ * Currently, this method supports the "ECDSA" algorithm with named-curve P-256 and "RSASSA-PKCS1-v1\_5" algorithm with one of the hashing algorithms "none", "SHA-1", "SHA-256", "SHA-384", and "SHA-512".
7880
7892
  * @since Chrome 85
7881
7893
  */
7882
7894
  export function getKeyPairBySpki(
@@ -7884,14 +7896,19 @@ export namespace Browser {
7884
7896
  parameters: { [key: string]: unknown },
7885
7897
  callback: (publicKey: CryptoKey, privateKey: CryptoKey | null) => void,
7886
7898
  ): void;
7887
- /** An implementation of WebCrypto's SubtleCrypto that allows crypto operations on keys of client certificates that are available to this extension. */
7888
- export function subtleCrypto(): SubtleCrypto;
7899
+
7900
+ /** An implementation of WebCrypto's SubtleCrypto that allows crypto operations on keys of client certificates that are available to this extension. */
7901
+ export function subtleCrypto(): SubtleCrypto | undefined;
7902
+
7889
7903
  /**
7890
- * Checks whether details.serverCertificateChain can be trusted for details.hostname according to the trust settings of the platform. Note: The actual behavior of the trust verification is not fully specified and might change in the future. The API implementation verifies certificate expiration, validates the certification path and checks trust by a known CA. The implementation is supposed to respect the EKU serverAuth and to support subject alternative names.
7904
+ * Checks whether `details.serverCertificateChain` can be trusted for `details.hostname` according to the trust settings of the platform. Note: The actual behavior of the trust verification is not fully specified and might change in the future. The API implementation verifies certificate expiration, validates the certification path and checks trust by a known CA. The implementation is supposed to respect the EKU serverAuth and to support subject alternative names.
7905
+ *
7906
+ * Can return its result via Promise in Manifest V3 or later since Chrome 121.
7891
7907
  */
7908
+ export function verifyTLSServerCertificate(details: VerificationDetails): Promise<VerificationResult>;
7892
7909
  export function verifyTLSServerCertificate(
7893
- details: ServerCertificateVerificationDetails,
7894
- callback: (result: ServerCertificateVerificationResult) => void,
7910
+ details: VerificationDetails,
7911
+ callback: (result: VerificationResult) => void,
7895
7912
  ): void;
7896
7913
  }
7897
7914