roxify 1.8.1 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "roxify_native"
3
- version = "1.8.1"
3
+ version = "1.9.0"
4
4
  edition = "2021"
5
5
  publish = false
6
6
 
Binary file
package/native/main.rs CHANGED
@@ -229,6 +229,15 @@ fn main() -> anyhow::Result<()> {
229
229
  }
230
230
  }
231
231
 
232
+ let png_data = std::fs::read(&input)?;
233
+ match png_utils::extract_file_list_from_pixels(&png_data) {
234
+ Ok(json) => {
235
+ println!("{}", json);
236
+ return Ok(());
237
+ }
238
+ Err(_) => {}
239
+ }
240
+
232
241
  eprintln!("No file list found in PNG");
233
242
  std::process::exit(1);
234
243
  }
@@ -190,3 +190,38 @@ fn extract_payload_direct(png_data: &[u8]) -> Result<Vec<u8>, String> {
190
190
  let payload = raw[idx..end].to_vec();
191
191
  Ok(payload)
192
192
  }
193
+
194
+ pub fn extract_file_list_from_pixels(png_data: &[u8]) -> Result<String, String> {
195
+ let raw = match decode_to_rgb(png_data) {
196
+ Ok(r) => r,
197
+ Err(_) => {
198
+ let reconst = crate::reconstitution::crop_and_reconstitute(png_data)?;
199
+ decode_to_rgb(&reconst)?
200
+ }
201
+ };
202
+ let pos = find_pixel_header(&raw)?;
203
+ let mut idx = pos + 4;
204
+ if idx + 2 > raw.len() { return Err("Truncated header".to_string()); }
205
+ idx += 1;
206
+ let name_len = raw[idx] as usize; idx += 1;
207
+ if idx + name_len > raw.len() { return Err("Truncated name".to_string()); }
208
+ idx += name_len;
209
+ if idx + 4 > raw.len() { return Err("Truncated payload length".to_string()); }
210
+ let payload_len = ((raw[idx] as u32) << 24)
211
+ | ((raw[idx+1] as u32) << 16)
212
+ | ((raw[idx+2] as u32) << 8)
213
+ | (raw[idx+3] as u32);
214
+ idx += 4;
215
+ idx += payload_len as usize;
216
+ if idx + 8 > raw.len() { return Err("No file list in pixel data".to_string()); }
217
+ if &raw[idx..idx + 4] != b"rXFL" { return Err("No rXFL marker in pixel data".to_string()); }
218
+ idx += 4;
219
+ let json_len = ((raw[idx] as u32) << 24)
220
+ | ((raw[idx+1] as u32) << 16)
221
+ | ((raw[idx+2] as u32) << 8)
222
+ | (raw[idx+3] as u32);
223
+ idx += 4;
224
+ let json_end = idx + json_len as usize;
225
+ if json_end > raw.len() { return Err("Truncated file list JSON".to_string()); }
226
+ String::from_utf8(raw[idx..json_end].to_vec()).map_err(|e| format!("Invalid UTF-8 in file list: {}", e))
227
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roxify",
3
- "version": "1.8.1",
3
+ "version": "1.9.0",
4
4
  "type": "module",
5
5
  "description": "Ultra-lightweight PNG steganography with native Rust acceleration. Encode binary data into PNG images with zstd compression.",
6
6
  "main": "dist/index.js",