As the fewest consumers will be able to deal with multiple identities, remove the enumeration approach in favor of individual type which deal with one specific way of identifying a user.
Unified · Split
| @@ -2,15 +2,24 @@ · 1 unmodified line | ||
| 2 | 2 | #![deny(rust_2018_idioms, missing_docs)] |
| 3 | 3 | //! A shared trust model for `gitoxide` crates. |
| 4 | 4 | |
| 5 | −#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] | |
| 6 | −#[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] | |
| 7 | −/// An identity for use when authenticating the transport layer. | |
| 8 | −pub enum Identity { | |
| 5 | +/// Various types to identify entities. | |
| 6 | +pub mod identity { | |
| 7 | + /// A unix user id as obtained from the file system. | |
| 8 | + #[cfg(not(windows))] | |
| 9 | + pub type UserId = u32; | |
| 10 | + | |
| 11 | + /// A windows [security identifier](https://docs.microsoft.com/en-us/windows/security/identity-protection/access-control/security-identifiers) | |
| 12 | + /// in its stringified form. | |
| 13 | + #[cfg(windows)] | |
| 14 | + pub type UserId = String; | |
| 15 | + | |
| 16 | + #[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)] | |
| 17 | + #[cfg_attr(feature = "serde1", derive(serde::Serialize, serde::Deserialize))] | |
| 9 | 18 | /// An account based identity |
| 10 | − Account { | |
| 19 | + pub struct Account { | |
| 11 | 20 | /// The user's name |
| 12 | − username: String, | |
| 21 | + pub username: String, | |
| 13 | 22 | /// The user's password |
| 14 | − password: String, | |
| 15 | − }, | |
| 23 | + pub password: String, | |
| 24 | + } | |
| 16 | 25 | } |