feat(external-signer): add data_prepare_upload for in-memory data#15
Merged
Nic-dorman merged 1 commit intomainfrom Mar 30, 2026
Merged
feat(external-signer): add data_prepare_upload for in-memory data#15Nic-dorman merged 1 commit intomainfrom
Nic-dorman merged 1 commit intomainfrom
Conversation
file_prepare_upload exists for file-based external signer flow but there was no equivalent for raw byte data (data_upload). This meant external signers could only upload files, not in-memory content. Add data_prepare_upload(content: Bytes) -> PreparedUpload that: 1. Encrypts content via self-encryption 2. Collects quotes for each chunk via prepare_chunk_payment() 3. Returns PreparedUpload with PaymentIntent for external signing The caller then signs externally and calls finalize_upload() with tx hashes — same phase 2 as file uploads. Also adds compile-time Send assertion for the new method. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mickvandijke
approved these changes
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
data_prepare_upload(content: Bytes) -> PreparedUploadto complete the external signer story for raw byte data.file_prepare_uploadexists for file-based two-phase uploads, but there was no equivalent for in-memory data (data_upload). This meant external signers (WalletConnect, hardware wallets, enterprise key management) could only use the two-phase flow for files on disk, not for raw bytes passed via the REST API.The fix
data_prepare_uploadmirrorsfile_prepare_uploadexactly:self_encryption::encryptprepare_chunk_payment()on each chunk (quotes, no payment)PreparedUploadwithPaymentIntentThe caller then signs externally and calls
finalize_upload()with tx hashes — same phase 2 as file uploads.No breaking changes
All existing methods work identically. This only adds a new public method.
Test plan
cargo check -p ant-corecleancargo test -p ant-core --lib— 108 tests pass (105 existing + 3 send assertions)data_prepare_uploaddata_prepare_upload→ external payment →finalize_upload🤖 Generated with Claude Code