lightninglabs / taproot-assets

A layer 1 daemon, for the Taproot Assets Protocol specification, written in Go (golang)
MIT License
463 stars 111 forks source link

proof: implement encrypted proof payload for hashmail and other mailbox based couriers #478

Open Roasbeef opened 1 year ago

Roasbeef commented 1 year ago

Background

Today we use the hashmail courier to send proofs from sender to receiver. One unresolved TODO is to use an encryption scheme to preserve privacy between the sender and receiver: https://github.com/lightninglabs/taproot-assets/blob/4a0a16cc166f4bab1819947a7eba4ec368779b15/proof/courier.go#L571-L583

This can be generalized to other mailbox-like transports such as nostr.

In the TODO above, I propose using the Elliptic Curve Integrated Encryption Scheme (ECIES), which is a hybrid encryption scheme. In our domain, we can use the script key of the receiver as the main DH point, with the sender generating an ephemeral secret themselves, then doing DH between this points to derive a secret key. The secret key would then be used to encrypt the payload with an AEAD scheme. The final payload is the ephemeral DH point, concatenated with the AEAD payload.

Steps To Completion

jharveyb commented 10 months ago

Instead of an ephemeral secret on the sender side, could we use the private key from one of the keys already being used by the sender during the transfer? Like the top-level taproot key for the first input to the TX.

Then we could address #740 by both parties computing a DH point from those keys and use that to derive a hashmail stream ID / mailbox address.