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

Quelle  backup-health.ts

  Sprache: JAVA
 

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

export type MatrixRoomKeyBackupStatusLike = {
  serverVersion: string | null;
  activeVersion: string | null;
  trusted: boolean | null;
  matchesDecryptionKey: boolean | null;
  decryptionKeyCached: boolean | null;
  keyLoadAttempted: boolean;
  keyLoadError: string | null;
};

export type MatrixRoomKeyBackupIssueCode =
  | "missing-server-backup"
  | "key-load-failed"
  | "key-not-loaded"
  | "key-mismatch"
  | "untrusted-signature"
  | "inactive"
  | "indeterminate"
  | "ok";

export type MatrixRoomKeyBackupIssue = {
  code: MatrixRoomKeyBackupIssueCode;
  summary: string;
  message: string | null;
};

export function resolveMatrixRoomKeyBackupIssue(
  backup: MatrixRoomKeyBackupStatusLike,
): MatrixRoomKeyBackupIssue {
  if (!backup.serverVersion) {
    return {
      code: "missing-server-backup",
      summary: "missing on server",
      message: "no room-key backup exists on the homeserver",
    };
  }
  if (backup.decryptionKeyCached === false) {
    if (backup.keyLoadError) {
      return {
        code: "key-load-failed",
        summary: "present but backup key unavailable on this device",
        message: `backup decryption key could not be loaded from secret storage (${backup.keyLoadError})`,
      };
    }
    if (backup.keyLoadAttempted) {
      return {
        code: "key-not-loaded",
        summary: "present but backup key unavailable on this device",
        message:
          "backup decryption key is not loaded on this device (secret storage did not return a key)",
      };
    }
    return {
      code: "key-not-loaded",
      summary: "present but backup key unavailable on this device",
      message: "backup decryption key is not loaded on this device",
    };
  }
  if (backup.matchesDecryptionKey === false) {
    return {
      code: "key-mismatch",
      summary: "present but backup key mismatch on this device",
      message: "backup key mismatch (this device does not have the matching backup decryption key)",
    };
  }
  if (backup.trusted === false) {
    return {
      code: "untrusted-signature",
      summary: "present but not trusted on this device",
      message: "backup signature chain is not trusted by this device",
    };
  }
  if (!backup.activeVersion) {
    return {
      code: "inactive",
      summary: "present on server but inactive on this device",
      message: "backup exists but is not active on this device",
    };
  }
  if (
    backup.trusted === null ||
    backup.matchesDecryptionKey === null ||
    backup.decryptionKeyCached === null
  ) {
    return {
      code: "indeterminate",
      summary: "present but trust state unknown",
      message: "backup trust state could not be fully determined",
    };
  }
  return {
    code: "ok",
    summary: "active and trusted on this device",
    message: null,
  };
}

export function resolveMatrixRoomKeyBackupReadinessError(
  backup: MatrixRoomKeyBackupStatusLike,
  opts: {
    allowUntrustedMatchingKey?: boolean;
    requireServerBackup: boolean;
  },
): string | null {
  const issue = resolveMatrixRoomKeyBackupIssue(backup);
  if (issue.code === "missing-server-backup") {
    return opts.requireServerBackup ? "Matrix room key backup is missing on the homeserver." : null;
  }
  if (issue.code === "ok") {
    return null;
  }
  if (
    issue.code === "untrusted-signature" &&
    opts.allowUntrustedMatchingKey === true &&
    backup.matchesDecryptionKey === true &&
    backup.decryptionKeyCached === true
  ) {
    return null;
  }
  if (issue.message) {
    return `Matrix room key backup is not usable: ${issue.message}.`;
  }
  return "Matrix room key backup is not usable on this device.";
}

¤ Dauer der Verarbeitung: 0.17 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.