-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(iroh): add node wide default author for documents (#2299)
## 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 be changed with `iroh.authors.set_default`. If the `default-author` file is deleted manually, a new default author will be created on the next start. ## Breaking Changes * Added `iroh.authors.default()`, which returns the author id of a single default author per node * Added `iroh.authors.set_default(&self, author_id: AuthorId)`, which allows to set the default author for the node * `iroh::util::path::IrohPaths` enum gained new variant `DefaultAuthor` ## 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-author` file by hand and restart the node > * B2: add `set_default_author` rpc 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. --------- Co-authored-by: dignifiedquire <[email protected]>
- Loading branch information
1 parent
d635d93
commit c8690a2
Showing
14 changed files
with
531 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.