@todesktop/shared 7.188.50 → 7.188.51

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.
package/lib/hsm.d.ts CHANGED
@@ -6,22 +6,24 @@
6
6
  * - mas-dev = Apple Development
7
7
  */
8
8
  export declare type MacTarget = 'mac' | 'mac-installer' | 'mas' | 'mas-installer' | 'mas-dev';
9
+ export declare type WindowsTarget = 'windows';
9
10
  export declare function isMacTarget(type: string): type is MacTarget;
11
+ export declare function isWindowsTarget(type: string): type is MacTarget;
10
12
  /**
11
13
  * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
12
14
  * This function returns the key name that is used for certificate files that have a `.p12` postfix.
13
15
  *
14
16
  * @param appId the application id
15
- * @param target the mac target type
17
+ * @param target the target type
16
18
  * @returns the name of the secret that is required for downloading the cert from HSM.
17
19
  */
18
- export declare const getMacCertificateNameFromHSM: (appId: string, target: MacTarget) => string;
20
+ export declare const getCertificateNameFromHSM: (appId: string, target: MacTarget | WindowsTarget) => string;
19
21
  /**
20
22
  * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
21
23
  * This function returns the key name that is used for key files that have a `.p8` postfix.
22
24
  *
23
25
  * @param appId the application id
24
- * @param target the mac target type
26
+ * @param target the target type
25
27
  * @returns the name of the secret that is required for downloading the cert from HSM.
26
28
  */
27
- export declare const getMacAPIKeyNameFromHSM: (appId: string, target: MacTarget) => string;
29
+ export declare const getAPIKeyNameFromHSM: (appId: string, target: MacTarget | WindowsTarget) => string;
package/lib/hsm.js CHANGED
@@ -1,19 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMacAPIKeyNameFromHSM = exports.getMacCertificateNameFromHSM = exports.isMacTarget = void 0;
3
+ exports.getAPIKeyNameFromHSM = exports.getCertificateNameFromHSM = exports.isWindowsTarget = exports.isMacTarget = void 0;
4
4
  function isMacTarget(type) {
5
5
  return ['mac', 'mac-installer', 'mas', 'mas-installer', 'mas-dev'].includes(type);
6
6
  }
7
7
  exports.isMacTarget = isMacTarget;
8
+ function isWindowsTarget(type) {
9
+ return ['windows'].includes(type);
10
+ }
11
+ exports.isWindowsTarget = isWindowsTarget;
8
12
  /**
9
13
  * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
10
14
  * This function returns the key name that is used for certificate files that have a `.p12` postfix.
11
15
  *
12
16
  * @param appId the application id
13
- * @param target the mac target type
17
+ * @param target the target type
14
18
  * @returns the name of the secret that is required for downloading the cert from HSM.
15
19
  */
16
- exports.getMacCertificateNameFromHSM = (appId, target) => {
20
+ exports.getCertificateNameFromHSM = (appId, target) => {
17
21
  return `todesktop-${appId}-${target}-cert`;
18
22
  };
19
23
  /**
@@ -21,9 +25,9 @@ exports.getMacCertificateNameFromHSM = (appId, target) => {
21
25
  * This function returns the key name that is used for key files that have a `.p8` postfix.
22
26
  *
23
27
  * @param appId the application id
24
- * @param target the mac target type
28
+ * @param target the target type
25
29
  * @returns the name of the secret that is required for downloading the cert from HSM.
26
30
  */
27
- exports.getMacAPIKeyNameFromHSM = (appId, target) => {
31
+ exports.getAPIKeyNameFromHSM = (appId, target) => {
28
32
  return `todesktop-${appId}-${target}-api-key`;
29
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todesktop/shared",
3
- "version": "7.188.50",
3
+ "version": "7.188.51",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
package/src/hsm.ts CHANGED
@@ -11,23 +11,30 @@ export type MacTarget =
11
11
  | 'mas'
12
12
  | 'mas-installer'
13
13
  | 'mas-dev';
14
+
15
+ export type WindowsTarget = 'windows';
16
+
14
17
  export function isMacTarget(type: string): type is MacTarget {
15
18
  return ['mac', 'mac-installer', 'mas', 'mas-installer', 'mas-dev'].includes(
16
19
  type
17
20
  );
18
21
  }
19
22
 
23
+ export function isWindowsTarget(type: string): type is MacTarget {
24
+ return ['windows'].includes(type);
25
+ }
26
+
20
27
  /**
21
28
  * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
22
29
  * This function returns the key name that is used for certificate files that have a `.p12` postfix.
23
30
  *
24
31
  * @param appId the application id
25
- * @param target the mac target type
32
+ * @param target the target type
26
33
  * @returns the name of the secret that is required for downloading the cert from HSM.
27
34
  */
28
- export const getMacCertificateNameFromHSM = (
35
+ export const getCertificateNameFromHSM = (
29
36
  appId: string,
30
- target: MacTarget
37
+ target: MacTarget | WindowsTarget
31
38
  ) => {
32
39
  return `todesktop-${appId}-${target}-cert`;
33
40
  };
@@ -37,9 +44,12 @@ export const getMacCertificateNameFromHSM = (
37
44
  * This function returns the key name that is used for key files that have a `.p8` postfix.
38
45
  *
39
46
  * @param appId the application id
40
- * @param target the mac target type
47
+ * @param target the target type
41
48
  * @returns the name of the secret that is required for downloading the cert from HSM.
42
49
  */
43
- export const getMacAPIKeyNameFromHSM = (appId: string, target: MacTarget) => {
50
+ export const getAPIKeyNameFromHSM = (
51
+ appId: string,
52
+ target: MacTarget | WindowsTarget
53
+ ) => {
44
54
  return `todesktop-${appId}-${target}-api-key`;
45
55
  };