Skip to content

Commit 37a607d

Browse files
committed
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.
1 parent 5cf8c27 commit 37a607d

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

git-sec/src/lib.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,24 @@
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
}

0 commit comments

Comments
 (0)