@todesktop/shared 7.188.52 → 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.js +6 -0
- package/package.json +1 -1
- package/src/hsm.ts +10 -0
package/lib/hsm.js
CHANGED
|
@@ -18,6 +18,9 @@ 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
|
/**
|
|
@@ -30,5 +33,8 @@ exports.getCertificateNameFromHSM = (appId, target) => {
|
|
|
30
33
|
* @returns the name of the secret that is required for downloading the cert from HSM.
|
|
31
34
|
*/
|
|
32
35
|
exports.getAPIKeyNameFromHSM = (appId, target) => {
|
|
36
|
+
if (!isMacTarget(target)) {
|
|
37
|
+
throw new Error(`Invalid target '${target}'. Only mac certs are supported`);
|
|
38
|
+
}
|
|
33
39
|
return `todesktop-${appId}-${target}-api-key`;
|
|
34
40
|
};
|
package/package.json
CHANGED
package/src/hsm.ts
CHANGED
|
@@ -36,6 +36,12 @@ 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
|
|
|
@@ -49,5 +55,9 @@ export const getCertificateNameFromHSM = (
|
|
|
49
55
|
* @returns the name of the secret that is required for downloading the cert from HSM.
|
|
50
56
|
*/
|
|
51
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
|
+
|
|
52
62
|
return `todesktop-${appId}-${target}-api-key`;
|
|
53
63
|
};
|