Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
ContractOrchestratorService.cs
10using NeuroFeatures;
11using System.Globalization;
12using System.Reflection;
13using System.Text;
21
23{
24 [Singleton]
25 internal class ContractOrchestratorService : LoadableService, IContractOrchestratorService
26 {
27 public ContractOrchestratorService()
28 {
29 }
30
31 public override Task Load(bool IsResuming, CancellationToken CancellationToken)
32 {
33 if (this.BeginLoad(IsResuming, CancellationToken))
34 {
35 ServiceRef.XmppService.ConnectionStateChanged += this.Contracts_ConnectionStateChanged;
36 ServiceRef.XmppService.PetitionForPeerReviewIdReceived += this.Contracts_PetitionForPeerReviewIdReceived;
37 ServiceRef.XmppService.PetitionForIdentityReceived += this.Contracts_PetitionForIdentityReceived;
38 ServiceRef.XmppService.PetitionForSignatureReceived += this.Contracts_PetitionForSignatureReceived;
39 ServiceRef.XmppService.PetitionedIdentityResponseReceived += this.Contracts_PetitionedIdentityResponseReceived;
40 ServiceRef.XmppService.PetitionedPeerReviewIdResponseReceived += this.Contracts_PetitionedPeerReviewResponseReceived;
41 ServiceRef.XmppService.SignaturePetitionResponseReceived += this.Contracts_SignaturePetitionResponseReceived;
42 ServiceRef.XmppService.ContractProposalReceived += this.Contracts_ContractProposalRecieved;
43
44 this.EndLoad(true);
45 }
46
47 return Task.CompletedTask;
48 }
49
50 public override Task Unload()
51 {
52 if (this.BeginUnload())
53 {
54 ServiceRef.XmppService.ConnectionStateChanged -= this.Contracts_ConnectionStateChanged;
55 ServiceRef.XmppService.PetitionForPeerReviewIdReceived -= this.Contracts_PetitionForPeerReviewIdReceived;
56 ServiceRef.XmppService.PetitionForIdentityReceived -= this.Contracts_PetitionForIdentityReceived;
57 ServiceRef.XmppService.PetitionForSignatureReceived -= this.Contracts_PetitionForSignatureReceived;
58 ServiceRef.XmppService.PetitionedIdentityResponseReceived -= this.Contracts_PetitionedIdentityResponseReceived;
59 ServiceRef.XmppService.PetitionedPeerReviewIdResponseReceived -= this.Contracts_PetitionedPeerReviewResponseReceived;
60 ServiceRef.XmppService.SignaturePetitionResponseReceived -= this.Contracts_SignaturePetitionResponseReceived;
61 ServiceRef.XmppService.ContractProposalReceived -= this.Contracts_ContractProposalRecieved;
62
63 this.EndUnload();
64 }
65
66 return Task.CompletedTask;
67 }
68
69 #region Event Handlers
70
71 private async Task Contracts_PetitionForPeerReviewIdReceived(object? Sender, SignaturePetitionEventArgs e)
72 {
73 try
74 {
75 LegalIdentity Identity = e.RequestorIdentity;
76
77 if (Identity?.Properties is not null)
78 {
79 foreach (Property Property in Identity.Properties)
80 {
81 switch (Property.Name)
82 {
114 break;
115
116 default:
117 byte[] Signature = await ServiceRef.XmppService.Sign(e.ContentToSign, SignWith.LatestApprovedId);
118
119 await ServiceRef.XmppService.SendPetitionSignatureResponse(e.SignatoryIdentityId, e.ContentToSign, Signature,
120 e.PetitionId, e.RequestorFullJid, false);
121
122 return;
123 }
124 }
125
126 PetitionPeerReviewNavigationArgs Args = new(Identity, e.RequestorFullJid, e.SignatoryIdentityId, e.PetitionId,
127 e.Purpose, e.ContentToSign);
128
130 }
131 }
132 catch (Exception ex)
133 {
134 ServiceRef.LogService.LogException(ex);
135 }
136 }
137
138 private async Task Contracts_PetitionForIdentityReceived(object? Sender, LegalIdentityPetitionEventArgs e)
139 {
140 try
141 {
142 LegalIdentity Identity;
143
144 if (e.RequestedIdentityId == ServiceRef.TagProfile.LegalIdentity?.Id)
145 Identity = ServiceRef.TagProfile.LegalIdentity;
146 else
147 {
148 (bool Succeeded, LegalIdentity? LegalId) = await ServiceRef.NetworkService.TryRequest(() => ServiceRef.XmppService.GetLegalIdentity(e.RequestedIdentityId));
149
150 if (!Succeeded || LegalId is null)
151 return;
152
153 Identity = LegalId;
154 }
155
156 if (Identity is null)
157 {
158 ServiceRef.LogService.LogWarning("Identity is missing or cannot be retrieved, ignore.",
159 new KeyValuePair<string, object?>("Type", this.GetType().Name),
160 new KeyValuePair<string, object?>("Method", nameof(Contracts_PetitionForIdentityReceived)));
161
162 return;
163 }
164
165 if (Identity.State == IdentityState.Compromised ||
166 Identity.State == IdentityState.Rejected)
167 {
168 await ServiceRef.NetworkService.TryRequest(() =>
169 {
170 return ServiceRef.XmppService.SendPetitionIdentityResponse(
171 e.RequestedIdentityId, e.PetitionId, e.RequestorFullJid, false);
172 });
173 }
174 else
175 {
176 Identity = e.RequestorIdentity;
177
178 if (Identity is not null)
179 {
180 await ServiceRef.UiService.GoToAsync(nameof(PetitionIdentityPage), new PetitionIdentityNavigationArgs(
181 Identity, e.RequestorFullJid, e.RequestedIdentityId, e.PetitionId, e.Purpose));
182 }
183 }
184 }
185 catch (Exception ex)
186 {
187 ServiceRef.LogService.LogException(ex);
188 }
189 }
190
191 private async Task Contracts_PetitionForSignatureReceived(object? Sender, SignaturePetitionEventArgs e)
192 {
193 try
194 {
195 LegalIdentity Identity;
196
197 if (e.SignatoryIdentityId == ServiceRef.TagProfile.LegalIdentity?.Id)
198 Identity = ServiceRef.TagProfile.LegalIdentity;
199 else
200 {
201 (bool Succeeded, LegalIdentity? LegalId) = await ServiceRef.NetworkService.TryRequest(() => ServiceRef.XmppService.GetLegalIdentity(e.SignatoryIdentityId));
202 if (!Succeeded || LegalId is null)
203 return;
204
205 Identity = LegalId;
206 }
207
208 if (Identity is null)
209 {
210 ServiceRef.LogService.LogWarning("Identity is missing or cannot be retrieved, ignore.",
211 new KeyValuePair<string, object?>("Type", this.GetType().Name),
212 new KeyValuePair<string, object?>("Method", nameof(Contracts_PetitionForSignatureReceived)));
213
214 return;
215 }
216
217 if (Identity.State == IdentityState.Compromised || Identity.State == IdentityState.Rejected)
218 {
219 await ServiceRef.NetworkService.TryRequest(() =>
220 {
221 return ServiceRef.XmppService.SendPetitionSignatureResponse(
222 e.SignatoryIdentityId, e.ContentToSign, [], e.PetitionId, e.RequestorFullJid, false);
223 });
224 }
225 else
226 {
227 Identity = e.RequestorIdentity;
228
229 if (Identity is not null)
230 {
231 if (!await App.AuthenticateUser(AuthenticationPurpose.PetitionForSignatureReceived))
232 return;
233
235 Identity, e.RequestorFullJid, e.SignatoryIdentityId, e.ContentToSign, e.PetitionId, e.Purpose));
236 }
237 }
238 }
239 catch (Exception ex)
240 {
241 ServiceRef.LogService.LogException(ex);
242 }
243 }
244
245 private async Task Contracts_PetitionedIdentityResponseReceived(object? Sender, LegalIdentityPetitionResponseEventArgs e)
246 {
247 try
248 {
249 LegalIdentity Identity = e.RequestedIdentity;
250
251 if (!e.Response || Identity is null)
252 {
254 ServiceRef.Localizer[nameof(AppResources.Message)],
255 ServiceRef.Localizer[nameof(AppResources.SignaturePetitionDenied)],
256 ServiceRef.Localizer[nameof(AppResources.Ok)]);
257 }
258 else
259 await ServiceRef.UiService.GoToAsync(nameof(ViewIdentityPage), new ViewIdentityNavigationArgs(Identity));
260 }
261 catch (Exception ex)
262 {
263 ServiceRef.LogService.LogException(ex);
264 }
265 }
266
267 private async Task Contracts_PetitionedPeerReviewResponseReceived(object? Sender, SignaturePetitionResponseEventArgs e)
268 {
269 try
270 {
271 LegalIdentity? ReviewedIdentity = ServiceRef.TagProfile.IdentityApplication;
272 if (ReviewedIdentity is null)
273 return;
274
275 if (!e.Response)
276 {
278 ServiceRef.Localizer[nameof(AppResources.PeerReviewRejected)],
279 ServiceRef.Localizer[nameof(AppResources.APeerYouRequestedToReviewHasRejected)],
280 ServiceRef.Localizer[nameof(AppResources.Ok)]);
281
282 return;
283 }
284
285 LegalIdentity ReviewerIdentity = e.RequestedIdentity;
286 if (ReviewerIdentity is null)
287 return;
288
289 try
290 {
291 StringBuilder Xml = new();
292 ReviewedIdentity.Serialize(Xml, true, true, true, true, true, true, true);
293 string s = Xml.ToString();
294 byte[] Data = Encoding.UTF8.GetBytes(s);
295 bool? Result;
296
297 try
298 {
299 Result = ServiceRef.XmppService.ValidateSignature(ReviewerIdentity, Data, e.Signature);
300 }
301 catch (Exception ex)
302 {
304 return;
305 }
306
307 if (!Result.HasValue || !Result.Value)
308 {
310 ServiceRef.Localizer[nameof(AppResources.PeerReviewRejected)],
311 ServiceRef.Localizer[nameof(AppResources.APeerYouRequestedToReviewHasBeenRejectedDueToSignatureError)],
312 ServiceRef.Localizer[nameof(AppResources.Ok)]);
313 }
314 else
315 {
316 (bool Succeeded, LegalIdentity? LegalIdentity) = await ServiceRef.NetworkService.TryRequest(async () =>
317 {
318 LegalIdentity Result = await ServiceRef.XmppService.AddPeerReviewIdAttachment(ReviewedIdentity, ReviewerIdentity, e.Signature);
319 await ServiceRef.TagProfile.IncrementNrPeerReviews();
320 return Result;
321 });
322
323 if (Succeeded)
324 {
326 ServiceRef.Localizer[nameof(AppResources.PeerReviewAccepted)],
327 ServiceRef.Localizer[nameof(AppResources.APeerReviewYouhaveRequestedHasBeenAccepted)],
328 ServiceRef.Localizer[nameof(AppResources.Ok)]);
329 }
330 }
331 }
332 catch (Exception ex)
333 {
334 ServiceRef.LogService.LogException(ex);
336 ServiceRef.Localizer[nameof(AppResources.ErrorTitle)], ex.Message,
337 ServiceRef.Localizer[nameof(AppResources.Ok)]);
338 }
339 }
340 catch (Exception ex)
341 {
342 ServiceRef.LogService.LogException(ex);
343 }
344 }
345
346 private async Task Contracts_ContractProposalRecieved(object? sender, ContractProposalEventArgs e)
347 {
348 try
349 {
350 Contract Contract = await ServiceRef.XmppService.GetContract(e.ContractId);
351
352 await ServiceRef.UiService.GoToAsync(nameof(ViewContractPage), new ViewContractNavigationArgs(
353 Contract, false, e.Role, e.MessageText));
354 }
355 catch (Exception ex)
356 {
357 ServiceRef.LogService.LogException(ex);
358 }
359 }
360
361 private Task Contracts_ConnectionStateChanged(object _, XmppState NewState)
362 {
363 try
364 {
365 if (ServiceRef.XmppService.IsOnline && ServiceRef.TagProfile.IsCompleteOrWaitingForValidation())
366 {
367 if (ServiceRef.TagProfile.LegalIdentity is not null)
368 {
369 Task _2 = Task.Run(async () =>
370 {
371 try
372 {
373 await Task.Delay(Constants.Timeouts.XmppInit);
374 await ReDownloadLegalIdentity();
375 }
376 catch (Exception ex)
377 {
378 ServiceRef.LogService.LogException(ex);
379 }
380 });
381 }
382 }
383 }
384 catch (Exception ex)
385 {
386 ServiceRef.LogService.LogException(ex);
387 }
388
389 return Task.CompletedTask;
390 }
391
392 #endregion
393
394 protected static async Task ReDownloadLegalIdentity()
395 {
396 if (ServiceRef.XmppService is null ||
397 !await ServiceRef.XmppService.WaitForConnectedState(Constants.Timeouts.XmppConnect) ||
398 !ServiceRef.XmppService.IsOnline ||
399 ServiceRef.TagProfile.LegalIdentity is null)
400 {
401 return;
402 }
403
404 LegalIdentity? Identity;
405
406 try
407 {
408 Identity = await ServiceRef.XmppService!.GetLegalIdentity(ServiceRef.TagProfile.LegalIdentity.Id);
409 }
410 catch (ForbiddenException) // Old ID belonging to a previous account, for example. Simply discard.
411 {
412 await ServiceRef.TagProfile.ClearLegalIdentity();
414 return;
415 }
416 catch (Exception ex)
417 {
418 ServiceRef.LogService.LogException(ex);
419 return;
420 }
421
422 if (Identity is not null)
423 {
424 MainThread.BeginInvokeOnMainThread(async () =>
425 {
426 string? userMessage = null;
427 bool gotoRegistrationPage = false;
428
429 if (Identity.State == IdentityState.Compromised)
430 {
431 userMessage = ServiceRef.Localizer[nameof(AppResources.YourLegalIdentityHasBeenCompromised)];
432 await ServiceRef.TagProfile.CompromiseLegalIdentity(Identity);
433 gotoRegistrationPage = true;
434 }
435 else if (Identity.State == IdentityState.Obsoleted)
436 {
437 userMessage = ServiceRef.Localizer[nameof(AppResources.YourLegalIdentityHasBeenObsoleted)];
438 await ServiceRef.TagProfile.RevokeLegalIdentity(Identity);
439 gotoRegistrationPage = true;
440 }
441 else if (Identity.State == IdentityState.Approved && !await ServiceRef.XmppService!.HasPrivateKey(Identity.Id))
442 {
443 bool Response = await ServiceRef.UiService.DisplayAlert(
444 ServiceRef.Localizer[nameof(AppResources.WarningTitle)],
445 ServiceRef.Localizer[nameof(AppResources.UnableToGetAccessToYourPrivateKeys)],
446 ServiceRef.Localizer[nameof(AppResources.Continue)],
447 ServiceRef.Localizer[nameof(AppResources.Repair)]);
448
449 if (Response)
450 await ServiceRef.TagProfile.SetLegalIdentity(Identity, true);
451 else
452 {
453 try
454 {
455 File.WriteAllText(Path.Combine(ServiceRef.StorageService.DataFolder, "Start.txt"),
456 DateTime.Now.AddHours(1).Ticks.ToString(CultureInfo.InvariantCulture));
457 }
458 catch (Exception ex)
459 {
460 ServiceRef.LogService.LogException(ex);
461 }
462
463 await App.Stop();
464 return;
465 }
466 }
467 else
468 await ServiceRef.TagProfile.SetLegalIdentity(Identity, true);
469
470 if (gotoRegistrationPage)
471 {
473
474 // After navigating to the registration page, show the user why this happened.
475 if (!string.IsNullOrWhiteSpace(userMessage))
476 {
477 // Do a begin invoke here so the page animation has time to finish,
478 // and the view model loads state et.c. before showing the alert.
479 // This gives a better UX experience.
480 MainThread.BeginInvokeOnMainThread(async () =>
481 {
483 ServiceRef.Localizer[nameof(AppResources.YourLegalIdentity)], userMessage);
484 });
485 }
486 }
487 });
488 }
489 }
490
496 public async Task OpenLegalIdentity(string LegalId, string Purpose)
497 {
498 try
499 {
500 LegalIdentity identity = await ServiceRef.XmppService.GetLegalIdentity(LegalId);
501 MainThread.BeginInvokeOnMainThread(async () =>
502 {
503 await ServiceRef.UiService.GoToAsync(nameof(ViewIdentityPage), new ViewIdentityNavigationArgs(identity));
504 });
505 }
506 catch (ForbiddenException)
507 {
508 // This happens if you try to view someone else's legal identity.
509 // When this happens, try to send a petition to view it instead.
510 // Normal operation. Should not be logged.
511
512 MainThread.BeginInvokeOnMainThread(async () =>
513 {
514 bool succeeded = await ServiceRef.NetworkService.TryRequest(() => ServiceRef.XmppService.PetitionIdentity(LegalId, Guid.NewGuid().ToString(), Purpose));
515 if (succeeded)
516 {
518 ServiceRef.Localizer[nameof(AppResources.PetitionSent)],
519 ServiceRef.Localizer[nameof(AppResources.APetitionHasBeenSentToTheOwner)]);
520 }
521 });
522 }
523 catch (Exception ex)
524 {
525 ServiceRef.LogService.LogException(ex, this.GetClassAndMethod(MethodBase.GetCurrentMethod()));
527 }
528 }
529
536 public async Task<LegalIdentity?> TryGetLegalIdentity(string LegalId, string Purpose)
537 {
538 try
539 {
540 LegalIdentity Identity = await ServiceRef.XmppService.GetLegalIdentity(LegalId);
541 return Identity;
542 }
543 catch (ForbiddenException)
544 {
545 // This happens if you try to view someone else's legal identity.
546 // When this happens, try to send a petition to view it instead.
547 // Normal operation. Should not be logged.
548
549 await ServiceRef.XmppService.PetitionIdentity(LegalId, Guid.NewGuid().ToString(), Purpose);
550 return null;
551 }
552 catch (Exception ex)
553 {
554 ServiceRef.LogService.LogException(ex, this.GetClassAndMethod(MethodBase.GetCurrentMethod()));
555 return null;
556 }
557 }
558
565 public async Task OpenContract(string ContractId, string Purpose, Dictionary<CaseInsensitiveString, object>? ParameterValues)
566 {
567 try
568 {
569 Contract Contract = await ServiceRef.XmppService.GetContract(ContractId);
570
571 ContractReference Ref = await Database.FindFirstDeleteRest<ContractReference>(
572 new FilterFieldEqualTo("ContractId", Contract.ContractId));
573
574 if (Ref is not null)
575 {
576 if (Ref.Updated != Contract.Updated || !Ref.ContractLoaded)
577 {
578 await Ref.SetContract(Contract);
579 await Database.Update(Ref);
580 }
581
582 ServiceRef.TagProfile.CheckContractReference(Ref);
583 }
584
585 MainThread.BeginInvokeOnMainThread(async () =>
586 {
587 if (Contract.PartsMode == ContractParts.TemplateOnly && Contract.State == ContractState.Approved)
588 {
589 if (Ref is null)
590 {
591 Ref = new()
592 {
593 ContractId = Contract.ContractId
594 };
595
596 await Ref.SetContract(Contract);
597 await Database.Insert(Ref);
598
599 ServiceRef.TagProfile.CheckContractReference(Ref);
600 }
603 {
604 CreationAttributesEventArgs creationAttr = await ServiceRef.XmppService.GetNeuroFeatureCreationAttributes();
605 ParameterValues ??= [];
606 ParameterValues.Add(new CaseInsensitiveString("TrustProvider"), creationAttr.TrustProviderId);
607 }
608
609 NewContractNavigationArgs e = new(Contract, ParameterValues);
610
611 await ServiceRef.UiService.GoToAsync(nameof(NewContractPage), e, BackMethod.CurrentPage);
612 }
613 else
614 {
615 ViewContractNavigationArgs e = new(Contract, false);
616
618 }
619 });
620 }
621 catch (ForbiddenException)
622 {
623 // This happens if you try to view someone else's contract.
624 // When this happens, try to send a petition to view it instead.
625 // Normal operation. Should not be logged.
626
627 MainThread.BeginInvokeOnMainThread(async () =>
628 {
629 bool succeeded = await ServiceRef.NetworkService.TryRequest(() =>
630 ServiceRef.XmppService.PetitionContract(ContractId, Guid.NewGuid().ToString(), Purpose));
631
632 if (succeeded)
633 {
634 await ServiceRef.UiService.DisplayAlert(ServiceRef.Localizer[nameof(AppResources.PetitionSent)],
635 ServiceRef.Localizer[nameof(AppResources.APetitionHasBeenSentToTheContract)]);
636 }
637 });
638 }
639 catch (Exception ex)
640 {
641 ServiceRef.LogService.LogException(ex, this.GetClassAndMethod(MethodBase.GetCurrentMethod()));
643 }
644 }
645
650 public async Task TagSignature(string Request)
651 {
652 int i = Request.IndexOf(',');
653
654 if (i < 0)
655 throw new InvalidOperationException(ServiceRef.Localizer[nameof(AppResources.InvalidTagSignatureId)]);
656
657 string JID = System.Web.HttpUtility.UrlDecode(Request[..i]);
658 string Key = Request[(i + 1)..];
659
660 LegalIdentity ID = (ServiceRef.TagProfile.LegalIdentity)
661 ?? throw new InvalidOperationException(ServiceRef.Localizer[nameof(AppResources.NoLegalIdSelected)]);
662
663 if (ID.State != IdentityState.Approved)
664 throw new InvalidOperationException(ServiceRef.Localizer[nameof(AppResources.LegalIdNotApproved)]);
665
666 string IdRef = ServiceRef.TagProfile.LegalIdentity?.Id ?? string.Empty;
667
668 if (!await App.AuthenticateUser(AuthenticationPurpose.TagSignature))
669 return;
670
671 StringBuilder Xml = new();
672
673 Xml.Append("<ql xmlns='https://tagroot.io/schema/Signature' key='");
674 Xml.Append(XML.Encode(Key));
675 Xml.Append("' legalId='");
676 Xml.Append(XML.Encode(IdRef));
677 Xml.Append("'/>");
678
679 if (!ServiceRef.XmppService.IsOnline &&
680 !await ServiceRef.XmppService.WaitForConnectedState(TimeSpan.FromSeconds(10)))
681 {
682 throw new InvalidOperationException(ServiceRef.Localizer[nameof(AppResources.AppNotConnected)]);
683 }
684
685 await ServiceRef.XmppService.IqSetAsync(JID, Xml.ToString());
686 }
687
688 private async Task Contracts_SignaturePetitionResponseReceived(object? Sender, SignaturePetitionResponseEventArgs e)
689 {
690 try
691 {
692 LegalIdentity Identity = e.RequestedIdentity;
693
694 if (!e.Response || Identity is null)
695 {
697 ServiceRef.Localizer[nameof(AppResources.Message)],
698 ServiceRef.Localizer[nameof(AppResources.PetitionToViewLegalIdentityWasDenied)],
699 ServiceRef.Localizer[nameof(AppResources.Ok)]);
700 }
701 else
702 await ServiceRef.UiService.GoToAsync(nameof(ViewIdentityPage), new ViewIdentityNavigationArgs(Identity));
703 }
704 catch (Exception ex)
705 {
706 ServiceRef.LogService.LogException(ex);
707 }
708 }
709 }
710}
The Application class, representing an instance of the Neuro-Access app.
Definition: App.xaml.cs:69
static Task SetRegistrationPageAsync()
Switches the application to the on-boarding experience.
Definition: App.xaml.cs:658
static Task< bool > AuthenticateUser(AuthenticationPurpose Purpose, bool Force=false)
Authenticates the user using the configured authentication method.
Definition: App.xaml.cs:981
Machine-readable names in contracts.
Definition: Constants.cs:791
const string PaymentInstructionsNamespace
Namespace for payment instructions
Definition: Constants.cs:795
static readonly TimeSpan XmppInit
XMPP Init timeout
Definition: Constants.cs:576
static readonly TimeSpan XmppConnect
XMPP Connect timeout
Definition: Constants.cs:571
const string PersonalNumber
Personal number
Definition: Constants.cs:284
const string OrgAddress2
Organization Address line 2
Definition: Constants.cs:364
const string OrgArea
Organization Area
Definition: Constants.cs:369
const string OrgRegion
Organization Region
Definition: Constants.cs:384
const string Nationality
Nationality
Definition: Constants.cs:324
const string BirthYear
Birth Year
Definition: Constants.cs:344
const string OrgCity
Organization City
Definition: Constants.cs:374
const string OrgRole
Organization Role
Definition: Constants.cs:399
const string Phone
Phone number
Definition: Constants.cs:414
const string EMail
e-Mail address
Definition: Constants.cs:419
const string OrgZipCode
Organization Zip Code
Definition: Constants.cs:379
const string MiddleNames
Middle names
Definition: Constants.cs:274
const string OrgCountry
Organization Country
Definition: Constants.cs:389
const string OrgDepartment
Organization Department
Definition: Constants.cs:394
const string Address2
Address line 2
Definition: Constants.cs:294
const string OrgAddress
Organization Address line 1
Definition: Constants.cs:359
const string Address
Address line 1
Definition: Constants.cs:289
const string LastNames
Last names
Definition: Constants.cs:279
const string OrgNumber
Organization number
Definition: Constants.cs:354
const string BirthMonth
Birth Month
Definition: Constants.cs:339
const string FirstName
First name
Definition: Constants.cs:269
const string OrgName
Organization name
Definition: Constants.cs:349
A set of never changing property constants and helpful values.
Definition: Constants.cs:7
Contains a local reference to a contract that the user has created or signed.
bool ContractLoaded
If a local copy of the contract is available.
async Task SetContract(Contract Contract)
Sets a parsed contract.
DateTime Updated
When object was last updated.
bool BeginLoad(bool IsResuming, CancellationToken CancellationToken)
Sets the IsLoading flag if the service isn't already loading.
void EndLoad(bool isLoaded)
Sets the IsLoading and IsLoaded flags and fires an event representing the current load state of the s...
bool IsResuming
If App is resuming service.
bool BeginUnload()
Sets the IsLoading flag if the service isn't already unloading.
void EndUnload()
Sets the IsLoading and IsLoaded flags and fires an event representing the current load state of the s...
Base class that references services in the app.
Definition: ServiceRef.cs:31
static ILogService LogService
Log service.
Definition: ServiceRef.cs:91
static INetworkService NetworkService
Network service.
Definition: ServiceRef.cs:103
static IUiService UiService
Service serializing and managing UI-related tasks.
Definition: ServiceRef.cs:55
static ITagProfile TagProfile
TAG Profile service.
Definition: ServiceRef.cs:79
static IStringLocalizer Localizer
Localization service
Definition: ServiceRef.cs:235
static IXmppService XmppService
The XMPP service for XMPP communication.
Definition: ServiceRef.cs:67
A page that allows the user to create a new contract.
A page to display when the user wants to view an identity.
A page to display when the user is asked to petition an identity.
A page to display when the user is asked to review an identity application.
Holds navigation parameters specific to views displaying a petition of a signature.
A page to display when the user is asked to petition a signature.
const string NamespaceNeuroFeatures
Namespace for Neuro-Features.
Helps with common XML-related tasks.
Definition: XML.cs:19
static string Encode(string s)
Encodes a string for use in XML.
Definition: XML.cs:27
Contains the definition of a contract
Definition: Contract.cs:22
DateTime Updated
When the contract was last updated
Definition: Contract.cs:139
ContractParts PartsMode
How parts are defined in the smart contract.
Definition: Contract.cs:249
ContractState State
Contract state
Definition: Contract.cs:121
string ContractId
Contract identity
Definition: Contract.cs:65
string ForMachinesNamespace
Namespace used by the root node of the machine-readable contents of the contract (ForMachines).
Definition: Contract.cs:289
Abstract base class of signatures
Definition: Signature.cs:10
The requesting entity does not possess the necessary permissions to perform an action that only certa...
Represents a case-insensitive string.
Static interface for database persistence. In order to work, a database provider has to be assigned t...
Definition: Database.cs:19
static async Task Update(object Object)
Updates an object in the database.
Definition: Database.cs:626
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
Definition: Database.cs:95
This filter selects objects that have a named field equal to a given value.
Orchestrates operations on contracts upon receiving certain events, like approving or rejecting other...
Task DisplayException(Exception Exception, string? Title=null)
Displays an alert/message box to the user.
Task GoToAsync(string Route, BackMethod BackMethod=BackMethod.Inherited, string? UniqueId=null)
Navigates the AppShell to the specified route, with page arguments to match.
Task< bool > DisplayAlert(string Title, string Message, string? Accept=null, string? Cancel=null)
Displays an alert/message box to the user.
BackMethod
Navigation Back Method
Definition: BackMethod.cs:7
AuthenticationPurpose
Purpose for requesting the user to authenticate itself.
IdentityState
Lists recognized legal identity states.
SignWith
Options on what keys to use when signing data.
Definition: Enumerations.cs:84
ContractParts
How the parts of the contract are defined.
Definition: Part.cs:9
ContractState
Recognized contract states
Definition: Enumerations.cs:9
XmppState
State of XMPP connection.
Definition: XmppState.cs:7