UNPKG

@salesforce/plugin-trust

Version:

validate a digital signature for a npm package

57 lines 2.26 kB
/* * Copyright 2026, Salesforce, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; import { Messages } from '@salesforce/core'; import { AllowList } from '../../../../shared/allowlist.js'; Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); const messages = Messages.loadMessages('@salesforce/plugin-trust', 'allowlist.remove'); export class AllowListRemove extends SfCommand { static summary = messages.getMessage('summary'); static description = messages.getMessage('description'); static examples = messages.getMessages('examples'); static flags = { name: Flags.string({ char: 'n', summary: messages.getMessage('flags.name.summary'), required: true, multiple: true, }), }; async run() { const { flags } = await this.parse(AllowListRemove); const allowList = new AllowList(this.config.configDir); const existingAllowList = await allowList.get(); const results = []; const pluginsToRemove = new Set(); for (const name of flags.name) { if (existingAllowList.includes(name)) { pluginsToRemove.add(name); results.push({ Plugin: name, Status: 'removed' }); } else { results.push({ Plugin: name, Status: 'skipped', Reason: 'not in allowlist' }); } } if (pluginsToRemove.size > 0) { await allowList.save(existingAllowList.filter((plugin) => !pluginsToRemove.has(plugin))); } this.table({ data: results, }); return results; } } //# sourceMappingURL=remove.js.map