Skip to content

Commit

Permalink
Add warning to save seed before encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
gz-c committed Apr 22, 2018
1 parent da70625 commit 89b0f67
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ci-scripts/integration-test-live.sh
Expand Up @@ -14,7 +14,7 @@ RPC_ADDR="127.0.0.1:$RPC_PORT"
MODE="live"
TEST=""
UPDATE=""
TIMEOUT="5m"
TIMEOUT="10m"
# run go test with -v flag
VERBOSE=""
# run go test with -run flag
Expand Down Expand Up @@ -63,13 +63,13 @@ fi
if [[ -z $TEST || $TEST = "gui" ]]; then

SKYCOIN_INTEGRATION_TESTS=1 SKYCOIN_INTEGRATION_TEST_MODE=$MODE SKYCOIN_NODE_HOST=$HOST \
go test ./src/gui/integration/... $FAILFAST $UPDATE -timeout=3m $VERBOSE $RUN_TESTS $TEST_LIVE_WALLET
go test ./src/gui/integration/... $FAILFAST $UPDATE -timeout=$TIMEOUT $VERBOSE $RUN_TESTS $TEST_LIVE_WALLET

fi

if [[ -z $TEST || $TEST = "cli" ]]; then

SKYCOIN_INTEGRATION_TESTS=1 SKYCOIN_INTEGRATION_TEST_MODE=$MODE RPC_ADDR=$RPC_ADDR SKYCOIN_NODE_HOST=$HOST \
go test ./src/api/cli/integration/... $FAILFAST $UPDATE -timeout=3m $VERBOSE $RUN_TESTS $TEST_LIVE_WALLET
go test ./src/api/cli/integration/... $FAILFAST $UPDATE -timeout=$TIMEOUT $VERBOSE $RUN_TESTS $TEST_LIVE_WALLET

fi
22 changes: 22 additions & 0 deletions run-live-integration-test-node.sh
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# Runs the node with configuration necessary for running the live integration tests

set -x

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "skycoin binary dir:" "$DIR"
pushd "$DIR" >/dev/null

COMMIT=$(git rev-parse HEAD)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
GOLDFLAGS="-X main.Commit=${COMMIT} -X main.Branch=${BRANCH}"

go run -ldflags "${GOLDFLAGS}" cmd/skycoin/skycoin.go \
-gui-dir="${DIR}/src/gui/static/" \
-launch-browser=true \
-enable-wallet-api=true \
-enable-seed-api=true \
$@

popd >/dev/null
10 changes: 10 additions & 0 deletions src/gui/integration/integration_test.go
Expand Up @@ -1843,12 +1843,18 @@ func TestLivePendingTransactions(t *testing.T) {
}

func TestLiveWalletSpend(t *testing.T) {
fmt.Println("TestLiveWalletSpend")

if !doLive(t) {
return
}

fmt.Println("TestLiveWalletSpend live enabled")

requireWalletEnv(t)

fmt.Println("TestLiveWalletSpend required wallet env found")

c := gui.NewClient(nodeAddress())
w, totalCoins, _, password := prepareAndCheckWallet(t, c, 2e6, 2)

Expand Down Expand Up @@ -3077,6 +3083,10 @@ func prepareAndCheckWallet(t *testing.T, c *gui.Client, miniCoins, miniCoinHours
t.Fatalf("Load wallet %v failed: %v", walletPath, err)
}

if w.IsEncrypted() && password == "" {
t.Fatalf("Wallet is encrypted, must set WALLET_PASSWORD env var")
}

// Generate more addresses if address entries less than 2.
if len(w.Entries) < 2 {
_, err := c.NewWalletAddress(w.Filename(), 2-len(w.Entries), password)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/static/dist/index.html
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Skycoin</title><base href="/"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" type="image/x-icon" href="favicon.ico"><link href="styles.a44d4407dcffa726eab9.bundle.css" rel="stylesheet"/></head><body><app-root></app-root><script type="text/javascript" src="inline.318b50c57b4eba3d437b.bundle.js"></script><script type="text/javascript" src="polyfills.3a729e0e3b6954c3800a.bundle.js"></script><script type="text/javascript" src="scripts.8c1255aec48c8ec38c00.bundle.js"></script><script type="text/javascript" src="main.27e77aa8417043bbd56c.bundle.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Skycoin</title><base href="/"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" type="image/x-icon" href="favicon.ico"><link href="styles.a44d4407dcffa726eab9.bundle.css" rel="stylesheet"/></head><body><app-root></app-root><script type="text/javascript" src="inline.318b50c57b4eba3d437b.bundle.js"></script><script type="text/javascript" src="polyfills.3a729e0e3b6954c3800a.bundle.js"></script><script type="text/javascript" src="scripts.8c1255aec48c8ec38c00.bundle.js"></script><script type="text/javascript" src="main.94b3c1f81a98efa4f2c1.bundle.js"></script></body></html>

Large diffs are not rendered by default.

Expand Up @@ -26,6 +26,7 @@
<p class="-info">
We suggest that you encrypt each one of your wallets with a password.
If you forget your password, you can reset it with your seed.
Make sure you have your seed saved somewhere safe before encrypting your wallet.
</p>
</div>
<div class="col-md-6" [ngClass]="{ '-hidden': !encrypt }">
Expand Down
Expand Up @@ -50,7 +50,8 @@ export class WalletDetailComponent {

if (!this.wallet.encrypted) {
config.data['description'] = 'We suggest that you encrypt each one of your wallets with a password. ' +
'If you forget your password, you can reset it with your seed.';
'If you forget your password, you can reset it with your seed. ' +
'Make sure you have your seed saved somewhere safe before encrypting your wallet.';
}

this.dialog.open(PasswordDialogComponent, config).componentInstance.passwordSubmit
Expand Down

0 comments on commit 89b0f67

Please sign in to comment.