@todesktop/shared 7.188.39 → 7.188.41

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
@@ -1,18 +1,20 @@
1
+ export declare type MacTarget = 'mac' | 'mas' | 'mas-installer' | 'mas-dev';
2
+ export declare function isMacTarget(type: string): type is MacTarget;
1
3
  /**
2
- * Files that are uploaded to HSM have a unique secretName that depends on the appId and artifact.
4
+ * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
3
5
  * This function returns the key name that is used for certificate files that have a `.p12` postfix.
4
6
  *
5
7
  * @param appId the application id
6
- * @param artifact the mac artifact type
8
+ * @param target the mac target type
7
9
  * @returns the name of the secret that is required for downloading the cert from HSM.
8
10
  */
9
- export declare const getMacCertificateNameFromHSM: (appId: string, artifact: 'mac' | 'mas' | 'mas-installer' | 'mas-dev') => string;
11
+ export declare const getMacCertificateNameFromHSM: (appId: string, target: MacTarget) => string;
10
12
  /**
11
- * Files that are uploaded to HSM have a unique secretName that depends on the appId and artifact.
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 key files that have a `.p8` postfix.
13
15
  *
14
16
  * @param appId the application id
15
- * @param artifact the mac artifact type
17
+ * @param target the mac 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 getMacAPIKeyNameFromHSM: (appId: string, artifact: 'mac' | 'mas' | 'mas-installer' | 'mas-dev') => string;
20
+ export declare const getMacAPIKeyNameFromHSM: (appId: string, target: MacTarget) => string;
package/lib/hsm.js CHANGED
@@ -1,25 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMacAPIKeyNameFromHSM = exports.getMacCertificateNameFromHSM = void 0;
3
+ exports.getMacAPIKeyNameFromHSM = exports.getMacCertificateNameFromHSM = exports.isMacTarget = void 0;
4
+ function isMacTarget(type) {
5
+ return ['mac', 'mas', 'mas-installer', 'mas-dev'].includes(type);
6
+ }
7
+ exports.isMacTarget = isMacTarget;
4
8
  /**
5
- * Files that are uploaded to HSM have a unique secretName that depends on the appId and artifact.
9
+ * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
6
10
  * This function returns the key name that is used for certificate files that have a `.p12` postfix.
7
11
  *
8
12
  * @param appId the application id
9
- * @param artifact the mac artifact type
13
+ * @param target the mac target type
10
14
  * @returns the name of the secret that is required for downloading the cert from HSM.
11
15
  */
12
- exports.getMacCertificateNameFromHSM = (appId, artifact) => {
13
- return `todesktop-${appId}-${artifact}-cert`;
16
+ exports.getMacCertificateNameFromHSM = (appId, target) => {
17
+ return `todesktop-${appId}-${target}-cert`;
14
18
  };
15
19
  /**
16
- * Files that are uploaded to HSM have a unique secretName that depends on the appId and artifact.
20
+ * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
17
21
  * This function returns the key name that is used for key files that have a `.p8` postfix.
18
22
  *
19
23
  * @param appId the application id
20
- * @param artifact the mac artifact type
24
+ * @param target the mac target type
21
25
  * @returns the name of the secret that is required for downloading the cert from HSM.
22
26
  */
23
- exports.getMacAPIKeyNameFromHSM = (appId, artifact) => {
24
- return `todesktop-${appId}-${artifact}-api-key`;
27
+ exports.getMacAPIKeyNameFromHSM = (appId, target) => {
28
+ return `todesktop-${appId}-${target}-api-key`;
25
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todesktop/shared",
3
- "version": "7.188.39",
3
+ "version": "7.188.41",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
package/src/hsm.ts CHANGED
@@ -1,29 +1,31 @@
1
+ export type MacTarget = 'mac' | 'mas' | 'mas-installer' | 'mas-dev';
2
+ export function isMacTarget(type: string): type is MacTarget {
3
+ return ['mac', 'mas', 'mas-installer', 'mas-dev'].includes(type);
4
+ }
5
+
1
6
  /**
2
- * Files that are uploaded to HSM have a unique secretName that depends on the appId and artifact.
7
+ * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
3
8
  * This function returns the key name that is used for certificate files that have a `.p12` postfix.
4
9
  *
5
10
  * @param appId the application id
6
- * @param artifact the mac artifact type
11
+ * @param target the mac target type
7
12
  * @returns the name of the secret that is required for downloading the cert from HSM.
8
13
  */
9
14
  export const getMacCertificateNameFromHSM = (
10
15
  appId: string,
11
- artifact: 'mac' | 'mas' | 'mas-installer' | 'mas-dev'
16
+ target: MacTarget
12
17
  ) => {
13
- return `todesktop-${appId}-${artifact}-cert`;
18
+ return `todesktop-${appId}-${target}-cert`;
14
19
  };
15
20
 
16
21
  /**
17
- * Files that are uploaded to HSM have a unique secretName that depends on the appId and artifact.
22
+ * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
18
23
  * This function returns the key name that is used for key files that have a `.p8` postfix.
19
24
  *
20
25
  * @param appId the application id
21
- * @param artifact the mac artifact type
26
+ * @param target the mac target type
22
27
  * @returns the name of the secret that is required for downloading the cert from HSM.
23
28
  */
24
- export const getMacAPIKeyNameFromHSM = (
25
- appId: string,
26
- artifact: 'mac' | 'mas' | 'mas-installer' | 'mas-dev'
27
- ) => {
28
- return `todesktop-${appId}-${artifact}-api-key`;
29
+ export const getMacAPIKeyNameFromHSM = (appId: string, target: MacTarget) => {
30
+ return `todesktop-${appId}-${target}-api-key`;
29
31
  };