feat: node-wide default author for documents
Description
This adds the notion of a node-wide default author for documents.
The default author can be retrieved via iroh.authors.default(). On persistent nodes, on first start a new author is created and its public key is saved to IROH_DATA_DIR/default-author (as a base32 string). For in-memory nodes, a new author is created.
When trying to delete the default author via iroh.authors.delete, an error is returned, stating that the default author may not be deleted.
The default author can not be changed.
If the default-author file is deleted manually, a new default author will be created on the next start.
Breaking Changes
- Added
AuthorClient::default(), which returns the author id of a single default author per node iroh::util::path::IrohPathsenum gained new variantDefaultAuthor
Notes & open questions
There are certainly other ways to go around the interactions between the iroh-local notion of a default author and the author database in the iroh-docs store. Quoting from discord (this PR implements option B.1):
if you delete the default author with the author api, what should happen?
- A: default author remains in place, further operations with it fail
- A.1: on next start new default author is created automatically
- A.2: next start fails, says "delete default_author file by hand"
- B: deletion of default author fails.
- B1: that's the way it is, only way to delete it is to delete
default-authorfile by hand and restart the node- B2: add
set_default_authorrpc call- C: a new default author is created and set always & automatically
Change checklist
- [x] Self-review.
- [x] Documentation updates if relevant.
- [x] Tests if relevant.
- [x] All breaking changes documented.