Skip to content
Yoga Pradana Ismail edited this page Jan 3, 2026 · 9 revisions

MirAI Encrypted Data Files (.medf)

Specification Guide

  • Version: 1.0.0
  • Status: Stable Implementation (MirAI Ecosystem)
  • Author: Yoga (MirAI Development)

Table of Contents


1. Introduction

MirAI Encrypted Data Files (.medf) is a text-based encrypted data storage format designed for secure data exchange within untrusted frontend environments. This format allows developers to store sensitive information locally without relying on backend infrastructure for the encryption process.

2. Security Philosophy

The .medf format is built upon the Zero-Knowledge Architecture principle. This means:

  • Data Sovereignty: The encryption key (password) is entirely managed by the user or creator.
  • Browser Autonomy: All processes utilize Vanilla JS (Web Crypto API), ensuring raw data never touches the network.
  • String Consistency: Data is handled as JSON Strings to ensure compatibility across different web environments before being locked by encryption.

3. Technical Specifications

3.1 Encryption Algorithm

The system utilizes AES-GCM (Advanced Encryption Standard - Galois/Counter Mode) with a 256-bit key length. AES-GCM was selected for:

  • Confidentiality: Keeping the content private.
  • Authenticity: Ensuring the data has not been modified by third parties (tamper-proof).

3.2 Data Structure (Anatomy)

Post-decryption, the .medf file contents follow this structure:

{
  "_signature": {
    "headerText": "{MirAI Encrypted Data Files v1.0 By Allwaysever}",
    "headerCode": "037502370321034802010225010202130336030303480369034203540309030601020210029703540297010202160321033003090351010203600153014401500102020403690102020103300330036302970369035103090360030903480381",
    "timestamp": "2026-01-03T04:08:01.887Z",
    "version": "1.0"
  },
  "savedTheme": "mirai-dark",
  "miraiTheme": "dark",
  "miraiLanguage": "en",
  "miraiPersona": "default",
  "_metadata": {
    "version": "2.12.0-Beta5",
    "persona": "default",
    "language": "id",
    "exportDate": "2026-01-03T04:07:55.380Z",
    "model": "gemini-2.5-flash",
    "format": "mirai-backup-v2"
  }
}

3.3 Double Header Verification

To prevent file-type spoofing or injection attacks, .medf employs two layers of identification:

  • Primary Header: Identifies the file as an authentic part of the MirAI ecosystem.
  • Secondary Header: Validates the specific content type (e.g., distinguishing between a backup file and an API Key configuration).

4. Media-as-Code Concept

Unlike traditional binary storage, .medf treats visual assets as text data:

  • Assets/Images: Converted into Base64 Strings or SVG Code.
  • Advantage: Entire datasets, including visual assets, can be bundled into a single self-contained file, eliminating the need for complex multi-file management.

5. Client-Side Implementation

Implementation is achieved using Vanilla JavaScript (specifically the window.crypto.subtle API) without third-party libraries like CryptoJS. This minimizes the attack surface and ensures maximum performance.

  • Key Methods: crypto.subtle.deriveKey(): Transforms user passwords into cryptographic keys using PBKDF2 or - similar.crypto.subtle.encrypt(): Encrypts the stringified JSON payload.crypto.subtle.decrypt(): Reverts the ciphertext back to readable data after password verification.

6. Primary Use Cases

Encrypted Frontend Environment: Securing API Keys (serving as an encrypted ".env") within the browser environment.

  • Secure Backup System: A dedicated storage container for MirAI application data backups.
  • Private Data Exchange: Allowing MirAI users to share sensitive data through public channels with end-to-end encryption.

7. Glossary & Terminology

  • AES-GCM: The current gold standard for symmetric encryption, providing both speed and security.
  • Vanilla JS: Pure JavaScript code without external frameworks or libraries.
  • Base64: A binary-to-text encoding scheme used to represent images as strings.Ciphertext: The encrypted version of the data, unreadable without the correct key.