History

change!: remove `Identity` in favor of `identity::Account` module; add `identity::UserId` (#386)

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.

Sebastian Thiel committed 4 years ago

Commit 37a607d1 parent 5cf8c271 file · +17 −8Browse files

Unified · Split

git-sec/src/lib.rs+17−8
@@ -2,15 +2,24 @@ · 1 unmodified line
22 #![deny(rust_2018_idioms, missing_docs)]
33 //! A shared trust model for `gitoxide` crates.
44
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))]
918 /// An account based identity
10− Account {
19+ pub struct Account {
1120 /// The user's name
12− username: String,
21+ pub username: String,
1322 /// The user's password
14− password: String,
15− },
23+ pub password: String,
24+ }
1625 }