mirror of
https://github.com/kharonsec/SecurityArc
synced 2026-04-25 14:44:57 +02:00
3.1 KiB
3.1 KiB
SecureArc API Reference
This document provides detailed API documentation for developers integrating SecureArc into their applications.
Table of Contents
Core Library (securearc-core)
ArchiveWriter
Creates new SecureArc archives.
use securearc_core::archive::{ArchiveConfig, ArchiveWriter};
use securearc_core::format::{CompressionAlgorithm, EncryptionAlgorithm};
let config = ArchiveConfig {
max_attempts: 5,
encryption_algorithm: EncryptionAlgorithm::Aes256Gcm,
compression_algorithm: CompressionAlgorithm::Lzma2,
..Default::default()
};
let mut writer = ArchiveWriter::new(config);
writer.add_file("file.txt", PathBuf::from("file.txt"))?;
writer.write_to_file("archive.sarc", b"password")?;
ArchiveReader
Reads and extracts SecureArc archives.
use securearc_core::archive::ArchiveReader;
let mut reader = ArchiveReader::open("archive.sarc")?;
reader.unlock(b"password")?;
let files = reader.list_files()?;
for file in &files {
reader.extract_file(file, &output_path)?;
}
ArchiveConfig
Configuration for archive creation.
max_attempts: Maximum password attempts before destruction (3-99)encryption_algorithm: AES-256-GCM or ChaCha20-Poly1305compression_algorithm: LZMA2, Zstd, Brotli, or Nonekdf_params: Key derivation function parameters
ArchiveInfo
Information about an archive.
max_attempts: Maximum allowed attemptscurrent_attempts: Current failed attemptsremaining_attempts: Remaining attempts before destructiondestroyed: Whether archive has been destroyedfile_count: Number of files in archive
Error Handling
All operations return Result<T, SecureArcError> where errors include:
InvalidPassword: Wrong password providedMaxAttemptsExceeded: Archive destroyed due to too many attemptsArchiveDestroyed: Archive has been destroyedHeaderCorrupted: Security header is invalidIntegrityCheckFailed: HMAC verification failedFormatError: File format errorIoError: I/O operation failed
CLI Tool (securearc-cli)
The CLI tool provides command-line access to all SecureArc functionality. For complete documentation, see CLI Reference.
Create Archive
securearc-cli create -o archive.sarc file1.txt file2.txt --max-attempts 5
Extract Archive
securearc-cli extract archive.sarc -o output/
List Files
securearc-cli list archive.sarc
Archive Info
securearc-cli info archive.sarc
GUI Application (securearc-gui)
Tauri Commands
create_archive(request): Create a new archiveextract_archive(request): Extract files from archivelist_archive(request): List files in archiveget_archive_info(archive_path): Get archive information without password
All commands are async and return Result<T, String>.