-
Notifications
You must be signed in to change notification settings - Fork 101
feat(coinjoin): support encrypted wallets #196
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
feat(coinjoin): support encrypted wallets #196
Conversation
* include tests for these methods
* fix: NPE's
* previous action was to stop CoinJoin
package org.bitcoinj.coinjoin.callbacks; | ||
|
||
import org.bitcoinj.core.ECKey; | ||
|
||
public interface RequestDecryptedKey { | ||
ECKey requestDecryptedKey(ECKey encryptedKey); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This call will decrypt a single key.
package org.bitcoinj.coinjoin.callbacks; | ||
|
||
import org.bitcoinj.wallet.Wallet; | ||
import org.bouncycastle.crypto.params.KeyParameter; | ||
|
||
public interface RequestKeyParameter { | ||
KeyParameter requestKeyParameter(Wallet wallet); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This call back will obtain the key parameter (encryption key) for the wallet. used with SendRequest
s.
|
||
public void setRequestKeyParameter(RequestKeyParameter requestKeyParameter) { | ||
this.requestKeyParameter = requestKeyParameter; | ||
} | ||
|
||
public void setRequestDecryptedKey(RequestDecryptedKey requestDecryptedKey) { | ||
this.requestDecryptedKey = requestDecryptedKey; | ||
} | ||
|
||
public @Nullable KeyParameter requestKeyParameter(WalletEx mixingWallet) { | ||
return requestKeyParameter != null ? requestKeyParameter.requestKeyParameter(mixingWallet) : null; | ||
} | ||
|
||
public @Nullable ECKey requestDecryptKey(ECKey key) { | ||
return requestDecryptedKey != null ? requestDecryptedKey.requestDecryptedKey(key) : null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CoinJoinManager
will keep track of the callbacks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In DashPay, we will use these functions like this:
interface CoinJoinService {
fun configureMixing(
amount: Coin,
requestKeyParameter: RequestKeyParameter,
requestDecryptedKey: RequestDecryptedKey
)
}
if (blockchainIdentityData.creationState <= CreationState.MIXING_FUNDS) {
platformRepo.updateIdentityCreationState(blockchainIdentityData, CreationState.MIXING_FUNDS)
coinJoinService.configureMixing(
Constants.DASH_PAY_FEE,
{ encryptionKey },
{ it.decrypt(encryptionKey) })
coinJoinService.prepareAndStartMixing()
coinJoinService.waitForMixing();
}
There is a problem with one of the tests due to a Context mismatch on Linux and not Mac. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great
Issue being fixed or feature implemented
What was done?
How Has This Been Tested?
Breaking Changes
Checklist:
For repository code-owners and collaborators only