This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 631
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3590 from input-output-hk/adinapoli/cbr-419/fix-l…
…ogic-bug [CBR-419] Enforce invariant on defaultHdAddressWith
- Loading branch information
Showing
3 changed files
with
50 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,28 @@ | ||
module Cardano.Wallet.Kernel.Decrypt | ||
( decryptAddress | ||
, decryptHdLvl2DerivationPath | ||
, keyToWalletDecrCredentials | ||
, WalletDecrCredentials | ||
, WalletDecrCredentialsKey(..) | ||
) where | ||
|
||
import Universum | ||
|
||
import Data.List ((!!)) | ||
|
||
import Pos.Wallet.Web.Tracking.Decrypt | ||
|
||
import Cardano.Wallet.Kernel.DB.HdWallet (HdAccountIx (..), | ||
HdAddressIx (..)) | ||
import Pos.Core (Address, aaPkDerivationPath, addrAttributesUnwrapped) | ||
import Pos.Crypto (HDPassphrase, unpackHDAddressAttr) | ||
|
||
|
||
decryptHdLvl2DerivationPath :: HDPassphrase | ||
-> Address | ||
-> Maybe (HdAccountIx, HdAddressIx) | ||
decryptHdLvl2DerivationPath hdPass addr = do | ||
hdPayload <- aaPkDerivationPath $ addrAttributesUnwrapped addr | ||
derPath <- unpackHDAddressAttr hdPass hdPayload | ||
guard $ length derPath == 2 | ||
pure (HdAccountIx (derPath !! 0), HdAddressIx (derPath !! 1)) |
This file contains 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