Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/JAVA/Openclaw/extensions/matrix/src/   (KI Agentensystem Version 22©)  Datei vom 26.3.2026 mit Größe 2 kB image not shown  

Quelle  setup-bootstrap.ts

  Sprache: JAVA
 

Spracherkennung für: .ts vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

import { hasExplicitMatrixAccountConfig } from "./matrix/account-config.js";
import { resolveMatrixAccountConfig } from "./matrix/accounts.js";
import { bootstrapMatrixVerification } from "./matrix/actions/verification.js";
import { formatMatrixErrorMessage } from "./matrix/errors.js";
import type { RuntimeEnv } from "./runtime-api.js";
import type { CoreConfig } from "./types.js";

export type MatrixSetupVerificationBootstrapResult = {
  attempted: boolean;
  success: boolean;
  recoveryKeyCreatedAt: string | null;
  backupVersion: string | null;
  error?: string;
};

export async function maybeBootstrapNewEncryptedMatrixAccount(params: {
  previousCfg: CoreConfig;
  cfg: CoreConfig;
  accountId: string;
}): Promise<MatrixSetupVerificationBootstrapResult> {
  const accountConfig = resolveMatrixAccountConfig({
    cfg: params.cfg,
    accountId: params.accountId,
  });

  if (
    hasExplicitMatrixAccountConfig(params.previousCfg, params.accountId) ||
    accountConfig.encryption !== true
  ) {
    return {
      attempted: false,
      success: false,
      recoveryKeyCreatedAt: null,
      backupVersion: null,
    };
  }

  try {
    const bootstrap = await bootstrapMatrixVerification({ accountId: params.accountId });
    return {
      attempted: true,
      success: bootstrap.success,
      recoveryKeyCreatedAt: bootstrap.verification.recoveryKeyCreatedAt,
      backupVersion: bootstrap.verification.backupVersion,
      ...(bootstrap.success
        ? {}
        : { error: bootstrap.error ?? "Matrix verification bootstrap failed" }),
    };
  } catch (err) {
    return {
      attempted: true,
      success: false,
      recoveryKeyCreatedAt: null,
      backupVersion: null,
      error: formatMatrixErrorMessage(err),
    };
  }
}

export async function runMatrixSetupBootstrapAfterConfigWrite(params: {
  previousCfg: CoreConfig;
  cfg: CoreConfig;
  accountId: string;
  runtime: RuntimeEnv;
}): Promise<void> {
  const nextAccountConfig = resolveMatrixAccountConfig({
    cfg: params.cfg,
    accountId: params.accountId,
  });
  if (nextAccountConfig.encryption !== true) {
    return;
  }

  const bootstrap = await maybeBootstrapNewEncryptedMatrixAccount({
    previousCfg: params.previousCfg,
    cfg: params.cfg,
    accountId: params.accountId,
  });
  if (!bootstrap.attempted) {
    return;
  }
  if (bootstrap.success) {
    params.runtime.log(`Matrix verification bootstrap: complete for "${params.accountId}".`);
    if (bootstrap.backupVersion) {
      params.runtime.log(
        `Matrix backup version for "${params.accountId}": ${bootstrap.backupVersion}`,
      );
    }
    return;
  }
  params.runtime.error(
    `Matrix verification bootstrap warning for "${params.accountId}": ${bootstrap.error ?? "unknown bootstrap failure"}`,
  );
}

¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet am  2026-04-27) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.