Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/drivers/net/wireless/ti/wlcore/   (Linux Kernel Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 2 kB image not shown  

SSL auth-presence.ts   Interaktion und
PortierbarkeitJAVA

 

import fs from "node:fs";
import path from "node:path";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
import { resolveUserPath } from "openclaw/plugin-sdk/account-resolution";
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime";
import { resolveOAuthDir } from "openclaw/plugin-sdk/state-paths";
import { hasWebCredsSync } from "./src/creds-files.js";

type WhatsAppAuthPresenceParams =
  | {
      cfg: OpenClawConfig;
      env?: NodeJS.ProcessEnv;
    }
  | OpenClawConfig;

function addAccountAuthDirs(
  authDirs: Set<string>,
  accountId: string,
  authDir: string | undefined,
  accountsRoot: string,
  env: NodeJS.ProcessEnv,
): void {
  authDirs.add(path.join(accountsRoot, normalizeAccountId(accountId)));
  const configuredAuthDir = authDir?.trim();
  if (configuredAuthDir) {
    authDirs.add(resolveUserPath(configuredAuthDir, env));
  }
}

function listWhatsAppAuthDirs(
  cfg: OpenClawConfig,
  env: NodeJS.ProcessEnv = process.env,
): readonly string[] {
  const oauthDir = resolveOAuthDir(env);
  const accountsRoot = path.join(oauthDir, "whatsapp");
  const channel = cfg.channels?.whatsapp;
  const authDirs = new Set<string>([oauthDir, path.join(accountsRoot, DEFAULT_ACCOUNT_ID)]);

  addAccountAuthDirs(authDirs, DEFAULT_ACCOUNT_ID, undefined, accountsRoot, env);

  if (channel?.defaultAccount?.trim()) {
    addAccountAuthDirs(
      authDirs,
      channel.defaultAccount,
      channel.accounts?.[channel.defaultAccount]?.authDir,
      accountsRoot,
      env,
    );
  }

  const accounts = channel?.accounts;
  if (accounts) {
    for (const [accountId, account] of Object.entries(accounts)) {
      addAccountAuthDirs(authDirs, accountId, account?.authDir, accountsRoot, env);
    }
  }

  try {
    const entries = fs.readdirSync(accountsRoot, { withFileTypes: true });
    for (const entry of entries) {
      if (entry.isDirectory()) {
        authDirs.add(path.join(accountsRoot, entry.name));
      }
    }
  } catch {
    // Missing directories mean no auth state.
  }

  return [...authDirs];
}

export function hasAnyWhatsAppAuth(
  params: WhatsAppAuthPresenceParams,
  env: NodeJS.ProcessEnv = process.env,
): boolean {
  const cfg = params && typeof params === "object" && "cfg" in params ? params.cfg : params;
  const resolvedEnv =
    params && typeof params === "object" && "cfg" in params ? (params.env ?? env) : env;
  return listWhatsAppAuthDirs(cfg, resolvedEnv).some((authDir) => hasWebCredsSync(authDir));
}

Messung V0.5 in Prozent
C=99 H=90 G=94

¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.1Angebot  (Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-09-28) ¤

*Eine klare Vorstellung vom Zielzustand






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.