@digitalocean/functions-deployer 5.0.21 → 5.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +34 -19
- package/lib/index.js.map +3 -3
- package/lib/util.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -723,26 +723,41 @@ async function loadProjectConfig(configFile, envPath, buildEnvPath, filePath, re
|
|
|
723
723
|
}
|
|
724
724
|
function encryptProjectConfig(config) {
|
|
725
725
|
const key = crypto.randomBytes(32);
|
|
726
|
-
const iv =
|
|
727
|
-
const cipher = crypto.createCipheriv("
|
|
728
|
-
const encrypted =
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
)
|
|
741
|
-
|
|
742
|
-
|
|
726
|
+
const iv = crypto.randomBytes(12);
|
|
727
|
+
const cipher = crypto.createCipheriv("aes-256-gcm", key, iv);
|
|
728
|
+
const encrypted = Buffer.concat([
|
|
729
|
+
cipher.update(config, "utf8"),
|
|
730
|
+
cipher.final()
|
|
731
|
+
]);
|
|
732
|
+
const authTag = cipher.getAuthTag();
|
|
733
|
+
const final = `v2:${iv.toString("hex")}:${authTag.toString(
|
|
734
|
+
"hex"
|
|
735
|
+
)}:${encrypted.toString("hex")}`;
|
|
736
|
+
return { config: final, key: key.toString("hex") };
|
|
737
|
+
}
|
|
738
|
+
function decryptProjectConfig(encrypted, keyHex) {
|
|
739
|
+
const key = Buffer.from(keyHex, "hex");
|
|
740
|
+
if (encrypted.startsWith("v2:")) {
|
|
741
|
+
const [_v, ivHex, tagHex, encryptedHex] = encrypted.split(":");
|
|
742
|
+
const decipher2 = crypto.createDecipheriv(
|
|
743
|
+
"aes-256-gcm",
|
|
744
|
+
key,
|
|
745
|
+
Buffer.from(ivHex, "hex")
|
|
746
|
+
);
|
|
747
|
+
decipher2.setAuthTag(Buffer.from(tagHex, "hex"));
|
|
748
|
+
const decrypted2 = Buffer.concat([
|
|
749
|
+
decipher2.update(Buffer.from(encryptedHex, "hex")),
|
|
750
|
+
decipher2.final()
|
|
751
|
+
]);
|
|
752
|
+
return decrypted2.toString("utf8");
|
|
753
|
+
}
|
|
754
|
+
const iv = Buffer.alloc(16, 0);
|
|
755
|
+
const decipher = crypto.createDecipheriv("aes-256-cbc", key, iv);
|
|
756
|
+
const decrypted = Buffer.concat([
|
|
757
|
+
decipher.update(Buffer.from(encrypted, "hex")),
|
|
743
758
|
decipher.final()
|
|
744
759
|
]);
|
|
745
|
-
return
|
|
760
|
+
return decrypted.toString("utf8");
|
|
746
761
|
}
|
|
747
762
|
function renameFunctionsToActions(config) {
|
|
748
763
|
if (config.packages) {
|
|
@@ -4445,7 +4460,7 @@ var import_http = require("http");
|
|
|
4445
4460
|
var import_debug12 = __toESM(require("debug"));
|
|
4446
4461
|
|
|
4447
4462
|
// src/version.ts
|
|
4448
|
-
var version = "5.0.
|
|
4463
|
+
var version = "5.0.22";
|
|
4449
4464
|
|
|
4450
4465
|
// src/main.ts
|
|
4451
4466
|
var verboseError = (0, import_debug12.default)("nim:error");
|