io_keyring/io.rs
1//! Keyring I/O requests and responses.
2
3use secrecy::SecretString;
4
5use crate::entry::KeyringEntry;
6
7/// The keyring I/O request enum, emitted by [coroutines] and
8/// processed by [runtimes].
9///
10/// Represents all the possible I/O requests that a stream coroutine
11/// can emit. Runtimes should be able to handle all variants.
12///
13/// [coroutines]: crate::coroutines
14/// [runtimes]: crate::runtimes
15#[derive(Clone, Debug)]
16pub enum KeyringIo {
17 /// I/O for reading a secret from a keyring entry.
18 ///
19 /// Input: keyring entry
20 ///
21 /// Output: secret string
22 Read(Result<SecretString, KeyringEntry>),
23
24 /// I/O for saving a keyring entry secret.
25 ///
26 /// Input: keyring entry with secret string
27 ///
28 /// Output: none
29 Write(Result<(), (KeyringEntry, SecretString)>),
30
31 /// I/O for deleting a keyring entry.
32 ///
33 /// Input: keyring entry
34 ///
35 /// Output: none
36 Delete(Result<(), KeyringEntry>),
37}