@todesktop/shared 7.188.51 → 7.188.53

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
@@ -21,9 +21,10 @@ export declare const getCertificateNameFromHSM: (appId: string, target: MacTarge
21
21
  /**
22
22
  * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
23
23
  * This function returns the key name that is used for key files that have a `.p8` postfix.
24
+ * Currently only used for mac notarization.
24
25
  *
25
26
  * @param appId the application id
26
27
  * @param target the target type
27
28
  * @returns the name of the secret that is required for downloading the cert from HSM.
28
29
  */
29
- export declare const getAPIKeyNameFromHSM: (appId: string, target: MacTarget | WindowsTarget) => string;
30
+ export declare const getAPIKeyNameFromHSM: (appId: string, target: MacTarget) => string;
package/lib/hsm.js CHANGED
@@ -18,16 +18,23 @@ exports.isWindowsTarget = isWindowsTarget;
18
18
  * @returns the name of the secret that is required for downloading the cert from HSM.
19
19
  */
20
20
  exports.getCertificateNameFromHSM = (appId, target) => {
21
+ if (!isMacTarget(target) && !isWindowsTarget(target)) {
22
+ throw new Error(`Invalid target '${target}'. Only windows or mac certs are supported`);
23
+ }
21
24
  return `todesktop-${appId}-${target}-cert`;
22
25
  };
23
26
  /**
24
27
  * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
25
28
  * This function returns the key name that is used for key files that have a `.p8` postfix.
29
+ * Currently only used for mac notarization.
26
30
  *
27
31
  * @param appId the application id
28
32
  * @param target the target type
29
33
  * @returns the name of the secret that is required for downloading the cert from HSM.
30
34
  */
31
35
  exports.getAPIKeyNameFromHSM = (appId, target) => {
36
+ if (!isMacTarget(target)) {
37
+ throw new Error(`Invalid target '${target}'. Only mac certs are supported`);
38
+ }
32
39
  return `todesktop-${appId}-${target}-api-key`;
33
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todesktop/shared",
3
- "version": "7.188.51",
3
+ "version": "7.188.53",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
package/src/hsm.ts CHANGED
@@ -36,20 +36,28 @@ export const getCertificateNameFromHSM = (
36
36
  appId: string,
37
37
  target: MacTarget | WindowsTarget
38
38
  ) => {
39
+ if (!isMacTarget(target) && !isWindowsTarget(target)) {
40
+ throw new Error(
41
+ `Invalid target '${target}'. Only windows or mac certs are supported`
42
+ );
43
+ }
44
+
39
45
  return `todesktop-${appId}-${target}-cert`;
40
46
  };
41
47
 
42
48
  /**
43
49
  * Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
44
50
  * This function returns the key name that is used for key files that have a `.p8` postfix.
51
+ * Currently only used for mac notarization.
45
52
  *
46
53
  * @param appId the application id
47
54
  * @param target the target type
48
55
  * @returns the name of the secret that is required for downloading the cert from HSM.
49
56
  */
50
- export const getAPIKeyNameFromHSM = (
51
- appId: string,
52
- target: MacTarget | WindowsTarget
53
- ) => {
57
+ export const getAPIKeyNameFromHSM = (appId: string, target: MacTarget) => {
58
+ if (!isMacTarget(target)) {
59
+ throw new Error(`Invalid target '${target}'. Only mac certs are supported`);
60
+ }
61
+
54
62
  return `todesktop-${appId}-${target}-api-key`;
55
63
  };