Post
Topic
Board Nigeria (Naija)

Re: Info-thread: Translation of Useful English topics to Pidgin {mix images}
by
Abdulzuruku01
on 29/04/2025, 04:49:16 UTC

Translated Topic in Pidgin Language; I lost my Nostr keys (and how I take recover dem)
Original Topic: I lost my Nostr keys (and how I recovered them)
Author: NotAether



fo nex few days I go get small surprise ready fo una wey involve di Lightning Network, as I dey do am, I try to enter my Nostr private key whc I don save fo Alby Wallet, but wahala dey. E look like dat fo some reason, Alby Wallet dey get trouble to take connect to my node. (Maybe na bcos of start up and shut down fo many times). Well di node dey fine, I confirm am, but dey stop to read di Nostr settings and data by di infinite load circle.

Nostr keys basically dey like xpub/xprv keys fo Bitcoin except dat dey start wit npub and nsec fo each one. Dey still encode fo Bech32 I tink. You use dem to chat fo di Nostr social network. Di decentralize X/Twitter basically.

After some time, I tink I don find di backup fo my Nostr keys fo my password manager, and continue to clear all di placeholder entry fo my wallet, include di Nostr wallet.

Big mistake.

E turn out dat di mnemonic wey I don save fo my password manager don make complete different key and wey I don actually import di Nostr secret key form anoda program instead to generate di menmonic phrase.

Normally, I start to dey panic as I no get any copy of am. I tink about to check di Chrome browser fo di data directly, but by dat point I don already delete di Nostr keys.

But na dat time i remember say I make backups fo my whole system in di mornin and save dem fo some server, include my Chrome profile, so I tink say why not look inside di backup and see if I go fit find am. But I hav to hurry bcos di files go be overwritten fo about 24 hours from den.

I don no how I go do about am and get my keys frm di backups except fo di fact dat I knw say extensions get di long identifier like iokeahhehimjnekafflcihljlcjccdbe and each extension get di folder wit dat sort of name fo di Extensions directory fo di Chrome user data dir.

Wetin follow next go be di adventure fo coding, lobbing open database files, and di encryption.

Locate di extension settings

As I remember my wallet password and name, I go fit to decrypt di wallet if I ever see am. Which na em be di first problem - I no really dey sure whr e dey.

Di fine details of my backup structure mean say all di config files dey fo di tarball, so I jus do di scan fo di extension ID, which giv, among oda results, dis:



So as I knw whr di extension settings dey, but I no dey sure fo any of di files e do. AGI be most useless fo dis, unless you fo tell me say those IndexedDB folders must contain my settings. Spoiler alert: dey no do -  and I waste hour try to open di LevelDB file inside, which by di way na special modify fo Chrome wey no fit even open fo regular libraries.

E turned out dat parsing di database file wit di library na waste of time, so eventually I jus use tools like cat and less to take read di lines. I get better luck wit di Sync Extension Settings folder though, and whn you open am e look sometin like dis:



No worry, everytin dey encrypt. And e show to be encode fo base64.

Decrypting di payload

Fo wetin com nex, I hav to look at Alby Wallet's source code fo Github. And I happen to learn plenty tins about how Alby Wallet dey work under di hood. Like you know dey get actual API jus fo taking out settings from di disk? Which na em i need to see.

Small time of browsing bring me here:
https://github.com/getAlby/lightning-browser-extension/blob/3a4a06311f79d64ace5a5c5e7de9fcb36303b123/src/extension/background-script/actions/nostr/getPrivateKey.ts

And so e becom clear to me dat 1) All dis na Typescript, which I dey glad I still remember, and 2) those "getPrivateKey" fields really dey fo my Nostr private key. (Later on decryption I also see my LN node URL and admin macaroon.) But even though I know my password, I don no what decryption algorithm e dey use. Di good news be say I see am fo another file:

https://github.com/getAlby/lightning-browser-extension/blob/3a4a06311f79d64ace5a5c5e7de9fcb36303b123/src/common/lib/crypto.ts

I hav to clean di function well well so dat dey go run fo Node, togeda wit di install dat "crypto-js" dependency, but e worth am. E even take care of di Base64 encoding. By di way, di encryption look like AES-256 wit d salt. dat one secure well well.

Decryption dey bring di Nostr private key in di form of hex, wit whc i go fit derive di nsec and npub keypair and recover my Nostr account.

Dey careful wit yur nostr keys - dem dey like Bitcoin Core keys. Dey hard to write down and better off fo di password manager.