Repository navigation
feat: add passphrase-encrypted export and import - #7
Conversation
The core gains encrypt_export and decrypt_export, which write and read age v1 files encrypted to an scrypt passphrase recipient in ASCII armor, so a backup can leave the device over any channel and the age CLI can open it. WrongPassphrase reports a failed file-key unwrap and InvalidExport covers a file that is not an age file, is damaged, or exceeds the 16 MiB payload cap; a passphrase shorter than 8 characters when encrypting is rejected the same way. The work factor is fixed at 18, age's default, so a file made on a fast device still opens on a slow one and the scrypt allocation stays at 256 MiB. Kotlin and Swift expose both calls as AsyncFunctions, which run on the module's background queue, and the TypeScript API adds encryptExport and decryptExport.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Adds encryptExport and decryptExport: the Rust core seals a payload with an age passphrase recipient (scrypt, ASCII armor) and opens it again. The payload format is the app's concern. A wrong passphrase reports WrongPassphrase; a damaged, truncated or foreign file reports the new InvalidExport category. Encryption requires a passphrase of at least 8 characters and caps the payload at 16 MiB. Both calls run off the JavaScript thread.
The scrypt work factor is fixed at 18, the age CLI default, so files move between this library and the age CLI in both directions.
Verified: Rust tests (round trip, wrong passphrase, tampering, truncation, foreign input, limits, and interop with the age 1.1.1 CLI both ways), the Android build, and the TypeScript checks. The macOS CI job verifies the iOS build.