This code is independent of the rest of #22029 (moved), so please make a separate branch for it.
Then someone else can review that branch in this ticket.
The code needs these changes:
add_rsa_fingerprint_to_dir() can fail and return -1, if it does, dirserv_add_own_fingerprint() should return -1
add_ed25519_to_dir() can fail and return -1, if it does, dirserv_add_own_fingerprint() should return -1
Please remove all the #22029 (moved) commits from the branch: this branch should start with "Add our own base-64 encoded ed25519 public key in dirserv_add_own_fingerprint()" and any fix ups and tests.
Here's a problem: add_ed25519_to_dir() was introduced in #22029 (moved) and the commits before "Add our own base-64 encoded ed25519 public key in dirserv_add_own_fingerprint()".
This commit adds add_ed25519_to_dir():
Allow ed25519 keys to be banned in approved-routers
commit 7267177b89e7db4f9482e33614f813564c198ec1