Skip to content

Commit

Permalink
Add Wallet Import helper page
Browse files Browse the repository at this point in the history
  • Loading branch information
guggero committed Apr 27, 2019
1 parent eed2d89 commit fe08601
Show file tree
Hide file tree
Showing 10 changed files with 385 additions and 54 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ paste sensitive information into. So consider yourself warned.
* [Transaction Creator page](https://guggero.github.io/cryptography-toolkit/#!/transaction-creator)
* [aezeed Cipher Seed Scheme page](https://guggero.github.io/cryptography-toolkit/#!/aezeed)
* [Macaroons page](https://guggero.github.io/cryptography-toolkit/#!/macaroon)
* [Wallet Import helper page](https://guggero.github.io/cryptography-toolkit/#!/wallet-import)

## Send Thanks

Expand Down
3 changes: 3 additions & 0 deletions app.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<li ng-class="{active: $root.isActive('/transaction-creator')}">
<a href="#!/transaction-creator">Transaction Creator</a>
</li>
<li ng-class="{active: $root.isActive('/wallet-import')}">
<a href="#!/wallet-import">Wallet Import helper</a>
</li>
</ul>
</li>
<li class="dropdown">
Expand Down
1 change: 1 addition & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function routeConfig($locationProvider, $routeProvider) {
.when('/transaction-creator', {template: '<transaction-creator-page></transaction-creator-page>', containerClass: 'container'})
.when('/aezeed', {template: '<aezeed-page></aezeed-page>', containerClass: 'container'})
.when('/macaroon', {template: '<macaroon-page></macaroon-page>', containerClass: 'container'})
.when('/wallet-import', {template: '<wallet-import-page></wallet-import-page>', containerClass: 'container'})
.otherwise({redirectTo: '/'})
}

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<script src="pages/schnorr/schnorr.js"></script>
<script src="pages/transaction-creator/transaction-creator.js"></script>
<script src="pages/aezeed/aezeed.js"></script>
<script src="pages/macaroon/macaroon.js"></script>
<script src="pages/wallet-import/wallet-import.js"></script>

<title>Cryptography Toolkit</title>
</head>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cryptography-toolkit",
"version": "1.0.0",
"version": "1.1.0",
"main": "browserify.js",
"repository": "[email protected]:guggero/cryptography-toolkit.git",
"author": "Oliver Gugger <[email protected]>",
Expand Down
58 changes: 28 additions & 30 deletions pages/hd-wallet/hd-wallet.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,36 +159,34 @@ <h4>BIP44 key derivation</h4>
<!-- derive -->
<div class="form-group">
<label class="col-sm-3 control-label">BIP44 parameters to derive keys:</label>
<div class="col-sm-9">
<div class="input-group">
<div class="input-group-addon">Coin type</div>
<select ng-model="vm.coinType"
ng-options="coin.label for coin in vm.coinTypes"
ng-change="vm.fromNode()"
class="form-control">
</select>
<div class="input-group-addon">Account</div>
<input class="form-control"
ng-model="vm.account"
ng-change="vm.calculatePath()"
type="number">
<div class="input-group-addon">Change</div>
<input class="form-control"
ng-model="vm.change"
ng-change="vm.calculatePath()"
type="number">
<div class="input-group-addon">Index</div>
<input class="form-control"
ng-model="vm.index"
ng-change="vm.calculatePath()"
type="number">
</div>
<div class="input-group">
<div class="input-group-addon">Path</div>
<input class="form-control"
ng-model="vm.path"
ng-change="vm.fromPath()">
</div>
<div class="col-sm-9 input-group">
<div class="input-group-addon">Coin type</div>
<select ng-model="vm.coinType"
ng-options="coin.label for coin in vm.coinTypes"
ng-change="vm.fromNode()"
class="form-control">
</select>
<div class="input-group-addon">Account</div>
<input class="form-control"
ng-model="vm.account"
ng-change="vm.calculatePath()"
type="number">
<div class="input-group-addon">Change</div>
<input class="form-control"
ng-model="vm.change"
ng-change="vm.calculatePath()"
type="number">
<div class="input-group-addon">Index</div>
<input class="form-control"
ng-model="vm.index"
ng-change="vm.calculatePath()"
type="number">
</div>
<div class="col-sm-offset-3 col-sm-9 input-group">
<div class="input-group-addon">Path</div>
<input class="form-control"
ng-model="vm.path"
ng-change="vm.fromPath()">
</div>
</div>

Expand Down
31 changes: 9 additions & 22 deletions pages/hd-wallet/hd-wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,16 @@ angular
bindings: {}
});

var PBKDF2_SALT = 'Digital Bitbox',
PBKDF2_HMACLEN = 64,
PBKDF2_ROUNDS_APP = 20480;

var METHOD_NONE = 0,
METHOD_PBKDF2 = 1,
METHOD_COINOMI = 2;

function HdWalletPageController(lodash, bitcoinNetworks) {
var vm = this;

var BITCOIN = lodash.find(bitcoinNetworks, ['label', 'BTC (Bitcoin)']);
var BITCOIN_TESTNET = lodash.find(bitcoinNetworks, ['label', 'BTC (Bitcoin Testnet)']);
var PIVX = lodash.find(bitcoinNetworks, ['label', 'PIVX (PIVX)']);
var PIVX_TESTNET = lodash.find(bitcoinNetworks, ['label', 'PIVX (PIVX Testnet)']);
var ION = lodash.find(bitcoinNetworks, ['label', 'ION (Ion)']);
var ION_TESTNET = lodash.find(bitcoinNetworks, ['label', 'ION (Ion Testnet)']);
var SLATE = lodash.find(bitcoinNetworks, ['label', 'SLX (Slate)']);
var SLATE_TESTNET = lodash.find(bitcoinNetworks, ['label', 'SLX (Slate Testnet)']);
var OBSERVER = lodash.find(bitcoinNetworks, ['label', 'OBSR (Observer)']);
var OBSERVER_TESTNET = lodash.find(bitcoinNetworks, ['label', 'OBSR (Observer Testnet)']);
var WAGERR = lodash.find(bitcoinNetworks, ['label', 'WGR (Wagger)']);
var WAGERR_TESTNET = lodash.find(bitcoinNetworks, ['label', 'WGR (Wagerr Testnet)']);
const vm = this;

const PBKDF2_SALT = 'Digital Bitbox',
PBKDF2_HMACLEN = 64,
PBKDF2_ROUNDS_APP = 20480;
const METHOD_NONE = 0,
METHOD_PBKDF2 = 1,
METHOD_COINOMI = 2;
const BITCOIN = lodash.find(bitcoinNetworks, ['label', 'BTC (Bitcoin)']);

vm.coinTypes = bitcoinNetworks;
vm.coinType = BITCOIN;
Expand Down
1 change: 1 addition & 0 deletions pages/intro/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ <h2>Tools</h2>
<li><a href="#!/transaction-creator">Transaction Creator page</a></li>
<li><a href="#!/aezeed">aezeed Cipher Seed Scheme page</a></li>
<li><a href="#!/macaroon">Macaroons page</a></li>
<li><a href="#!/wallet-import">Wallet Import helper page</a></li>
</ul>

<p class="pull-right">
Expand Down
110 changes: 110 additions & 0 deletions pages/wallet-import/wallet-import.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<h1>Import HD wallet into Bitcoin Core</h1>

<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a ng-click="vm.showExplanation = !vm.showExplanation">Explanation</a>
</h4>
</div>
<div class="panel-collapse collapse" ng-class="{in: vm.showExplanation}">
<div class="panel-body">
Currently, there is no easy way to import addresses from a HD seed that has been created by another software into Bitcoin Core.<br/>
This tool helps you do that.
</div>
</div>
</div>

<h4>Import HD wallet</h4>
<div class="well">
<form class="form-horizontal">

<!-- mnemonic -->
<div class="form-group">
<label class="col-sm-3 control-label">Seed Mnemonic (BIP39):</label>
<div class="col-sm-9 input-group">
<input class="form-control" ng-model="vm.mnemonic" ng-change="vm.fromMnemonic()">
<span class="input-group-addon">&lt;-- paste here to import.</span>
</div>
</div>

<!-- passphrase -->
<div class="form-group">
<label class="col-sm-3 control-label">Passphrase:</label>
<div class="col-sm-9 input-group">
<input class="form-control"
ng-model="vm.passphrase"
ng-change="vm.fromMnemonic()"
type="{{vm.asPassword ? 'password' : 'text'}}">
<span class="input-group-btn">
<button class="btn btn-primary" ng-click="vm.asPassword = !vm.asPassword">
{{vm.asPassword ? 'Show' : 'Hide'}} passphrase
</button>
</span>
<div class="input-group-addon">Method</div>
<select ng-model="vm.strenghtening"
ng-change="vm.fromMnemonic()"
ng-options="s.label for s in vm.strenghteningMethods"
class="form-control">
</select>
</div>
</div>

<!-- derive -->
<div class="form-group">
<label class="col-sm-3 control-label">Parameters to derive keys:</label>
<div class="col-sm-9 input-group">
<select ng-model="vm.scheme"
ng-options="scheme.label for scheme in vm.schemes"
ng-change="vm.fromSeed()"
class="form-control">
</select>
</div>
</div>

<!-- root key base58 -->
<div class="form-group">
<label class="col-sm-3 control-label">HD master root key:</label>
<div class="col-sm-9 input-group as-block">
<input class="form-control" value="{{vm.nodeBase58}}" ng-readonly="true">
</div>
</div>

<!-- import type -->
<div class="form-group">
<label class="col-sm-3 control-label">Import parameters:</label>
<div class="col-sm-9 input-group">
<div class="input-group-addon">Import type</div>
<select ng-model="vm.importType" ng-options="type.label for type in vm.importTypes" class="form-control">
</select>
<div class="input-group-addon">Start Path</div>
<input class="form-control" ng-model="vm.path">
</div>
<div class="col-sm-offset-3 col-sm-9 input-group">
<div class="input-group-addon">Change (_chg_): Start value</div>
<input class="form-control" ng-model="vm.changeStart">
<div class="input-group-addon">End value</div>
<input class="form-control" ng-model="vm.changeEnd">
</div>
<div class="col-sm-offset-3 col-sm-9 input-group">
<div class="input-group-addon">Index (_idx_): Start value</div>
<input class="form-control" ng-model="vm.indexStart">
<div class="input-group-addon">End value</div>
<input class="form-control" ng-model="vm.indexEnd">
</div>
</div>

<div class="form-group">
<div class="col-sm-offset-3 col-sm-9 input-group">
<button class="btn btn-primary" ng-click="vm.createExport()">Create export</button>
</div>
</div>

<!-- result -->
<div class="form-group" ng-if="vm.result">
<div class="col-sm-12 input-group">
<textarea rows="50" ng-readonly="true" class="form-control" style="white-space: pre">{{vm.result}}</textarea>
</div>
</div>
</form>
</div>

Loading

0 comments on commit fe08601

Please sign in to comment.