signing-enclave
Version:
A code signing and notarization tool for macOS and Windows applications. Uses Azure Key Vault for secret and certificate management.
32 lines • 1.43 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getKeyVaultCredentials = getKeyVaultCredentials;
const dotenv_1 = __importDefault(require("dotenv"));
dotenv_1.default.config();
function parseKeyVaultCredentials(maybeCredentials) {
if (typeof maybeCredentials !== "string") {
throw new Error("Invalid credentials format");
}
const credentials = JSON.parse(atob(maybeCredentials));
if (typeof credentials !== "object" || credentials === null) {
throw new Error("Invalid credentials format");
}
if (("url" in credentials && typeof credentials.url !== "string") ||
("id" in credentials && typeof credentials.id !== "string") ||
("secret" in credentials && typeof credentials.secret !== "string") ||
("tenantId" in credentials && typeof credentials.tenantId !== "string")) {
throw new Error("Missing required fields in credentials");
}
return credentials;
}
function getKeyVaultCredentials() {
const { AZURE_KEY_VAULT_CREDENTIALS } = process.env;
if (!AZURE_KEY_VAULT_CREDENTIALS) {
throw new Error("AZURE_KEY_VAULT_CREDENTIALS is not set");
}
return parseKeyVaultCredentials(AZURE_KEY_VAULT_CREDENTIALS);
}
//# sourceMappingURL=keyVaultCredentials.js.map