pub struct Client { /* private fields */ }Implementations§
Source§impl Client
impl Client
pub async fn connect<A>(addr: A, pub_key: PublicKey) -> Result<Self>where
A: ToSocketAddrs,
Sourcepub async fn package_info(
&self,
channel: Channel,
arch: BoardArch,
device_id: Option<DeviceId>,
name: String,
) -> Result<Option<Package>>
pub async fn package_info( &self, channel: Channel, arch: BoardArch, device_id: Option<DeviceId>, name: String, ) -> Result<Option<Package>>
can be called by anyone
Sourcepub async fn set_package_info(
&self,
package: Package,
whitelist: HashSet<DeviceId>,
auto_whitelist_limit: u32,
) -> Result<()>
pub async fn set_package_info( &self, package: Package, whitelist: HashSet<DeviceId>, auto_whitelist_limit: u32, ) -> Result<()>
can only be called if you authenticated as a writer
Sourcepub async fn get_file(&self, hash: Hash) -> Result<GetFile<EncryptedBytes>>
pub async fn get_file(&self, hash: Hash) -> Result<GetFile<EncryptedBytes>>
can be called by anyone does not return FileNotFound
Sourcepub async fn get_file_with_builder(
&self,
builder: &mut GetFileBuilder,
) -> Result<()>
pub async fn get_file_with_builder( &self, builder: &mut GetFileBuilder, ) -> Result<()>
If this function returns Ok(()) and the builder is not completed you can call this function again immediately
can return FileNotFound
Sourcepub async fn set_file(&self, req: SetFileReq<EncryptedBytes>) -> Result<()>
pub async fn set_file(&self, req: SetFileReq<EncryptedBytes>) -> Result<()>
you need to be authentiacated as a writer
Sourcepub async fn authenticate_reader(&self, key: AuthKey) -> Result<()>
pub async fn authenticate_reader(&self, key: AuthKey) -> Result<()>
authenticate as reader
Sourcepub async fn authenticate_writer(
&self,
channel: &Channel,
key: &Keypair,
) -> Result<()>
pub async fn authenticate_writer( &self, channel: &Channel, key: &Keypair, ) -> Result<()>
authenticate as writer
Sourcepub async fn new_auth_key_reader(&self) -> Result<AuthKey>
pub async fn new_auth_key_reader(&self) -> Result<AuthKey>
need to be authenticate as a writer
Sourcepub async fn change_whitelist(
&self,
arch: TargetArch,
name: String,
version: Hash,
whitelist: HashSet<DeviceId>,
add: bool,
auto_whitelist_limit: u32,
) -> Result<()>
pub async fn change_whitelist( &self, arch: TargetArch, name: String, version: Hash, whitelist: HashSet<DeviceId>, add: bool, auto_whitelist_limit: u32, ) -> Result<()>
Allows to change the whitelist. The whitelist can either be replaced or can be additive.
§Auth
need to be authenticate as a writer.
pub async fn close(self)
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more