13 [CollectionName(
"LegalIdentityStates")]
15 [Index(
"BareJid",
"LegalId")]
16 [Index(
"BareJid",
"State",
"Timestamp")]
22 private string objectId =
null;
25 private byte[] publicKey =
null;
26 private string keyName =
null;
27 private string keyNamespace =
null;
28 private byte[] privateKey =
null;
30 private DateTime timestamp = DateTime.MinValue;
55 set => this.objectId = value;
64 set => this.bareJid = value;
73 set => this.legalId = value;
82 get => this.publicKey;
83 set => this.publicKey = value;
93 set => this.keyName = value;
102 get => this.keyNamespace;
103 set => this.keyNamespace = value;
121 return this.privateKey;
126 if (!(this.privateKey is
null))
129 this.privateKey = value;
139 set => this.state = value;
147 get => this.timestamp;
148 set => this.timestamp = value;
166 if (!(approvedSources is
null))
167 throw new NotSupportedException(
"Changing approved sources not permitted.");
169 approvedSources = ApprovedSources;
172 private static void AssertAllowed()
174 if (!(approvedSources is
null))
181 StringBuilder sb =
new StringBuilder();
183 sb.Append(this.bareJid);
185 sb.Append(this.legalId);
187 sb.Append(this.state.ToString());
189 sb.Append(this.timestamp.ToString());
191 if (!(this.publicKey is
null))
194 sb.Append(Convert.ToBase64String(
this.publicKey));
197 if (!
string.IsNullOrEmpty(this.keyName))
200 sb.Append(this.keyName);
203 if (!
string.IsNullOrEmpty(this.keyNamespace))
206 sb.Append(this.keyNamespace);
209 if (!(this.privateKey is
null))
211 sb.Append(
", PrivateKey");
214 return sb.ToString();
Contains information about a legal identity generated by the client.
bool HasPrivateKey
If a private key snapshot is available for the legal identity.
CaseInsensitiveString BareJid
Bare JID of client applying for the identity.
DateTime Timestamp
Timestamp when the legal identity was created or last updated.
string KeyNamespace
Namespace of key algorithm used when the identity was created.
string KeyName
Name of key algorithm used when the identity was created.
string[] EncryptedProperties
Array of properties that are encrypted.
LegalIdentityState(string LegalId)
Contains information about a legal identity generated by the client.
IdentityState State
State of the legal identity.
CaseInsensitiveString LegalId
Identity string assigned to the legal identity.
static void SetAllowedSources(ICallStackCheck[] ApprovedSources)
If access to sensitive properties is only accessible from a set of approved sources.
override string ToString()
byte[] PublicKey
Public Key used by the cryptographic algororithm used to sign the identity application.
LegalIdentityState()
Contains information about a legal identity generated by the client.
byte[] PrivateKey
Private key snapshot stored with the legal identity.
Represents a case-insensitive string.
static readonly CaseInsensitiveString Empty
Empty case-insensitive string
Static class containing methods that can be used to make sure calls are made from appropriate locatio...
static void CallFromSource(params string[] Sources)
Makes sure the call is made from one of the listed sources.
Interface for objects containing encrypted properties. Mark the properties that are encrypted with th...
Interface for call stack checks.
IdentityState
Lists recognized legal identity states.
TypeNameSerialization
How the type name should be serialized.