crabstep

Crates.iocrabstep
lib.rscrabstep
version0.3.2
created_at2025-06-23 22:47:59.786258+00
updated_at2025-08-29 18:41:36.829048+00
descriptionCross-platform, zero-dependency Apple/NeXTSTEP typedstream deserializer
homepage
repositoryhttps://github.com/ReagentX/crabstep
max_upload_size
id1723638
size1,212,695
Christopher Sardegna (ReagentX)

documentation

README

crabstep

crabstep is a Rust library that deserializes Apple's typedstream data into cross-platform data structures.

Overview

The typedstream format is a binary serialization protocol designed for C and Objective-C data structures. It is primarily used in Apple's Foundation framework, specifically within the NSArchiver and NSUnarchiver classes.

Installation

This library is available on crates.io.

Documentation

Documentation is available on docs.rs.

Quick Start

use std::{env::current_dir, fs::File, io::Read};

use crabstep::TypedStreamDeserializer;

// Read the typedstream file into memory
let typedstream_path = current_dir()
    .unwrap()
    .as_path()
    .join("path/to/typedstream/file");
let mut file = File::open(typedstream_path).unwrap();
let mut bytes = vec![];
file.read_to_end(&mut bytes).unwrap();

// Create a deserializer
let mut typedstream = TypedStreamDeserializer::new(&bytes);

// Iterate over the typedstream's properties
typedstream.iter_root()
    .unwrap()
    .for_each(|prop| println!("{:#?}", prop))

Detailed examples

This crate is heavily leveraged by imessage-database's body module.

Origin

The typedstream format is derived from the data structure used by NeXTSTEP's NXTypedStream APIs.

Features

  • Pure Rust implementation for efficient and safe deserialization
  • No dependencies on Apple frameworks
  • Robust error handling for malformed or incomplete typedstream data
  • Ergonomic TypedStreamDeserializer with resolve_properties iterator for exploring object graphs

Reverse Engineering

A blog post describing the reverse engineering of typedstream is available as an in-depth article.

Ferris

Ferris the crab walking along a hexadecimal path

Commit count: 85

cargo fmt