@@ -26,9 +26,10 @@ import Cardano.Wallet.Primitive.AddressDerivation
2626 , Passphrase (.. )
2727 , PassphraseMaxLength (.. )
2828 , PassphraseMinLength (.. )
29+ , hex
2930 )
3031import Cardano.Wallet.Primitive.AddressDerivation.Byron
31- ( generateKeyFromSeed )
32+ ( ByronKey ( .. ), generateKeyFromSeed )
3233import Cardano.Wallet.Primitive.Mnemonic
3334 ( ConsistentEntropy
3435 , EntropySize
@@ -40,9 +41,7 @@ import Cardano.Wallet.Primitive.Mnemonic
4041 , mnemonicToText
4142 )
4243import Cardano.Wallet.Primitive.Types
43- ( Hash (.. ), SyncProgress (.. ) )
44- import Cardano.Wallet.Unsafe
45- ( unsafeFromHex )
44+ ( SyncProgress (.. ) )
4645import Control.Monad
4746 ( forM_ , void )
4847import Data.Generics.Internal.VL.Lens
@@ -61,6 +60,7 @@ import Test.Integration.Framework.DSL
6160 ( Context (.. )
6261 , Headers (.. )
6362 , Payload (.. )
63+ , emptyByronWalletFromXPrvWith
6464 , emptyByronWalletWith
6565 , emptyIcarusWallet
6666 , emptyRandomWallet
@@ -413,22 +413,26 @@ spec = do
413413 it " BYRON_RESTORE_10 - Can restore wallet using master root key" $ \ ctx -> do
414414 m <- genMnemonics @ 12
415415 let passw = " Secure Passphrase"
416- w <- emptyByronWalletWith ctx " random"
416+ w1 <- emptyByronWalletWith ctx " random"
417417 (" Byron Wallet" , m, passw)
418- rd <- request
419- @ ApiByronWallet ctx (Link. deleteWallet @ 'Byron w) Default Empty
418+ rd1 <- request
419+ @ ApiByronWallet ctx (Link. deleteWallet @ 'Byron w1) Default Empty
420+ expectResponseCode @ IO HTTP. status204 rd1
420421
421422 let (Right seed) = fromMnemonic @ '[12 ] m
422- let _rootXPrv =
423+ let rootXPrv = T. decodeUtf8 $ hex $ getKey $
423424 generateKeyFromSeed seed (Passphrase $ BA. convert $ T. encodeUtf8 passw)
424-
425- let _passwHash = Hash $ unsafeFromHex
426- " 31347c387c317c574342652b796362417576356c2b4258676a344a314c\
427- \6343675375414c2f5653393661364e576a2b7550766655513d3d7c2f37\
428- \6738486c59723174734e394f6e4e753253302b6a65515a6b5437316b45\
429- \414941366a515867386539493d"
430- expectResponseCode @ IO HTTP. status204 rd
431-
425+ let passwHash =
426+ " 31347c387c317c714968506842665966555a336f5156434c384449744b\
427+ \677642417a6c584d62314d6d4267695433776a556f3d7c53672b436e30\
428+ \4232766b4475682f704265335569694577633364385845756f55737661\
429+ \42514e62464443353569474f4135736e453144326743346f47564c472b\
430+ \524331385958326c6863552f36687a38432f496172773d3d"
431+ w2 <- emptyByronWalletFromXPrvWith ctx " random"
432+ (" Byron Wallet" , rootXPrv, passwHash)
433+ rd2 <- request
434+ @ ApiByronWallet ctx (Link. deleteWallet @ 'Byron w2) Default Empty
435+ expectResponseCode @ IO HTTP. status204 rd2
432436 where
433437 genMnemonics
434438 :: forall mw ent csz .
0 commit comments