calabasas 0.3.6 → 0.4.0

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -27
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5882,23 +5882,6 @@ var INTENTS = [
5882
5882
  { name: "Auto Moderation Config", value: 1 << 20, description: "Auto mod rule changes" },
5883
5883
  { name: "Auto Moderation Execution", value: 1 << 21, description: "Auto mod action execution" }
5884
5884
  ];
5885
- function encrypt(text2, key) {
5886
- const keyBytes = new TextEncoder().encode(key);
5887
- const textBytes = new TextEncoder().encode(text2);
5888
- const encrypted = new Uint8Array(textBytes.length);
5889
- for (let i = 0;i < textBytes.length; i++) {
5890
- encrypted[i] = textBytes[i] ^ keyBytes[i % keyBytes.length];
5891
- }
5892
- return btoa(String.fromCharCode(...encrypted));
5893
- }
5894
- function generateSecret() {
5895
- const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
5896
- let result = "";
5897
- for (let i = 0;i < 32; i++) {
5898
- result += chars.charAt(Math.floor(Math.random() * chars.length));
5899
- }
5900
- return result;
5901
- }
5902
5885
  async function apiRequest(method, path7, body, env) {
5903
5886
  const config = getConfig(env);
5904
5887
  const url = `${getApiUrlForEnv(env)}${path7}`;
@@ -5980,16 +5963,12 @@ async function botAdd(options) {
5980
5963
  const intents = selectedIntents.reduce((sum, i) => sum + INTENTS[i].value, 0);
5981
5964
  const s = p8.spinner();
5982
5965
  s.start("Creating bot...");
5983
- const encryptionKey = "calabasas-dev-key-change-in-production";
5984
- const encryptedToken = encrypt(token, encryptionKey);
5985
- const sharedSecret = generateSecret();
5986
5966
  const { ok, data, status } = await apiRequest("POST", "/api/cli/bots", {
5987
5967
  name: name.trim(),
5988
5968
  discordAppId: discordAppId.trim(),
5989
- encryptedToken,
5969
+ token,
5990
5970
  intents,
5991
- convexUrl: convexUrl.trim(),
5992
- sharedSecret
5971
+ convexUrl: convexUrl.trim()
5993
5972
  }, env);
5994
5973
  if (!ok) {
5995
5974
  s.stop("Failed to create bot");
@@ -5997,6 +5976,7 @@ async function botAdd(options) {
5997
5976
  return;
5998
5977
  }
5999
5978
  s.stop("Bot created!");
5979
+ const sharedSecret = data.sharedSecret;
6000
5980
  p8.note(`${sharedSecret}
6001
5981
 
6002
5982
  Add this to your Convex environment as CALABASAS_SECRET`, "Shared Secret");
@@ -6142,8 +6122,7 @@ async function botEdit(botId, options) {
6142
6122
  p8.cancel("Cancelled.");
6143
6123
  return;
6144
6124
  }
6145
- const encryptionKey = "calabasas-dev-key-change-in-production";
6146
- updates.encryptedToken = encrypt(value, encryptionKey);
6125
+ updates.token = value;
6147
6126
  } else if (field === "intents") {
6148
6127
  const value = await p8.text({ message: "New intents value (number)" });
6149
6128
  if (p8.isCancel(value)) {
@@ -6158,8 +6137,7 @@ async function botEdit(botId, options) {
6158
6137
  if (options.url)
6159
6138
  updates.convexUrl = options.url;
6160
6139
  if (options.token) {
6161
- const encryptionKey = "calabasas-dev-key-change-in-production";
6162
- updates.encryptedToken = encrypt(options.token, encryptionKey);
6140
+ updates.token = options.token;
6163
6141
  }
6164
6142
  if (options.intents)
6165
6143
  updates.intents = parseInt(options.intents, 10);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "calabasas",
3
- "version": "0.3.6",
3
+ "version": "0.4.0",
4
4
  "description": "CLI for Calabasas - Discord Gateway as a Service for Convex",
5
5
  "type": "module",
6
6
  "bin": {