Wallet decryption phase is implemented
MODIFY
HiddenWallet/HiddenWallet.GUI/app/html/decryption-phase-content.html
HiddenWallet/HiddenWallet.GUI/app/html/decryption-phase-content.html
<div class="jumbotron" id="decrypt-active">
<input type="password" id="inputPassword" class="form-control" placeholder="Password" />
<br />
- <button class="btn btn-lg btn-primary btn-block">Decrypt</button>
+ <button class="btn btn-lg btn-primary btn-block" onclick="decryptWallet()">Decrypt</button>
</div>
<div class="jumbotron" id="generate-active">
<div class="jumbotron" id="recover-active">
<label>Syncronize transactions from:</label>
- <input type="date" id="inputSyncFrom" class="form-control" required />
+ <input type="text" id="inputSyncFrom" class="form-control" placeholder="2017-01-21" />
<label>Password:</label>
<input type="password" id="inputPassword" class="form-control" placeholder="Password" />
<label>Mnemonic words:</label>
- <input type="text" id="inputMnemonic" class="form-control" placeholder="because evil federal west carry frog trophy quantum dry blast luggage piece" required />
+ <input type="text" id="inputMnemonic" class="form-control" placeholder="because evil federal west carry frog trophy quantum dry blast luggage piece" />
<br />
<div class="alert alert-info" role="alert">
<strong>Heads up!</strong> At recovery the wallet is unable to check if your password is correct or not. If you provide a wrong password a wallet will be recovered with the provided mnemonic and password combination.
</div>
- <button class="btn btn-lg btn-primary btn-block">Recover</button>
+ <button class="btn btn-lg btn-primary btn-block" onclick="recoverWallet()">Recover</button>
</div>
\ No newline at end of file

MODIFY
HiddenWallet/HiddenWallet.GUI/app/js/decryption-phase.js
HiddenWallet/HiddenWallet.GUI/app/js/decryption-phase.js
@@ -82,3 +82,52 @@ function generateWallet() {
decryptionPhaseShow();
}
}
+
+function recoverWallet() {
+ var password = document.getElementById("inputPassword").value;
+ var mnemonic = document.getElementById("inputMnemonic").value.trim();
+ var syncFrom = document.getElementById("inputSyncFrom").value.trim();
+
+ if (mnemonic === "") {
+ alert("Mnemonic is required", "Could not recover wallet");
+ }
+ else if (mnemonic.split(" ").length !== 12) {
+ alert("Wrong mnemonic format. 12 mnemonic words are required.", "Could not recover wallet");
+ }
+ else if (syncFrom === "") {
+ alert("'Syncronize transactions from' date is required", "Could not recover wallet");
+ }
+ else if (syncFrom.length !== 10) {
+ alert("Wrong 'Syncronize transactions from' date format. Format must be like: 2017-01-01", "Could not recover wallet");
+ }
+ else {
+ var obj = new Object();
+ obj.password = password;
+ obj.mnemonic = mnemonic;
+ obj.creationTime = syncFrom;
+ var result = httpPostWallet("recover", obj);
+
+ if (result.Success == false) {
+ alert(result.Message, "Could not recover wallet");
+ }
+ else {
+ alert("Starting syncronization...", "Wallet is successfully recovered!");
+ }
+ decryptionPhaseShow();
+ }
+}
+
+function decryptWallet() {
+ var password = document.getElementById("inputPassword").value;
+
+ var obj = new Object();
+ obj.password = password;
+ var result = httpPostWallet("load", obj);
+
+ if (result.Success == false) {
+ alert(result.Message, "Could not decrypt wallet");
+ }
+ else {
+ alert("Wallet is successfully decrypted!", "Success");
+ }
+}
\ No newline at end of file

Wallet decryption phase is implemented