@mastra/slack 1.7.0-alpha.0 → 1.7.1-alpha.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.
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
|
-
import { createCipheriv, createDecipheriv, createHmac, hkdfSync,
|
|
2
|
+
import { createCipheriv, createDecipheriv, createHmac, hkdfSync, timingSafeEqual } from "crypto";
|
|
3
3
|
import { AgentChannels, AgentControllerChannels, resolveWaitUntil } from "@mastra/core/channels";
|
|
4
4
|
import "@mastra/core/storage";
|
|
5
5
|
import { createSlackAdapter, createSlackAdapter as createSlackAdapter$1 } from "@chat-adapter/slack";
|
|
@@ -222,9 +222,9 @@ const ALGO_PREFIX = "aes-256-gcm-hkdf";
|
|
|
222
222
|
* Returns: `aes-256-gcm-hkdf:base64(salt):base64(iv):base64(authTag):base64(ciphertext)`
|
|
223
223
|
*/
|
|
224
224
|
function encrypt(plaintext, key) {
|
|
225
|
-
const salt =
|
|
225
|
+
const salt = Buffer.from(globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16)));
|
|
226
226
|
const derived = Buffer.from(hkdfSync("sha256", key, salt, "mastra-slack-encryption", 32));
|
|
227
|
-
const iv =
|
|
227
|
+
const iv = Buffer.from(globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(12)));
|
|
228
228
|
const cipher = createCipheriv("aes-256-gcm", derived, iv);
|
|
229
229
|
const encrypted = Buffer.concat([cipher.update(plaintext, "utf8"), cipher.final()]);
|
|
230
230
|
const authTag = cipher.getAuthTag();
|
|
@@ -5985,7 +5985,7 @@ var SlackProvider = class {
|
|
|
5985
5985
|
}
|
|
5986
5986
|
if (existingRecord?.status === "active") throw new Error(`Agent "${agentId}" is already connected to Slack. Disconnect first to reconnect.`);
|
|
5987
5987
|
const config = options ?? {};
|
|
5988
|
-
const webhookId = crypto.randomUUID();
|
|
5988
|
+
const webhookId = globalThis.crypto.randomUUID();
|
|
5989
5989
|
const appName = config.name ?? agent?.name ?? agentId;
|
|
5990
5990
|
const appDescription = config.description || agent?.getDescription() || "AI assistant powered by Mastra";
|
|
5991
5991
|
const normalizedCommands = this.#normalizeCommands(config.slashCommands);
|
|
@@ -6011,7 +6011,7 @@ var SlackProvider = class {
|
|
|
6011
6011
|
} catch (error) {
|
|
6012
6012
|
console.warn(`[Slack] Failed to set app icon for "${agentId}":`, error);
|
|
6013
6013
|
}
|
|
6014
|
-
const installationId = crypto.randomUUID();
|
|
6014
|
+
const installationId = globalThis.crypto.randomUUID();
|
|
6015
6015
|
const scopes = manifest.oauth_config?.scopes?.bot?.join(",") ?? "";
|
|
6016
6016
|
const slackBaseUrl = appCredentials.oauthAuthorizeUrl ?? `https://slack.com/oauth/v2/authorize?client_id=${appCredentials.clientId}&scope=${encodeURIComponent(scopes)}`;
|
|
6017
6017
|
const authUrl = new URL(slackBaseUrl);
|