Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding shared secret to output txo #926

Merged
merged 2 commits into from
Nov 1, 2023

Conversation

briancorbin
Copy link
Contributor

In this PR

An optional (for backwards compatibility with v1 json API) shared_secret field has been added to the service model for OutputTxo's. This enables us to re-decrypt the txo from the ledger, including its memo, at a future time when deemed necessary.

This will directly support the T3 integration by allowing authenticated sender memos of sent txos to be recorded

Test Plan

Unit tests

Future Work

Adjusting upstream PRs to utilize the new shared_secret information if available

@codecov-commenter
Copy link

Codecov Report

Attention: 281 lines in your changes are missing coverage. Please review.

Comparison is base (ab2af32) 60.12% compared to head (331a976) 54.83%.
Report is 147 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #926      +/-   ##
==========================================
- Coverage   60.12%   54.83%   -5.30%     
==========================================
  Files          88      116      +28     
  Lines       12356    14902    +2546     
  Branches     2010     2586     +576     
==========================================
+ Hits         7429     8171     +742     
- Misses       3238     4818    +1580     
- Partials     1689     1913     +224     
Files Coverage Δ
full-service/src/db/gift_code.rs 67.85% <100.00%> (+1.19%) ⬆️
full-service/src/json_rpc/v1/api/request.rs 76.98% <100.00%> (-1.59%) ⬇️
...service/src/json_rpc/v1/models/receiver_receipt.rs 77.77% <ø> (+0.99%) ⬆️
full-service/src/json_rpc/v1/models/tx_proposal.rs 73.56% <100.00%> (+0.30%) ⬆️
full-service/src/json_rpc/v1/models/txo.rs 57.27% <100.00%> (+2.72%) ⬆️
full-service/src/json_rpc/v2/api/test_utils.rs 84.61% <100.00%> (ø)
full-service/src/json_rpc/v2/models/account.rs 46.42% <ø> (-2.23%) ⬇️
full-service/src/json_rpc/v2/models/account_key.rs 47.05% <ø> (+0.76%) ⬆️
...ll-service/src/json_rpc/v2/models/masked_amount.rs 50.00% <ø> (-4.55%) ⬇️
...l-service/src/json_rpc/v2/models/network_status.rs 55.00% <ø> (-1.25%) ⬇️
... and 44 more

... and 47 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eranrund
Copy link
Contributor

Is there a reason this needs to be stored in the database?
Unless I'm mistaken, it can always be calculated since you have the private view key and the txo pubkey.

@briancorbin
Copy link
Contributor Author

briancorbin commented Oct 31, 2023

Is there a reason this needs to be stored in the database? Unless I'm mistaken, it can always be calculated since you have the private view key and the txo pubkey.

I should have added that this is necessary for a txo that you don't own, which can be created with either the txo_private_key (at the time of generating the txo) + recipients view public key (in the public address of the recipient) OR the txo_public_key (available on the txo itself) + recipients view private key (which requires the private account keys). So as far as I can tell, one cannot derive the shared secret after it's created if it's not going to an owned account.

@briancorbin
Copy link
Contributor Author

briancorbin commented Nov 1, 2023

Is there a reason this needs to be stored in the database? Unless I'm mistaken, it can always be calculated since you have the private view key and the txo pubkey.

This is for the shared secret of a txo that you don't own (output of a transaction), which can be created with either the txo_private_key (at the time of generating the txo) + recipients view public key (in the public address of the recipient) OR the txo_public_key (available on the txo itself) + recipients view private key (which requires the private account keys).

https://github.com/mobilecoinfoundation/mobilecoin/blob/08d9f69d0c7e27faabbb0127912b330910239eae/transaction/builder/src/transaction_builder.rs#L868-L888

for reference (including just for clarity in case I'm missing something)

@eranrund
Copy link
Contributor

eranrund commented Nov 1, 2023

Gotcha, yeah, I missed that this is for TxOuts you are sending.

@briancorbin
Copy link
Contributor Author

Gotcha, yeah, I missed that this is for TxOuts you are sending.

😅 oh thank goodness, for a second I thought I was going crazy, hahah. Thanks so much!

@briancorbin briancorbin merged commit 4f2ef9b into main Nov 1, 2023
@briancorbin briancorbin deleted the feature/add-shared-secret-to-tx-outputs branch November 1, 2023 01:35
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.

3 participants