import bcrypt from "bcryptjs";

export const createPassword = async (password: string) => {
  // encypt password
  let pass: string | undefined = process.env.SECRET;
  let salt: string | undefined = process.env.SALTING;

  if (!pass || !salt) {
    pass = "error";
  } else {
    pass = bcrypt.hashSync(pass + password, parseInt(salt));

    pass = btoa(pass);
  }

  return pass;
};
