pub struct Client<C = BoxedConnector<RpcService>> { /* private fields */ }
rpc
only.Expand description
Iroh docs client.
Implementations§
Source§impl<C: Connector<RpcService>> Client<C>
impl<C: Connector<RpcService>> Client<C>
Sourcepub fn new(rpc: RpcClient<RpcService, C>) -> Self
pub fn new(rpc: RpcClient<RpcService, C>) -> Self
Creates a new docs client.
Sourcepub async fn create(&self) -> Result<AuthorId>
pub async fn create(&self) -> Result<AuthorId>
Creates a new document author.
You likely want to save the returned AuthorId
somewhere so that you can use this author
again.
If you need only a single author, use Self::default
.
Sourcepub async fn default(&self) -> Result<AuthorId>
pub async fn default(&self) -> Result<AuthorId>
Returns the default document author of this node.
On persistent nodes, the author is created on first start and its public key is saved in the data directory.
The default author can be set with Self::set_default
.
Sourcepub async fn set_default(&self, author_id: AuthorId) -> Result<()>
pub async fn set_default(&self, author_id: AuthorId) -> Result<()>
Sets the node-wide default author.
If the author does not exist, an error is returned.
On a persistent node, the author id will be saved to a file in the data directory and reloaded after a restart.
Sourcepub async fn list(&self) -> Result<impl Stream<Item = Result<AuthorId>>>
pub async fn list(&self) -> Result<impl Stream<Item = Result<AuthorId>>>
Lists document authors for which we have a secret key.
It’s only possible to create writes from authors that we have the secret key of.
Sourcepub async fn export(&self, author: AuthorId) -> Result<Option<Author>>
pub async fn export(&self, author: AuthorId) -> Result<Option<Author>>
Exports the given author.
Warning: The Author
struct contains sensitive data.