Skip to content

refactor: pass explicit dest_dir for vault backup export#282

Merged
paolodamico merged 3 commits intomainfrom
feat/dir-arg-vault-export
Mar 11, 2026
Merged

refactor: pass explicit dest_dir for vault backup export#282
paolodamico merged 3 commits intomainfrom
feat/dir-arg-vault-export

Conversation

@thomas-waite
Copy link
Copy Markdown
Contributor

@thomas-waite thomas-waite commented Mar 10, 2026

Updates export_vault_for_backup() to take a file path to which the plaintext exported vault will be written - dest_dir.

Motivation

Previously, the plaintext vault export was written to WalletKit's own storage directory under Documents/worldid/. This meant that any orchestrator calling export_vault_for_backup(), e.g. an iOS native app, needs to copy the exported file themselves to the correct location from which any existing backup process would occur. This creates two copies of the unencrypted vault data which both need to be cleaned up.

By making dest_dir an arg, the caller can write the exported plaintext vault directly to the correct place. e.g. in a reference World App implementation, World App could write the vault export directly to Bedrock's filesystem without having to first copy the file over from WalletKit storage.

Further, this change means an integrator could pass a temporary directory as the location to write the vault export: #280


Note

Medium Risk
Public API/UniFFI signature change can break downstream callers and introduces new path-handling expectations (e.g., invalid or unwritable dest_dir).

Overview
Refactors plaintext vault backup export to require an explicit destination directory: CredentialStore::export_vault_for_backup(dest_dir) now writes vault_backup_plaintext.sqlite into the caller-provided folder instead of WalletKit’s own storage directory.

Updates internal implementation to build the export path from dest_dir + PLAINTEXT_VAULT_BACKUP_FILENAME, removes the StoragePaths::plaintext_vault_backup_path* helpers, and adjusts tests to create/clean up a dedicated export directory.

Written by Cursor Bugbot for commit ffba8c3. This will update automatically on new commits. Configure here.

@thomas-waite thomas-waite self-assigned this Mar 10, 2026
@thomas-waite thomas-waite changed the title refactor: require explicit dest_dir for vault backup export refactor: pass explicit dest_dir for vault backup export Mar 10, 2026
@thomas-waite
Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let backup_path = src_inner.export_vault_for_backup().expect("export vault");
// Export plaintext vault to a separate directory
let export_dir = temp_root_path();
std::fs::create_dir_all(&export_dir).expect("create export dir");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure we should panic here, why not expose the error?

@paolodamico paolodamico merged commit ca05928 into main Mar 11, 2026
16 checks passed
@paolodamico paolodamico deleted the feat/dir-arg-vault-export branch March 11, 2026 19:40
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.

2 participants