Support dynamic switching of card store type
[moonshot-ui.git] / src / moonshot-id.vala
1 public class TrustAnchor : Object
2 {
3   public string ca_cert {get; set; default = "";}
4   public string subject {get; set; default = "";}
5   public string subject_alt  {get; set; default = "";}
6   public string server_cert  {get; set; default = "";}
7 }
8
9 public struct Rule
10 {
11   public string pattern;
12   public string always_confirm;
13 }
14
15 public class IdCard : Object
16 {
17   public const string NO_IDENTITY = "No Identity";
18
19   private string _nai;
20   
21   public string display_name { get; set; default = ""; }
22   
23   public string username { get; set; default = ""; }
24   public string password { get; set; default = null; }
25
26   public string issuer { get; set; default = ""; }
27   
28   public Rule[] rules {get; set; default = {};}
29   public string[] services { get; set; default = {}; }
30
31   public TrustAnchor trust_anchor  { get; set; default = new TrustAnchor (); }
32   
33   public Gdk.Pixbuf pixbuf { get; set; default = null; }    
34
35   public unowned string nai { get {  _nai = username + "@" + issuer; return _nai;}}
36
37   public bool IsNoIdentity() 
38   {
39     return (display_name == NO_IDENTITY);
40   }
41
42   public static IdCard NewNoIdentity() 
43   { 
44     IdCard card = new IdCard();
45     card.display_name = NO_IDENTITY;
46     return card;
47   }
48 }