Skip to content

Conversation

KtorZ
Copy link
Contributor

@KtorZ KtorZ commented Jan 19, 2021

This PR re-enables wallet import feature.

Todos

Screenshots

Screenshot 2021-02-11 at 14 49 56
Screenshot 2021-02-11 at 14 49 48

Screenshot 2021-02-11 at 14 45 40
Screenshot 2021-02-11 at 14 46 14
Screenshot 2021-02-11 at 14 45 42
Screenshot 2021-02-11 at 14 46 15
Screenshot 2021-02-11 at 14 46 02
Screenshot 2021-02-11 at 14 46 34
Screenshot 2021-02-10 at 13 54 35
Screenshot 2021-02-10 at 13 37 06

Test checklist

  • Try to import wallets from the following secret.key file (unfortunately, I only know the password for the Wallet#4: Secret123)
    Screenshot 2021-02-11 at 10 50 46

Test cases

Scenario 1: Found wallet screen
Given I am on import wallet screen
And I have selected ‘Import’
And I have selected import from (Daedalus state directory|Daedalus ‘secret.key’ file)
And I have selected the correct path
When I select ‘Import Wallets’ button
Then the ‘Found wallets’ screen is displayed

Scenario 2: Rename, select and import wallets
Given I am on import wallet screen
And I have selected ‘Import’
And I have selected import from (Daedalus state directory|Daedalus ‘secret.key’ file) 
And I have selected the correct path
And I have selected ‘Import Wallets’
And I am on ‘Found wallets’ screen
When I name the wallet
And tick the checkbox next to the named wallet
And I select ‘Import selected wallets’ button
Then the wallet could be seen syncing

Scenario 3: Incorrect path/file selected
Given I am on import wallet screen
And I have selected ‘Import’
And I have selected import from (Daedalus state directory|Daedalus ‘secret.key’ file)
And I have selected the incorrect (path|file)
Then error displayed is ‘No wallets found. Make sure you have selected a Daedalus state directory which contains the ‘Secrets’ or ‘Secrets-1.0’ folder with a ‘secret.key’ file inside’ ’

Scenario 4: Correct spending password
Given I have successfully restored a wallet via Import function
And I have the wallet spending password
When I change the spending password
Then it will be successful

Documentation

Developed it as a standalone library, feel free to rip it apart the way you like.

restore-keystore
├── index.spec.ts
├── index.ts
├── jest.config.ts
├── LICENSE
├── NOTICE
├── package.json
├── package-lock.json
└── __test__
    └── secret.key

It's shipped with a default test keystore that I've been previously using on input-output-hk/cardano-sl#4278 and a test suite which controls that this new implementation yield the same results.

> restore-keystore@1.0.0 test /home/ktorz/Documents/IOHK/restore-keystore
> jest

 PASS  ./index.spec.ts
  walletId
    ✓ 0 (2 ms)
    ✓ 1
    ✓ 2 (1 ms)
    ✓ 3
  encryptedPayload
    ✓ 0
    ✓ 1 (1 ms)
    ✓ 2
    ✓ 3
  passphraseHash
    ✓ 0 (1 ms)
    ✓ 1
    ✓ 2
    ✓ 3
  isEmptyPassphrase
    ✓ 0
    ✓ 1
    ✓ 2
    ✓ 3

Test Suites: 1 passed, 1 total
Tests:       16 passed, 16 total
Snapshots:   0 total
Time:        2.3 s, estimated 3 s
Ran all test suites.

The magic is yours now and should help resolving #1234.

PS: Sorry I ditched away the PR template, it's rude but I guess I am a bit rude myself.

    Developed it as a standalone library, feel free to rip it apart the way
    you like.

    ```
    restore-keystore
    ├── index.spec.ts
    ├── index.ts
    ├── jest.config.ts
    ├── LICENSE
    ├── NOTICE
    ├── package.json
    ├── package-lock.json
    └── __test__
        └── secret.key
    ```

    It's shipped with a default test keystore that I've been previously
    using on input-output-hk/cardano-sl#4278 and a test suite which controls
    that this new implementation yield the same results.

    ```console
    > restore-keystore@1.0.0 test /home/ktorz/Documents/IOHK/restore-keystore
    > jest

     PASS  ./index.spec.ts
      walletId
        ✓ 0 (2 ms)
        ✓ 1
        ✓ 2 (1 ms)
        ✓ 3
      encryptedPayload
        ✓ 0
        ✓ 1 (1 ms)
        ✓ 2
        ✓ 3
      passphraseHash
        ✓ 0 (1 ms)
        ✓ 1
        ✓ 2
        ✓ 3
      isEmptyPassphrase
        ✓ 0
        ✓ 1
        ✓ 2
        ✓ 3

    Test Suites: 1 passed, 1 total
    Tests:       16 passed, 16 total
    Snapshots:   0 total
    Time:        2.3 s, estimated 3 s
    Ran all test suites.
    ```

    The magic is yours now and should help resolving #1234.
@nikolaglumac nikolaglumac changed the title Add utility code for decoding legacy keystores from cardano-sl [DDW-563] Re-enable wallet import feature Feb 6, 2021
  Can be used directly (after `npm install`) as an executable, e.g.:

  ```
  $ ./restore-keystore.ts __test__/secret.key
  [...]
  ```

  ```
  $ ./restore-keystore.ts $HOME/.local/share/Daedalus/mainnet/Secrets/secret.key
  [...]
  ```
@nikolaglumac nikolaglumac added release-3.3.0 Daedalus Mainnet and removed ⏳release-vNext WIP labels Feb 11, 2021
@nikolaglumac nikolaglumac requested a review from a team February 11, 2021 13:47
Copy link

@miorsufianiohk miorsufianiohk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Tested on Mac:Mainnet, Linux:Flight, Windows:Flight on build 16404. Great work @nikolaglumac 👍

@nikolaglumac nikolaglumac merged commit 7cb5032 into develop Feb 11, 2021
@iohk-bors iohk-bors bot deleted the KtorZ/1234/legacy-keystore branch February 11, 2021 14:42
@jsindy
Copy link

jsindy commented Feb 11, 2021

Where can I download this build from?

@nikolaglumac
Copy link
Contributor

Where can I download this build from?

@jsindy please wait for it to be officially released on https://daedaluswallet.io/en/flight/
We can not share any unofficial and unsigned builds.

@jsindy
Copy link

jsindy commented Feb 11, 2021

understood, any docs on building from source?

@nikolaglumac
Copy link
Contributor

understood, any docs on building from source?

You can try these steps:

  1. Installation: https://github.com/input-output-hk/daedalus#installation
  2. Running Daedalus Mainnet locally: https://github.com/input-output-hk/daedalus#mainnet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature release-3.3.0-FC1 Daedalus Flight release-3.3.0 Daedalus Mainnet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants