-
-
Save johansten/35f4767e2f1d4d108a4bb21ff8289ec7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
download all of the files into the same folder | |
change the contents of main.js: | |
replace the encrypted seed with yours | |
replace the password | |
run | |
> npm install | |
and then | |
> node main.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sjcl = require('sjcl'); | |
const encryptSeed = (seed, key, cipherName, modeName) => { | |
const cipher = new sjcl.cipher[cipherName](key); | |
const rawIV = sjcl.random.randomWords(3); | |
const encryptedData = sjcl.mode[modeName].encrypt( | |
cipher, | |
sjcl.codec.utf8String.toBits(seed), | |
rawIV | |
); | |
return [ | |
sjcl.codec.base64.fromBits(rawIV), | |
sjcl.codec.base64.fromBits(encryptedData) | |
]; | |
}; | |
const encrypt = (seed, password) => { | |
const saltBits = sjcl.random.randomWords(4); // 128 bits of salt, was 256 bits | |
const numRounds = 4096; | |
const key = sjcl.misc.pbkdf2(password, saltBits, numRounds); | |
const salt = sjcl.codec.base64.fromBits(saltBits); | |
const cipherName = 'aes'; | |
const modeName = 'gcm'; | |
const blob = encryptSeed(seed, key, cipherName, modeName); | |
return ['1', salt, blob]; | |
}; | |
const decryptSeed = (blob, key) => { | |
const cipherName = 'aes'; | |
const modeName = 'gcm'; | |
const cipher = new sjcl.cipher[cipherName](key); | |
const rawIV = sjcl.codec.base64.toBits(blob[0]); | |
const rawCipherText = sjcl.codec.base64.toBits(blob[1]); | |
const decryptedData = sjcl.mode[modeName].decrypt( | |
cipher, | |
rawCipherText, | |
rawIV | |
); | |
return sjcl.codec.utf8String.fromBits(decryptedData); | |
}; | |
const decrypt = (data, password) => { | |
const saltBits = sjcl.codec.base64.toBits(data[1]); | |
const numRounds = 4096; | |
const key = sjcl.misc.pbkdf2(password, saltBits, numRounds); | |
return decryptSeed(data[2], key); | |
}; | |
module.exports = { | |
encrypt: encrypt, | |
decrypt: decrypt | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('./crypto.js'); | |
const encryptedSeed = ["1","ZCtl/+vWiLL358Jz+xnP5A==",["GgmFU37DSX4evSMU","CoMGXWHqDmLwxRAgORqjK/MyFEMAkMbqvDEDMjn4veVwpHab9m6Egcwp70qEJsRhjkHjCMWj9zX40tu9UK5QACuB8gD1r9Cu"]]; | |
const password = 'lacoin'; | |
const decryptedSeed = crypto.decrypt(encryptedSeed, password); | |
console.log(decryptedSeed); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "lacoin", | |
"version": "1.0.0", | |
"description": "", | |
"main": "crypto.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"sjcl": "^1.0.7" | |
} | |
} |
Ok with the help of some people on the stellar sub on reddit (https://www.reddit.com/r/Stellar/comments/ltcbb5/gaining_access_to_stellar_wallet_created_on/) I was able to figure out how to do this on a Mac. I have written the step by step instructions so a complete novice could do it:
- Make a screen grab of your QR Code and save it
- Go to https://zxing.org/w/decode and upload the saved screengrab
- You will get a long string of letters and numbers after the word “key” that starts with 1 parenthesis and ends in two parentheses. Copy this. Here is an example of how the string should look like:
"key":["1","Dt/bcdLAx8TnEd4qF/7+sQ==",["jwFqX+meUt3ioxnG","6woh7nRS1CcEN6qiWEI+knY9VyYdMzqlGxpxX6ZfPfAPVg9wOTYevryOmyGC3ycQ2asgPYx1pIW4Fp9Jj4pDGkKGWuhoZKsW"]]
JUST COPY ONLY THE CHARACTERS FROM ["jwFqX to the ending ]] (this is your encrypted key)
- Download the Zip file located at https://gist.github.com/johansten/35f4767e2f1d4d108a4bb21ff8289ec7
- Extract the files located in the zip file. Rename this folder to lumens and move the folder to /Users/
- Open the file main.js using TextEdit
- Replace the string shown below with the string you copied in step 3. above:
["GgmFU37DSX4evSMU","CoMGXWHqDmLwxRAgORqjK/MyFEMAkMbqvDEDMjn4veVwpHab9m6Egcwp70qEJsRhjkHjCMWj9zX40tu9UK5QACuB8gD1r9Cu"]]
- Replace the password ‘lacoin’ with your password that you had used to encrypt your wallet. Keep the quotations intact and just replace lacoin with your password.
- Save the file and quit TextEdit
- Go to the website nodejs.org and download the 14.16.0 LTS package (or the latest if this version isn’t there). Install that .pkg file after it downloads
- Launch Terminal app
- Type “cd lumens” (without the quotations)
- Type npm install
- Type node main.js
- Terminal should now display your de-crypted private key which consists of 56 characters starting with the letter S
- Copy your private key to a document in your text editor of choice (TextEdit, MS Word, etc.) and keep it safe
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I am not a programmer so I have no idea how to do this. Would someone be so kind to help me out? I created a password protected wallet using stargrazer app on my mac in 2017 and exported the qr code as a file. Now the app is not accepting the qr code when i try to scan it.