npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@majikah/majik-file-client

v0.1.1

Published

Post-quantum file encryption client for Majik File (.mjkb). Client-side ML-KEM-768 and AES-256-GCM file processing, streaming, zero-knowledge security, and storage metadata routing.

Readme

Majik File Client

Post-quantum file encryption client for Majik File (.mjkb). Client-side ML-KEM-768 and AES-256-GCM file processing, streaming, zero-knowledge security, and storage metadata routing.

Overview

@majikah/majik-file-client is a high-level wrapper and client orchestrator for the Majik ecosystem. It brings together identity management, post-quantum file encryption (.mjkb), cryptographic signing, contact directories, and zero-knowledge file vault storage into a single, cohesive TypeScript interface.

This library is designed for seamless integration into web apps, desktop wrappers (Electron/Tauri), and local-first browser environments.

Features

  • Post-Quantum Cryptography: Encrypt and decrypt files using ML-KEM-768 and AES-256-GCM.
  • Zero-Knowledge File Storage: Manage local file vaults (MajikFileVaultManager) and client state seamlessly.
  • Integrated Identity & Keystore: Built on top of @majikah/majik-key-client for seamless account creation, unlocking, and active-account tracking.
  • Contact Directory: Built-in MajikContactManager for managing trusted identities, groups, favorites, and blocked contacts.
  • Advanced File Signatures: Detached, embedded, multi-sig, and timestamped (TSA) file signing.
  • Audit Logging: Built-in HistoryLogManager and UserActivityLogManager to keep an immutable, localized trail of cryptographic operations and user actions.
  • Compression: Integrated zstd compression via fflate.

Installation

npm install @majikah/majik-file-client

Architecture

The core of this package is the MajikFileClient (which extends MajikKeyClient). It serves as the primary entry point to coordinate the following domains:

  • MajikContactManager: Directory for user contacts.
  • MajikFileVaultItemVaultManager: Local storage interface for encrypted items.
  • ClientStateManager: User app preferences and runtime states.
  • HistoryLogManager / UserActivityLogManager: Action auditing.

Quick Start & Usage

1. Initialization and Hydration

import { MajikFileClient, InMemoryFileVaultAdapter } from "@majikah/majik-file-client";

// Initialize the client with storage adapters (defaults to in-memory if omitted)
const client = new MajikFileClient({
  adapters: {
    vault: new InMemoryFileVaultAdapter(),
    // add indexedDB adapters for contacts, history, etc.
  }
});

// Hydrate state, keys, and contacts from storage on startup
await client.hydrate();

2. Encrypting a File

Encrypt a binary file to the .mjkb format. You can optionally sign it during encryption.

const fileData = new Uint8Array([...]);

const result = await client.encryptFile({
  data: fileData,
  originalName: "confidential_report.pdf",
  mimeType: "application/pdf",
  sign: true, // Automatically signs with the active account's keys
  recipients: ["recipient_public_key_address"]
});

// result.binary contains the encrypted .mjkb bytes
// result.metadata contains routing/decryption metadata

3. Decrypting a File

Decrypt a .mjkb binary. The client automatically cycles through your unlocked owned accounts to find the correct decryption key.

const mjkbBytes = new Uint8Array([...]);
const metadata = { /* fetched from server/storage */ };

const { bytes, originalName, mimeType, signature } = await client.decryptFile({
  source: mjkbBytes,
  metadata
});

console.log(`Decrypted ${originalName} (${mimeType})`);
if (signature) {
  console.log("File contains a signature from:", signature.signerId);
}

4. Cryptographic Signing & Verification

Sign a File:

const pdfBlob = new Blob([pdfBytes], { type: "application/pdf" });

// Creates a signed file with an embedded signature envelope
const { blob, signature } = await client.signFile(pdfBlob, {
  mimeType: "application/pdf"
});

Verify a File:

// Verifies embedded signatures against the active contact directory or self-reported keys
const verifyResult = await client.verifyFile(signedBlob);

if (verifyResult.valid) {
  console.log(`Signature is valid. Signed by: ${verifyResult.signerLabel || verifyResult.signerId}`);
}

5. Multi-sig and File Sealing

The client fully supports restricting multi-sig files and "sealing" them to prevent further signatures.

// Seal a file to finalize the signature envelope
const { blob, sealInfo } = await client.seal(multiSignedBlob);
console.log("File sealed at:", sealInfo.sealTimestamp);

// Check seal status
const isSealed = await client.isSealed(blob);

6. Managing the Local Vault (In-app Storage)

The Vault securely stores local files, keeping them encrypted at rest using the active account's identity.

// Add a file to the vault
const vaultItem = await client.addVaultFile(secretImageBytes, "secret_image.png", {
  mimeType: "image/png"
});

// Retrieve and decrypt
const decryptedBytes = await client.decryptStampContent(vaultItem.id);

Event Listening

The client extends an EventEmitter, allowing you to react to lifecycle events.

client.on("new-contact", (contact) => {
  console.log("A new contact was added:", contact.id);
});

client.on("sign", (result) => {
  console.log("Content signed successfully. Hash:", result.contentHash);
});

client.on("error", (err, context) => {
  console.error("Client Error in", context, err);
});

License

Apache-2.0 — free for personal and commercial use.


Author

Made with 💙 by @thezelijah

About the Developer


Contact