Add the boilerplate for a card wallet
This commit is contained in:
parent
9bb9bc9873
commit
077019dfc7
5 changed files with 168 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
node_modules
|
node_modules
|
||||||
not_versioned
|
not_versioned
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
*~
|
||||||
|
|
|
@ -32,10 +32,11 @@ module.exports = function (grunt) {
|
||||||
{ token: "//ninja.translator.js", file: "./src/ninja.translator.js" },
|
{ token: "//ninja.translator.js", file: "./src/ninja.translator.js" },
|
||||||
{ token: "//ninja.singlewallet.js", file: "./src/ninja.singlewallet.js" },
|
{ token: "//ninja.singlewallet.js", file: "./src/ninja.singlewallet.js" },
|
||||||
{ token: "//ninja.paperwallet.js", file: "./src/ninja.paperwallet.js" },
|
{ token: "//ninja.paperwallet.js", file: "./src/ninja.paperwallet.js" },
|
||||||
|
{ token: "//ninja.cardwallet.js", file: "./src/ninja.cardwallet.js" },
|
||||||
{ token: "//ninja.bulkwallet.js", file: "./src/ninja.bulkwallet.js" },
|
{ token: "//ninja.bulkwallet.js", file: "./src/ninja.bulkwallet.js" },
|
||||||
{ token: "//ninja.brainwallet.js", file: "./src/ninja.brainwallet.js" },
|
{ token: "//ninja.brainwallet.js", file: "./src/ninja.brainwallet.js" },
|
||||||
{ token: "//ninja.detailwallet.js", file: "./src/ninja.detailwallet.js" },
|
{ token: "//ninja.detailwallet.js", file: "./src/ninja.detailwallet.js" },
|
||||||
{ token: "//ninja.donatetab.js", file: "./src/ninja.donatetab.js" },
|
{ token: "//ninja.donatetab.js", file: "./src/ninja.donatetab.js" },
|
||||||
{ token: "//qrcode.js", file: "./src/qrcode.js" },
|
{ token: "//qrcode.js", file: "./src/qrcode.js" },
|
||||||
{ token: "//securerandom.js", file: "./src/securerandom.js" },
|
{ token: "//securerandom.js", file: "./src/securerandom.js" },
|
||||||
{ token: "//janin.currency.js", file: "./src/janin.currency.js" },
|
{ token: "//janin.currency.js", file: "./src/janin.currency.js" },
|
||||||
|
@ -57,4 +58,4 @@ module.exports = function (grunt) {
|
||||||
grunt.file.defaultEncoding = 'utf-8';
|
grunt.file.defaultEncoding = 'utf-8';
|
||||||
grunt.loadNpmTasks("grunt-combine");
|
grunt.loadNpmTasks("grunt-combine");
|
||||||
grunt.registerTask("default", ["combine:src", "combine:i18n"]);
|
grunt.registerTask("default", ["combine:src", "combine:i18n"]);
|
||||||
};
|
};
|
||||||
|
|
83
index.html
83
index.html
|
@ -9679,6 +9679,7 @@ h1 { margin: 0px; height: 91px; }
|
||||||
<div class="menu" id="menu">
|
<div class="menu" id="menu">
|
||||||
<div class="tab i18n selected" id="singlewallet" onclick="ninja.tabSwitch(this);">Single Wallet</div>
|
<div class="tab i18n selected" id="singlewallet" onclick="ninja.tabSwitch(this);">Single Wallet</div>
|
||||||
<div class="tab i18n" id="paperwallet" onclick="ninja.tabSwitch(this);">Paper Wallet</div>
|
<div class="tab i18n" id="paperwallet" onclick="ninja.tabSwitch(this);">Paper Wallet</div>
|
||||||
|
<div class="tab i18n" id="cardwallet" onclick="ninja.tabSwitch(this);">Card Wallet</div>
|
||||||
<div class="tab i18n" id="bulkwallet" onclick="ninja.tabSwitch(this);">Bulk Wallet</div>
|
<div class="tab i18n" id="bulkwallet" onclick="ninja.tabSwitch(this);">Bulk Wallet</div>
|
||||||
<div class="tab i18n" id="brainwallet" onclick="ninja.tabSwitch(this);">Brain Wallet</div>
|
<div class="tab i18n" id="brainwallet" onclick="ninja.tabSwitch(this);">Brain Wallet</div>
|
||||||
<div class="tab i18n" id="detailwallet" onclick="ninja.tabSwitch(this);">Wallet Details</div>
|
<div class="tab i18n" id="detailwallet" onclick="ninja.tabSwitch(this);">Wallet Details</div>
|
||||||
|
@ -9862,7 +9863,7 @@ Walletgenerator.net use the same security measures as the original project. All-
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="paperarea">
|
<div id="paperarea" class="walletarea">
|
||||||
<div class="commands">
|
<div class="commands">
|
||||||
<div id="papercommands" class="row">
|
<div id="papercommands" class="row">
|
||||||
<span><label id="paperlabelencrypt" for="paperencrypt" class="i18n">BIP38 Encrypt?</label> <input type="checkbox" id="paperencrypt" onchange="ninja.wallets.paperwallet.toggleEncrypt(this);" /></span>
|
<span><label id="paperlabelencrypt" for="paperencrypt" class="i18n">BIP38 Encrypt?</label> <input type="checkbox" id="paperencrypt" onchange="ninja.wallets.paperwallet.toggleEncrypt(this);" /></span>
|
||||||
|
@ -9881,6 +9882,20 @@ Walletgenerator.net use the same security measures as the original project. All-
|
||||||
<div id="paperkeyarea"></div>
|
<div id="paperkeyarea"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="cardarea" class="walletarea">
|
||||||
|
<div class="commands">
|
||||||
|
<div id="papercommands" class="row">
|
||||||
|
<input placeholder="Enter your public address" id="suppliedPublicAddress" name="suppliedPublicAddress" spellcheck="false" />
|
||||||
|
<input placeholder="Custom text" id="suppliedCustomText" name="suppliedCustomText" spellcheck="false" />
|
||||||
|
<input type="button" id="cardgenerate" value="Apply »" onClick="ninja.wallets.cardwallet.generate();" />
|
||||||
|
|
||||||
|
<span class="print"><input type="button" name="print" value="Print" id="cardprint" onclick="window.print();" /></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="cardkeyarea"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="bulkarea" class="walletarea">
|
<div id="bulkarea" class="walletarea">
|
||||||
<div class="commands">
|
<div class="commands">
|
||||||
<div id="bulkcommands" class="row">
|
<div id="bulkcommands" class="row">
|
||||||
|
@ -11362,6 +11377,72 @@ ninja.wallets.paperwallet = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
ninja.wallets.cardwallet = {
|
||||||
|
open: function () {
|
||||||
|
document.getElementById("cardarea").style.display = "block";
|
||||||
|
},
|
||||||
|
|
||||||
|
close: function () {
|
||||||
|
document.getElementById("cardarea").style.display = "none";
|
||||||
|
},
|
||||||
|
|
||||||
|
// Verify that a self-entered key is valid, and compute the corresponding
|
||||||
|
// public address, render the wallet.
|
||||||
|
testAndApplyVanityKey: function () {
|
||||||
|
var suppliedKey = document.getElementById('suppliedPrivateKey').value;
|
||||||
|
suppliedKey = suppliedKey.trim(); // in case any spaces or whitespace got pasted in
|
||||||
|
document.getElementById('suppliedPrivateKey').value = suppliedKey;
|
||||||
|
if (!ninja.privateKey.isPrivateKey(suppliedKey)) {
|
||||||
|
alert(ninja.translator.get("detailalertnotvalidprivatekey"));
|
||||||
|
} else {
|
||||||
|
var computedPublicAddress = new Bitcoin.ECKey(suppliedKey).getBitcoinAddress();
|
||||||
|
if (ninja.wallets.paperwallet.encrypt) {
|
||||||
|
document.getElementById("busyblock").className = "busy";
|
||||||
|
ninja.privateKey.BIP38PrivateKeyToEncryptedKeyAsync(suppliedKey,
|
||||||
|
document.getElementById('paperpassphrase').value, false, function(encodedKey) {
|
||||||
|
document.getElementById("busyblock").className = "";
|
||||||
|
ninja.wallets.paperwallet.showArtisticWallet(1, computedPublicAddress, encodedKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ninja.wallets.paperwallet.showArtisticWallet(1, computedPublicAddress, suppliedKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
templateArtisticHtml: function (i) {
|
||||||
|
var keyelement = 'btcprivwif';
|
||||||
|
var coinImgUrl = "logos/" + janin.selectedCurrency.name.toLowerCase() + ".png";
|
||||||
|
var walletBackgroundUrl = "wallets/" + janin.selectedCurrency.name.toLowerCase() + ".png";
|
||||||
|
|
||||||
|
var walletHtml =
|
||||||
|
"<div class='coinIcoin'> <img id='coinImg' src='" + coinImgUrl + "' alt='currency_logo' /></div><div class='artwallet' id='artwallet" + i + "'>" +
|
||||||
|
"<img id='papersvg" + i + "' class='papersvg' src='" + walletBackgroundUrl + "' />" +
|
||||||
|
"<div id='qrcode_public" + i + "' class='qrcode_public'></div>" +
|
||||||
|
"<div id='qrcode_private" + i + "' class='qrcode_private'></div>" +
|
||||||
|
"<div class='btcaddress' id='btcaddress" + i + "'></div>" +
|
||||||
|
"<div class='" + keyelement + "' id='" + keyelement + i + "'></div>" +
|
||||||
|
"<div class='paperWalletText'><img class='backLogo' src='" + coinImgUrl + "' alt='currency_logo' />" + ninja.translator.get("paperwalletback") + "</div>" +
|
||||||
|
"</div>";
|
||||||
|
return walletHtml;
|
||||||
|
},
|
||||||
|
|
||||||
|
showArtisticWallet: function (idPostFix, bitcoinAddress, privateKey) {
|
||||||
|
var keyValuePair = {};
|
||||||
|
keyValuePair["qrcode_public" + idPostFix] = bitcoinAddress;
|
||||||
|
ninja.qrCode.showQrCode(keyValuePair, 3.5);
|
||||||
|
|
||||||
|
var keyValuePair = {};
|
||||||
|
keyValuePair["qrcode_private" + idPostFix] = privateKey;
|
||||||
|
ninja.qrCode.showQrCode(keyValuePair, 2.8);
|
||||||
|
|
||||||
|
document.getElementById("btcaddress" + idPostFix).innerHTML = bitcoinAddress;
|
||||||
|
document.getElementById("btcprivwif" + idPostFix).innerHTML = privateKey;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
ninja.wallets.bulkwallet = {
|
ninja.wallets.bulkwallet = {
|
||||||
|
|
|
@ -144,6 +144,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
<div class="menu" id="menu">
|
<div class="menu" id="menu">
|
||||||
<div class="tab i18n selected" id="singlewallet" onclick="ninja.tabSwitch(this);">Single Wallet</div>
|
<div class="tab i18n selected" id="singlewallet" onclick="ninja.tabSwitch(this);">Single Wallet</div>
|
||||||
<div class="tab i18n" id="paperwallet" onclick="ninja.tabSwitch(this);">Paper Wallet</div>
|
<div class="tab i18n" id="paperwallet" onclick="ninja.tabSwitch(this);">Paper Wallet</div>
|
||||||
|
<div class="tab i18n" id="cardwallet" onclick="ninja.tabSwitch(this);">Card Wallet</div>
|
||||||
<div class="tab i18n" id="bulkwallet" onclick="ninja.tabSwitch(this);">Bulk Wallet</div>
|
<div class="tab i18n" id="bulkwallet" onclick="ninja.tabSwitch(this);">Bulk Wallet</div>
|
||||||
<div class="tab i18n" id="brainwallet" onclick="ninja.tabSwitch(this);">Brain Wallet</div>
|
<div class="tab i18n" id="brainwallet" onclick="ninja.tabSwitch(this);">Brain Wallet</div>
|
||||||
<div class="tab i18n" id="detailwallet" onclick="ninja.tabSwitch(this);">Wallet Details</div>
|
<div class="tab i18n" id="detailwallet" onclick="ninja.tabSwitch(this);">Wallet Details</div>
|
||||||
|
@ -327,7 +328,7 @@ Walletgenerator.net use the same security measures as the original project. All-
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="paperarea">
|
<div id="paperarea" class="walletarea">
|
||||||
<div class="commands">
|
<div class="commands">
|
||||||
<div id="papercommands" class="row">
|
<div id="papercommands" class="row">
|
||||||
<span><label id="paperlabelencrypt" for="paperencrypt" class="i18n">BIP38 Encrypt?</label> <input type="checkbox" id="paperencrypt" onchange="ninja.wallets.paperwallet.toggleEncrypt(this);" /></span>
|
<span><label id="paperlabelencrypt" for="paperencrypt" class="i18n">BIP38 Encrypt?</label> <input type="checkbox" id="paperencrypt" onchange="ninja.wallets.paperwallet.toggleEncrypt(this);" /></span>
|
||||||
|
@ -346,6 +347,20 @@ Walletgenerator.net use the same security measures as the original project. All-
|
||||||
<div id="paperkeyarea"></div>
|
<div id="paperkeyarea"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="cardarea" class="walletarea">
|
||||||
|
<div class="commands">
|
||||||
|
<div id="papercommands" class="row">
|
||||||
|
<input placeholder="Enter your public address" id="suppliedPublicAddress" name="suppliedPublicAddress" spellcheck="false" />
|
||||||
|
<input placeholder="Custom text" id="suppliedCustomText" name="suppliedCustomText" spellcheck="false" />
|
||||||
|
<input type="button" id="cardgenerate" value="Apply »" onClick="ninja.wallets.cardwallet.generate();" />
|
||||||
|
|
||||||
|
<span class="print"><input type="button" name="print" value="Print" id="cardprint" onclick="window.print();" /></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="cardkeyarea"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="bulkarea" class="walletarea">
|
<div id="bulkarea" class="walletarea">
|
||||||
<div class="commands">
|
<div class="commands">
|
||||||
<div id="bulkcommands" class="row">
|
<div id="bulkcommands" class="row">
|
||||||
|
@ -627,6 +642,9 @@ Walletgenerator.net use the same security measures as the original project. All-
|
||||||
//ninja.paperwallet.js
|
//ninja.paperwallet.js
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
//ninja.cardwallet.js
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript">
|
||||||
//ninja.bulkwallet.js
|
//ninja.bulkwallet.js
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
63
src/ninja.cardwallet.js
Normal file
63
src/ninja.cardwallet.js
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
ninja.wallets.cardwallet = {
|
||||||
|
open: function () {
|
||||||
|
document.getElementById("cardarea").style.display = "block";
|
||||||
|
},
|
||||||
|
|
||||||
|
close: function () {
|
||||||
|
document.getElementById("cardarea").style.display = "none";
|
||||||
|
},
|
||||||
|
|
||||||
|
// Verify that a self-entered key is valid, and compute the corresponding
|
||||||
|
// public address, render the wallet.
|
||||||
|
testAndApplyVanityKey: function () {
|
||||||
|
var suppliedKey = document.getElementById('suppliedPrivateKey').value;
|
||||||
|
suppliedKey = suppliedKey.trim(); // in case any spaces or whitespace got pasted in
|
||||||
|
document.getElementById('suppliedPrivateKey').value = suppliedKey;
|
||||||
|
if (!ninja.privateKey.isPrivateKey(suppliedKey)) {
|
||||||
|
alert(ninja.translator.get("detailalertnotvalidprivatekey"));
|
||||||
|
} else {
|
||||||
|
var computedPublicAddress = new Bitcoin.ECKey(suppliedKey).getBitcoinAddress();
|
||||||
|
if (ninja.wallets.paperwallet.encrypt) {
|
||||||
|
document.getElementById("busyblock").className = "busy";
|
||||||
|
ninja.privateKey.BIP38PrivateKeyToEncryptedKeyAsync(suppliedKey,
|
||||||
|
document.getElementById('paperpassphrase').value, false, function(encodedKey) {
|
||||||
|
document.getElementById("busyblock").className = "";
|
||||||
|
ninja.wallets.paperwallet.showArtisticWallet(1, computedPublicAddress, encodedKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ninja.wallets.paperwallet.showArtisticWallet(1, computedPublicAddress, suppliedKey);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
templateArtisticHtml: function (i) {
|
||||||
|
var keyelement = 'btcprivwif';
|
||||||
|
var coinImgUrl = "logos/" + janin.selectedCurrency.name.toLowerCase() + ".png";
|
||||||
|
var walletBackgroundUrl = "wallets/" + janin.selectedCurrency.name.toLowerCase() + ".png";
|
||||||
|
|
||||||
|
var walletHtml =
|
||||||
|
"<div class='coinIcoin'> <img id='coinImg' src='" + coinImgUrl + "' alt='currency_logo' /></div><div class='artwallet' id='artwallet" + i + "'>" +
|
||||||
|
"<img id='papersvg" + i + "' class='papersvg' src='" + walletBackgroundUrl + "' />" +
|
||||||
|
"<div id='qrcode_public" + i + "' class='qrcode_public'></div>" +
|
||||||
|
"<div id='qrcode_private" + i + "' class='qrcode_private'></div>" +
|
||||||
|
"<div class='btcaddress' id='btcaddress" + i + "'></div>" +
|
||||||
|
"<div class='" + keyelement + "' id='" + keyelement + i + "'></div>" +
|
||||||
|
"<div class='paperWalletText'><img class='backLogo' src='" + coinImgUrl + "' alt='currency_logo' />" + ninja.translator.get("paperwalletback") + "</div>" +
|
||||||
|
"</div>";
|
||||||
|
return walletHtml;
|
||||||
|
},
|
||||||
|
|
||||||
|
showArtisticWallet: function (idPostFix, bitcoinAddress, privateKey) {
|
||||||
|
var keyValuePair = {};
|
||||||
|
keyValuePair["qrcode_public" + idPostFix] = bitcoinAddress;
|
||||||
|
ninja.qrCode.showQrCode(keyValuePair, 3.5);
|
||||||
|
|
||||||
|
var keyValuePair = {};
|
||||||
|
keyValuePair["qrcode_private" + idPostFix] = privateKey;
|
||||||
|
ninja.qrCode.showQrCode(keyValuePair, 2.8);
|
||||||
|
|
||||||
|
document.getElementById("btcaddress" + idPostFix).innerHTML = bitcoinAddress;
|
||||||
|
document.getElementById("btcprivwif" + idPostFix).innerHTML = privateKey;
|
||||||
|
},
|
||||||
|
};
|
Loading…
Add table
Reference in a new issue