Dear developers,

How can I derive an identity public key given onion secret key in form of:

ED25519-V3:UJL1wgWVeMz9f7oM+Xrbq0i8tJ2/aeBi3K0cl8VCrlicSts8Gg98agO5DUXHjsfQb+yooLgN0CB0Y0A9U0rMUQ==

?


I assume that a secret key is 64 bytes long, and identity public key is last 32 bytes of decoded private key. So, my algorithm is as follows:

base64Decode(privatekey) //without ED25519-V3: part
slice resulting buffer in half
base32Encode(second half of the buffer)

As a result I expect to see first 52 characters of corresponding onion address, but I see totally unrelated random string instead.


I've already tested the part that converts a public key into onion address as per tor/src/test/hs_build_addres.py, that part is working.
The problem is that I derive wrong identity public key from the secret key.

Thank you!