Skip to content

Commit

Permalink
Added custom sign code
Browse files Browse the repository at this point in the history
  • Loading branch information
kglovern committed Jan 10, 2024
1 parent d3e7db5 commit 852ca3f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions WindowsSigner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const { execSync } = require('child_process');


/**
* Custom signing utility
* Required environment variables:
* KEYPAIR_ALIAS - KSP keypair from digicert
* @param config
* @returns {Promise<void>}
*/


// eslint-disable-next-line require-await
exports.default = async (config) => {
const keypairAlias = process.env.KEYPAIR_ALIAS;
const path = config.path ? String(config.path) : '';

if (process.platform !== 'win32' || !keypairAlias || !path) {
throw new Error('Either win32, no keypair or path not found');
}

const output = execSync(
`smctl sign --keypair-alias=${keypairAlias} --input="${path}" --verbose`,
)
.toString()
.trim();

if (!output.includes('Done Adding Additional Store')) {
throw new Error(`Failed to sign executable: ${output}`);
}
};

0 comments on commit 852ca3f

Please sign in to comment.