INNER CODE UNIT · TypeScript

raw

im4codes/imcodes · server/src/platform/handlers/feishu/index.ts:42

    const raw = encryptKey + timestamp + nonce + body;
    const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(raw));
    const computed = Array.from(new Uint8Array(digest))
      .map((b) => b.toString(16).padStart(2, '0'))
      .join('');

    return computed === signature;
  }

  async normalizeInbound(req: Request, config: BotConfig): Promise<InboundMessage> {
    const body = await req.json() as FeishuEvent;

    if (body.type === 'url_verification') {
      return {
        platform: 'feishu',
        botId: config.botId,
        channelId: 'challenge',
        userId: 'feishu',

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…