Files
modeling-app/sign-win.js

39 lines
1.0 KiB
JavaScript
Raw Normal View History

2024-08-29 06:01:53 -04:00
// From https://github.com/OpenBuilds/OpenBuilds-CONTROL/blob/4800540ffaa517925fc2cff26670809efa341ffe/signWin.js
2024-08-30 18:14:09 -04:00
const { execSync } = require('node:child_process')
2024-08-29 06:01:53 -04:00
2024-08-30 18:14:09 -04:00
exports.default = async (configuration) => {
if (!process.env.SM_API_KEY) {
console.error(
'Signing using signWin.js script: failed: SM_API_KEY ENV VAR NOT FOUND'
)
return
}
2024-08-29 06:01:53 -04:00
2024-08-30 18:14:09 -04:00
if (!process.env.WINDOWS_CERTIFICATE_THUMBPRINT) {
console.error(
'Signing using signWin.js script: failed: FINGERPRINT ENV VAR NOT FOUND'
)
return
}
2024-08-29 06:01:53 -04:00
2024-08-30 18:14:09 -04:00
if (!configuration.path) {
throw new Error(
`Signing using signWin.js script: failed: TARGET PATH NOT FOUND`
)
}
2024-08-29 06:01:53 -04:00
2024-08-30 18:14:09 -04:00
try {
execSync(
`smctl sign --fingerprint="${
process.env.WINDOWS_CERTIFICATE_THUMBPRINT
}" --input "${String(configuration.path)}"`,
{
stdio: 'inherit',
}
)
console.log('Signing using signWin.js script: successful')
} catch (error) {
console.error('Signing using signWin.js script: failed:', error)
}
2024-08-29 06:01:53 -04:00
}