Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Added types for crypto

dominicbachmannde37ee9f1c2b
diff --git a/src/lib/api.ts b/src/lib/api.ts
index 85d4ccf26c..867ed338e6 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -1,3 +1,5 @@
+// TODO: Make this functions generic
+
async function send({
method,
path,
diff --git a/src/lib/crypto.ts b/src/lib/crypto.ts
index 861a255101..dfb38991f7 100644
--- a/src/lib/crypto.ts
+++ b/src/lib/crypto.ts
@@ -1,13 +1,13 @@
import crypto from 'crypto';
const algorithm = 'aes-256-ctr';
-export const base64Encode = (text: string) => {
+export const base64Encode = (text: string): string => {
return Buffer.from(text).toString('base64');
};
-export const base64Decode = (text: string) => {
+export const base64Decode = (text: string): string => {
return Buffer.from(text, 'base64').toString('ascii');
};
-export const encrypt = (text: string) => {
+export const encrypt = (text: string): string => {
if (text) {
const iv = crypto.randomBytes(16);
const cipher = crypto.createCipheriv(algorithm, process.env['COOLIFY_SECRET_KEY'], iv);
@@ -19,7 +19,7 @@ export const encrypt = (text: string) => {
}
};
-export const decrypt = (hashString: string) => {
+export const decrypt = (hashString: string): string => {
if (hashString) {
const hash: Hash = JSON.parse(hashString);
const decipher = crypto.createDecipheriv(