Skip to content

feat: add passphrase-encrypted export and import - #7

Merged
iscekic merged 2 commits into
mainfrom
feat/encrypted-export
Nov 13, 2026
Merged

iscekic merged 2 commits into
mainfrom
feat/encrypted-export

Conversation

@iscekic

@iscekic iscekic commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

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.

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.
@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​age@​0.11.59710093100100
Addedcargo/​sha2@​0.10.910010093100100

View full report

@socket-security

Copy link
Copy Markdown

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.

Priority Alert  (click "▶" to expand/collapse) Action
Medium priority
License policy violation: cargo self_cell

License: LicenseRef-GPL-2.0-only-vsftpd-OpenSSL - The applicable license policy does not permit this license (5) (self_cell-1.3.0/LICENSE-GPLv2)

From: rust/Cargo.lock → cargo/age@0.11.5 → cargo/self_cell@1.3.0

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore cargo/self_cell@1.3.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn
Low priority
Potential security risk (AI signal): cargo age is 96.0% likely risky

Notes: The artifact is not executable source code and does not itself demonstrate malware. However, it exposes an AGE private key and a plaintext file key (YELLOW SUBMARINE), creating a serious confidentiality and credential-compromise risk. Revoke or rotate the AGE identity and file key, remove them from package contents and version history, and inspect the decrypted payload separately before use.

Confidence: 0.96

Severity: 0.78

From: rust/Cargo.lock → cargo/age@0.11.5

ℹ Read more on: This package | This alert | What are AI-detected potential security risks?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system identified potential security problems in this package. It is advised to review the package thoroughly and assess the potential risks before installation. You may also consider reporting the issue to the package maintainer or seeking alternative solutions with a stronger security posture.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore cargo/age@0.11.5. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn
Low priority
Potential security risk (AI signal): cargo block-buffer is 96.0% likely risky

Notes: No malicious behavior or supply-chain attack indicators are present. The code contains potentially serious unsafe-code defects: a lazy-path integer underflow for nonempty inputs shorter than one block, and insufficiently demonstrated alignment/layout validity when reinterpreting bytes as Block<N>. These issues should be fixed or proven with stronger invariants before use with untrusted input.

Confidence: 0.96

Severity: 0.72

From: rust/Cargo.lock → cargo/age@0.11.5 → cargo/sha2@0.10.9 → cargo/block-buffer@0.10.4

ℹ Read more on: This package | This alert | What are AI-detected potential security risks?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: An AI system identified potential security problems in this package. It is advised to review the package thoroughly and assess the potential risks before installation. You may also consider reporting the issue to the package maintainer or seeking alternative solutions with a stronger security posture.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore cargo/block-buffer@0.10.4. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn

View full report

@iscekic
iscekic merged commit 887915e into main Nov 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant