SSB key #recovery — a suggestion
I have just installed the latest #ManyVerse, and to my delight it is now possible to backup the key. However, the user experience when doing so was far from delightful: I missed a word when writing down the 48 words, and I forgot a single line with words and mispelled a word when trying to confirm that I had actually written down all of the words. And I found it tedious to tap in the words on my phone without the help of the usual word suggestions. Imagine if my English were poorer than it is…
To remedy the situation, I would like to suggest a method that reduces the necessary number of words to 25 (which is still a lot, I think) and is able to complete the correct word when just 3 characters from every word that is rung in.
To reduce the number of words from 48 to 25, we make use of the fact that the thing we call the private key is actually 32 bytes of random data + the 32 bytes public key derived from that noise. Altogether 64 bytes.
To be able to complete the words, we use EFF's short word list with words that have unique three-character prefixes: 1296 words.
So what we do is:
- Backup
- Take the first 32 bytes of the private key.
- Encode these 32 bytes to ‘Base1296’, using EFF's wordlist as ‘digits‘.
- Restore
- Decode the Base1296 passphrase to an array of 32 bytes.
- Calculate the ‘full’ private key from these 32 bytes.
Proof of concept
Let's say the user @fake has these keys:
- Private key:
mc9Apn3jiKbrqnivbzCW9EkDCXmwf+LLhsU0RMue4DJ9ooSQDBWImC0I7491D8psie61Ngsc5+CjvjpOUWuA4A==.ed25519
- Public key:
faKEkAwViJgtCO+PdQ/KbInutTYLHOfgo746TlFrgOA=.ed25519
Here we first generate the backup phrase, then recombine them to get the original keys:
$ # first we generate the backup phrase
$ secret2words.py mc9Apn3jiKbrqnivbzCW9EkDCXmwf+LLhsU0RMue4DJ9ooSQDBWImC0I7491D8psie61Ngsc5+CjvjpOUWuA4A==.ed25519
almanac osmosis sugar helmet atom
unjustly tidbit romancer occupation wifeless
vulnerable acrobat tastebud widow cuddly
nullify juggle unpaved hugeness elk
enigmatic listless length saltshaker egomaniac
$ # then we recreate the original keys from the backup
$ secret2words.py | words2secret.py
Private key: mc9Apn3jiKbrqnivbzCW9EkDCXmwf+LLhsU0RMue4DJ9ooSQDBWImC0I7491D8psie61Ngsc5+CjvjpOUWuA4A==.ed25519
Public key: faKEkAwViJgtCO+PdQ/KbInutTYLHOfgo746TlFrgOA=.ed25519
Q.E.D.
The backup words may look unwieldy, but remember that as soon as the app sees alm
it knows that the word is almanac
and can complete it on behalf of the user. Same procedure for all the words.
Download
📎 secret2words.py
📎 words2secret.py
NB: You will need the nacl
module for the recovery part. The scripts are simple proofs of concept and doesn't really have error checking or anything fancy.