pub struct Daemon { /* private fields */ }Expand description
Connection to the user’s uniauth daemon, used for RPC Connection with the daemon will last as long as this struct exists. Should only be used by an application’s client, never a server.
Implementations§
Source§impl Daemon
impl Daemon
Sourcepub async fn authenticate(
&mut self,
name: &str,
action: &str,
nonce: &[u8],
) -> Result<AnySignature>
pub async fn authenticate( &mut self, name: &str, action: &str, nonce: &[u8], ) -> Result<AnySignature>
Authenticate an action for a given service login, returning its signature. All fields must be known by the server to authenticate with through communication or hardcoding.
§Arguments
name- Name of the service’s key to useaction- Action to authenticate. Must be human readable, but also completely deterministicnonce- Unique random data or atomic counter that is unique to this challenge and never used again
§Example
let nonce = random_data_from_server();
let sig = daemon.authenticate("username", "login", &nonce).await?;
send_signature_to_server(sig);Sourcepub async fn store(&mut self, name: &str, keypair: AnyKeypair) -> Result<()>
pub async fn store(&mut self, name: &str, keypair: AnyKeypair) -> Result<()>
Store a keypair for a new service login. Will fail if a keypair already exists.
§Warning
Since the client provides the keypair, this gives it a requirement for extra security.
Keys that are generated and immediately stored should use generate instead.
§Arguments
name- Name of the key to be retrieved byauthenticateorpubkeykeypair- The keypair used for signing challenges
§Example
let keypair = import_keypair();
daemon.store("username", keypair).await?;Auto Trait Implementations§
impl !Freeze for Daemon
impl RefUnwindSafe for Daemon
impl Send for Daemon
impl Sync for Daemon
impl Unpin for Daemon
impl UnwindSafe for Daemon
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