UNPKG

@fbl-plugins/crypto

Version:
52 lines 2.38 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.EncryptActionHandler = exports.EncryptActionProcessor = void 0; const fbl_1 = require("fbl"); const BaseCryptoActionProcessor_1 = require("./BaseCryptoActionProcessor"); const services_1 = require("../services"); class EncryptActionProcessor extends BaseCryptoActionProcessor_1.BaseCryptoActionProcessor { /** * @inheritdoc */ execute() { return __awaiter(this, void 0, void 0, function* () { const source = fbl_1.FSUtil.getAbsolutePath(this.options.file, this.snapshot.wd); const destination = this.options.destination ? fbl_1.FSUtil.getAbsolutePath(this.options.destination, this.snapshot.wd) : source; this.snapshot.log(`Encrypting ${source} into ${destination}`); yield services_1.CryptoService.instance.encrypt(source, destination, this.options.password); }); } } exports.EncryptActionProcessor = EncryptActionProcessor; class EncryptActionHandler extends fbl_1.ActionHandler { /* istanbul ignore next */ /** * @inheritdoc */ getMetadata() { return EncryptActionHandler.metadata; } /** * @inheritdoc */ getProcessor(options, context, snapshot, parameters) { return new EncryptActionProcessor(options, context, snapshot, parameters); } } exports.EncryptActionHandler = EncryptActionHandler; EncryptActionHandler.metadata = { id: 'com.fireblink.fbl.plugins.crypto.encrypt', aliases: ['fbl.plugins.crypto.encrypt', 'plugins.crypto.encrypt', 'crypto.encrypt', 'encrypt'], }; //# sourceMappingURL=EncryptActionHandler.js.map