@digitalocean/functions-deployer 5.0.20 → 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 CHANGED
@@ -394,6 +394,10 @@ var staticRuntimes = {
394
394
  {
395
395
  default: true,
396
396
  kind: "python:3.9"
397
+ },
398
+ {
399
+ default: false,
400
+ kind: "python:3.11"
397
401
  }
398
402
  ]
399
403
  };
@@ -719,26 +723,41 @@ async function loadProjectConfig(configFile, envPath, buildEnvPath, filePath, re
719
723
  }
720
724
  function encryptProjectConfig(config) {
721
725
  const key = crypto.randomBytes(32);
722
- const iv = Buffer.alloc(16).fill(0);
723
- const cipher = crypto.createCipheriv("aes256", key, iv);
724
- const encrypted = cipher.update(config, "utf8", "hex") + cipher.final("hex");
725
- return {
726
- config: encrypted,
727
- key: key.toString("hex")
728
- };
729
- }
730
- function decryptProjectConfig(config, key) {
731
- const iv = Buffer.alloc(16).fill(0);
732
- const decipher = crypto.createDecipheriv(
733
- "aes256",
734
- Buffer.from(key, "hex"),
735
- iv
736
- );
737
- const decryptedMessage = Buffer.concat([
738
- decipher.update(config, "hex"),
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")),
739
758
  decipher.final()
740
759
  ]);
741
- return decryptedMessage.toString("utf8");
760
+ return decrypted.toString("utf8");
742
761
  }
743
762
  function renameFunctionsToActions(config) {
744
763
  if (config.packages) {
@@ -4441,7 +4460,7 @@ var import_http = require("http");
4441
4460
  var import_debug12 = __toESM(require("debug"));
4442
4461
 
4443
4462
  // src/version.ts
4444
- var version = "5.0.20";
4463
+ var version = "5.0.22";
4445
4464
 
4446
4465
  // src/main.ts
4447
4466
  var verboseError = (0, import_debug12.default)("nim:error");