Skip to content

Commit

Permalink
Merge branch 'release/2.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
theofanis committed Oct 9, 2024
2 parents 0787f06 + 270c3a1 commit b9a829a
Show file tree
Hide file tree
Showing 13 changed files with 265 additions and 59 deletions.
4 changes: 3 additions & 1 deletion src/BolWallet/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ internal class Constants
public const string BirthDateFormat = "yyyy-MM-dd";
public const string MainNet = "mainnet";
public const string TestNet = "testnet";

public const string DefaultHash = "0000000000000000000000000000000000000000000000000000000000000000";

// Preferences Keys
public const string TargetNet = "target-net";

// Static messages to re-use
public static readonly TargetNetworkChangedMessage TargetNetworkChangedMessage = new();
public static readonly WalletClosedMessage WalletClosedMessage = new();
public static readonly WalletCreatedMessage WalletCreatedMessage = new();

public static readonly JsonSerializerOptions WalletJsonSerializerDefaultOptions = new()
{
Expand Down
45 changes: 40 additions & 5 deletions src/BolWallet/Models/EncryptedCitizenshipForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,55 @@ public string ThirdName
set => _thirdName = value?.ToUpper() ?? "";
}

private string _identityCardSha256;

[RegularExpression("^[A-F0-9]*$", ErrorMessage = "Only capital letters and numbers are allowed.")]
[StringLength(64, MinimumLength = 64, ErrorMessage = "The SHA-256 hash must be exactly 64 characters.")]
public string IdentityCardSha256 { get; set; }
public string IdentityCardSha256
{
get => _identityCardSha256;
set => _identityCardSha256 = value?.ToUpper();
}

private string _identityCardBackSha256;

[RegularExpression("^[A-F0-9]*$", ErrorMessage = "Only capital letters and numbers are allowed.")]
[StringLength(64, MinimumLength = 64, ErrorMessage = "The SHA-256 hash must be exactly 64 characters.")]
public string IdentityCardBackSha256 { get; set; }
public string IdentityCardBackSha256
{
get => _identityCardBackSha256;
set => _identityCardBackSha256 = value?.ToUpper();
}

private string _passportSha256;

[RegularExpression("^[A-F0-9]*$", ErrorMessage = "Only capital letters and numbers are allowed.")]
[StringLength(64, MinimumLength = 64, ErrorMessage = "The SHA-256 hash must be exactly 64 characters.")]
public string PassportSha256 { get; set; }
public string PassportSha256
{
get => _passportSha256;
set => _passportSha256 = value?.ToUpper();
}

private string _proofOfNinSha256;

[RegularExpression("^[A-F0-9]*$", ErrorMessage = "Only capital letters and numbers are allowed.")]
[StringLength(64, MinimumLength = 64, ErrorMessage = "The SHA-256 hash must be exactly 64 characters.")]
public string ProofOfNinSha256 { get; set; }
public string ProofOfNinSha256
{
get => _proofOfNinSha256;
set => _proofOfNinSha256 = value?.ToUpper();
}

private string _birthCertificateSha256;

[RegularExpression("^[A-F0-9]*$", ErrorMessage = "Only capital letters and numbers are allowed.")]
[StringLength(64, MinimumLength = 64, ErrorMessage = "The SHA-256 hash must be exactly 64 characters.")]
public string BirthCertificateSha256 { get; set; }
public string BirthCertificateSha256
{
get => _birthCertificateSha256;
set => _birthCertificateSha256 = value?.ToUpper();
}
}

public class EncryptedCitizenshipData
Expand Down
67 changes: 66 additions & 1 deletion src/BolWallet/Models/GenericHashTableForm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace BolWallet.Models
using System.ComponentModel.DataAnnotations;

namespace BolWallet.Models
{
public partial class GenericHashTableForm : ObservableObject
{
Expand All @@ -13,5 +15,68 @@ public partial class GenericHashTableForm : ObservableObject
public string PersonalVoice { get; set; }
public string ProofOfCommunication { get; set; }
public string ProofOfResidence { get; set; }
}

public class GenericSHA256TableForm : ObservableObject
{
private string _drivingLicense;

[RegularExpression("^[A-F0-9]*$", ErrorMessage = "Only capital letters and numbers are allowed.")]
[StringLength(64, MinimumLength = 64, ErrorMessage = "The SHA-256 hash must be exactly 64 characters.")]
public string DrivingLicense
{
get => _drivingLicense;
set => _drivingLicense = value?.ToUpper();
}

private string _otherIdentity;

[RegularExpression("^[A-F0-9]*$", ErrorMessage = "Only capital letters and numbers are allowed.")]
[StringLength(64, MinimumLength = 64, ErrorMessage = "The SHA-256 hash must be exactly 64 characters.")]
public string OtherIdentity
{
get => _otherIdentity;
set => _otherIdentity = value?.ToUpper();
}

private string _facePhoto;

[RegularExpression("^[A-F0-9]*$", ErrorMessage = "Only capital letters and numbers are allowed.")]
[StringLength(64, MinimumLength = 64, ErrorMessage = "The SHA-256 hash must be exactly 64 characters.")]
public string FacePhoto
{
get => _facePhoto;
set => _facePhoto = value?.ToUpper();
}

private string _personalVoice;

[RegularExpression("^[A-F0-9]*$", ErrorMessage = "Only capital letters and numbers are allowed.")]
[StringLength(64, MinimumLength = 64, ErrorMessage = "The SHA-256 hash must be exactly 64 characters.")]
public string PersonalVoice
{
get => _personalVoice;
set => _personalVoice = value?.ToUpper();
}

private string _proofOfCommunication;

[RegularExpression("^[A-F0-9]*$", ErrorMessage = "Only capital letters and numbers are allowed.")]
[StringLength(64, MinimumLength = 64, ErrorMessage = "The SHA-256 hash must be exactly 64 characters.")]
public string ProofOfCommunication
{
get => _proofOfCommunication;
set => _proofOfCommunication = value?.ToUpper();
}

private string _proofOfResidence;

[RegularExpression("^[A-F0-9]*$", ErrorMessage = "Only capital letters and numbers are allowed.")]
[StringLength(64, MinimumLength = 64, ErrorMessage = "The SHA-256 hash must be exactly 64 characters.")]
public string ProofOfResidence
{
get => _proofOfResidence;
set => _proofOfResidence = value?.ToUpper();
}
}
}
3 changes: 3 additions & 0 deletions src/BolWallet/Models/Messages/WalletCreatedMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
namespace BolWallet.Models.Messages;

public record WalletCreatedMessage;
127 changes: 97 additions & 30 deletions src/BolWallet/Pages/CreateEdiPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,91 @@
<MudProgressCircular Color="Color.Primary" Style="height:170px;width:170px;" Indeterminate="true" />
</MudOverlay>
<MudGrid Style="padding:5px">
<Virtualize Items="IdentificationDocuments" Context="edi">
<MudSwitch Style="margin-left: auto; margin-top: 20px; text-align: right;" T="bool" Value="@ViewModel.IsSha256InputMode"
ValueChanged="@ViewModel.OnKnownHashInputModeChange"
Color="Color.Primary" Label="Switch to Hash Input Mode" />

@if (ViewModel.IsSha256InputMode)
{
<MudItem xs="12" sm="12" md="12">
<MudStack Row="true" @key="edi">
<MudField Style="width:150px" Label="@edi.Item3" Variant="MudBlazor.Variant.Text" InnerPadding="false"
Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.CheckCircle" AdornmentColor="@edi.Item2">@edi.Item4</MudField>
@if (edi.Item1 == "PersonalVoice")
{
<MudIconButton Icon="@Icons.Material.Filled.UploadFile" aria-label="@edi.Item1" OnClick="@(args => PickAudioFileAsync(edi.Item1))"></MudIconButton>
<MudIconButton Icon="@(ViewModel.IsRecording ? Icons.Material.Filled.Stop : Icons.Material.Filled.Mic)"
Color="@(ViewModel.IsRecording ? Color.Error : Color.Primary)" aria-label="@edi.Item1"
OnClick="@(async () => await StartAudioRecording())"></MudIconButton>
}
else
{
<MudIconButton Icon="@Icons.Material.Filled.UploadFile" aria-label="@edi.Item1" OnClick="@(args=>PickFileAsync(edi.Item1))"></MudIconButton>
<MudIconButton Icon="@Icons.Material.Filled.Photo" aria-label="@edi.Item1" OnClick="@(args=>PickPhotoAsync(edi.Item1))" />
<MudIconButton Icon="@Icons.Material.Filled.CameraAlt" aria-label="@edi.Item1" OnClick="@(args=>TakePhotoAsync(edi.Item1))"></MudIconButton>
}
</MudStack>
<EditForm Model="@ViewModel.GenericSHA256TableForm" OnValidSubmit="Submit">
<DataAnnotationsValidator />
<MudStack Row="false">
<MudTextField @bind-Value="@ViewModel.GenericSHA256TableForm.FacePhoto"
OnBlur="@(x => ViewModel.GenericSHA256TableForm.FacePhoto = ViewModel.GenericSHA256TableForm.FacePhoto?.Trim().ToUpper())"
For="@(() => ViewModel.GenericSHA256TableForm.FacePhoto)"
Variant="Variant.Outlined"
Label="Face Photo SHA-256*" />

<MudTextField @bind-Value="@ViewModel.GenericSHA256TableForm.PersonalVoice"
OnBlur="@(x => ViewModel.GenericSHA256TableForm.PersonalVoice = ViewModel.GenericSHA256TableForm.PersonalVoice?.Trim().ToUpper())"
For="@(() => ViewModel.GenericSHA256TableForm.PersonalVoice)"
Variant="Variant.Outlined"
Label="Personal Voice SHA-256*" />

<MudTextField @bind-Value="@ViewModel.GenericSHA256TableForm.DrivingLicense"
OnBlur="@(x => ViewModel.GenericSHA256TableForm.DrivingLicense = ViewModel.GenericSHA256TableForm.DrivingLicense?.Trim().ToUpper())"
For="@(() => ViewModel.GenericSHA256TableForm.DrivingLicense)"
Variant="Variant.Outlined"
Label="Driving License SHA-256" />

<MudTextField @bind-Value="@ViewModel.GenericSHA256TableForm.OtherIdentity"
OnBlur="@(x => ViewModel.GenericSHA256TableForm.OtherIdentity = ViewModel.GenericSHA256TableForm.OtherIdentity?.Trim().ToUpper())"
For="@(() => ViewModel.GenericSHA256TableForm.OtherIdentity)"
Variant="Variant.Outlined"
Label="Other Identity SHA-256" />

<MudTextField @bind-Value="@ViewModel.GenericSHA256TableForm.ProofOfCommunication"
OnBlur="@(x => ViewModel.GenericSHA256TableForm.ProofOfCommunication = ViewModel.GenericSHA256TableForm.ProofOfCommunication?.Trim().ToUpper())"
For="@(() => ViewModel.GenericSHA256TableForm.ProofOfCommunication)"
Variant="Variant.Outlined"
Label="Proof Of Communication SHA-256" />

<MudTextField @bind-Value="@ViewModel.GenericSHA256TableForm.ProofOfResidence"
OnBlur="@(x => ViewModel.GenericSHA256TableForm.ProofOfResidence = ViewModel.GenericSHA256TableForm.ProofOfResidence?.Trim().ToUpper())"
For="@(() => ViewModel.GenericSHA256TableForm.ProofOfResidence)"
Variant="Variant.Outlined"
Label="Proof Of Residence SHA-256" />
</MudStack>
<MudItem xs="12" sm="12" md="12">
<div class="text-center mt-3">
<MudButton Variant="MudBlazor.Variant.Filled" OnClick="Submit" Class="ml-auto" Color="Color.Primary" Disabled="@(string.IsNullOrEmpty(ViewModel.GenericSHA256TableForm.PersonalVoice) || string.IsNullOrEmpty(ViewModel.GenericSHA256TableForm.FacePhoto))">Submit</MudButton>
</div>
</MudItem>
</EditForm>

</MudItem>
</Virtualize>
<MudItem xs="12" sm="12" md="12">
<div class="text-center">
<MudButton Variant="MudBlazor.Variant.Filled" OnClick="Submit" Class="ml-auto" Color="Color.Primary" Disabled="@(!(isPersonalVoiceSumbitted && isFacePhotoSumbitted))">Submit</MudButton>
</div>
</MudItem>

}
else
{
<Virtualize Items="IdentificationDocuments" Context="edi">
<MudItem xs="12" sm="12" md="12">
<MudStack Row="true" @key="edi">
<MudField Style="width:150px" Label="@edi.Item3" Variant="MudBlazor.Variant.Text" InnerPadding="false"
Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.CheckCircle" AdornmentColor="@edi.Item2">@edi.Item4</MudField>
@if (edi.Item1 == "PersonalVoice")
{
<MudIconButton Icon="@Icons.Material.Filled.UploadFile" aria-label="@edi.Item1" OnClick="@(args => PickAudioFileAsync(edi.Item1))"></MudIconButton>
<MudIconButton Icon="@(ViewModel.IsRecording ? Icons.Material.Filled.Stop : Icons.Material.Filled.Mic)"
Color="@(ViewModel.IsRecording ? Color.Error : Color.Primary)" aria-label="@edi.Item1"
OnClick="@(async () => await StartAudioRecording())"></MudIconButton>
}
else
{
<MudIconButton Icon="@Icons.Material.Filled.UploadFile" aria-label="@edi.Item1" OnClick="@(args=>PickFileAsync(edi.Item1))"></MudIconButton>
<MudIconButton Icon="@Icons.Material.Filled.Photo" aria-label="@edi.Item1" OnClick="@(args=>PickPhotoAsync(edi.Item1))" />
<MudIconButton Icon="@Icons.Material.Filled.CameraAlt" aria-label="@edi.Item1" OnClick="@(args=>TakePhotoAsync(edi.Item1))"></MudIconButton>
}
</MudStack>
</MudItem>
</Virtualize>
<MudItem xs="12" sm="12" md="12">
<div class="text-center">
<MudButton Variant="MudBlazor.Variant.Filled" OnClick="Submit" Class="ml-auto" Color="Color.Primary" Disabled="@(!(isPersonalVoiceSumbitted && isFacePhotoSumbitted))">Submit</MudButton>
</div>
</MudItem>
}
</MudGrid>

@if (ViewModel.IsRecording)
Expand All @@ -54,7 +113,7 @@
.text-center {
text-align: center;
}
.recording-overlay {
position: fixed;
top: 0;
Expand All @@ -67,7 +126,7 @@
align-items: center;
justify-content: center;
}
.recording-dialog {
background-color: white;
padding: 20px;
Expand All @@ -78,6 +137,7 @@
}
</style>

@code {
CreateEdiViewModel createEdiViewModel;

Expand Down Expand Up @@ -112,8 +172,15 @@
ViewModel.IsLoading = true;
StateHasChanged();
});

await createEdiViewModel.SubmitCommand.ExecuteAsync(null);

if (ViewModel.IsSha256InputMode)
{
await createEdiViewModel.SubmitHashFormCommand.ExecuteAsync(null);
}
else
{
await createEdiViewModel.SubmitCommand.ExecuteAsync(null);
}

await InvokeAsync(() =>
{
Expand Down Expand Up @@ -149,7 +216,7 @@
ViewModel.IsLoading = true;
StateHasChanged();
});

await UpdateIdentificationDocumentsList(property);
}
catch (Exception e)
Expand Down Expand Up @@ -179,7 +246,7 @@
ViewModel.IsLoading = true;
StateHasChanged();
});

await UpdateIdentificationDocumentsList(property);
}
catch (Exception e)
Expand Down
9 changes: 4 additions & 5 deletions src/BolWallet/Pages/EcryptedCitizenshipPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,12 @@
{
var submittedForm = context.Model as EncryptedCitizenshipForm;

if(false){
await ViewModel.SubmitFormCommand.ExecuteAsync(submittedForm);

if (ViewModel.IsSha256InputMode)
{
await ViewModel.SubmitHashFormCommand.ExecuteAsync(submittedForm);
}
else{
await ViewModel.SubmitHashFormCommand.ExecuteAsync(submittedForm);

await ViewModel.SubmitFormCommand.ExecuteAsync(submittedForm);
}
}
catch (Exception ex)
Expand Down
4 changes: 2 additions & 2 deletions src/BolWallet/Pages/WalletCreationInfo.razor
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
<MudCheckBox @bind-Value="IsCitizenshipChecked" Label="Submit all citizenships you hold." />
</MudListItem>
<MudListItem>
<MudCheckBox @bind-Value="IsNameFilledCorrectly" Label="Provide your full personal details exactly as they appear in your passport or ID (including name, birthdate, etc.)." />
<MudCheckBox @bind-Value="IsNameFilledCorrectly" Label="Provide your details exactly as they appear in your passport or ID (including name, birthdate, etc.)." />
</MudListItem>
<MudListItem>
<MudCheckBox @bind-Value="IsNINCorrect" Label="Provide the correct National Identification Number (NIN) for your country." />
<MudCheckBox @bind-Value="IsNINCorrect" Label="Use the correct National Identification Number (NIN) for your country. (Submit only last 5 digits)" />
</MudListItem>
</MudList>

Expand Down
4 changes: 2 additions & 2 deletions src/BolWallet/Platforms/MacCatalyst/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
<string>processing</string>
</array>
<key>CFBundleVersion</key>
<string>2024.1004.1800</string>
<string>2024.1009.1430</string>
<key>CFBundleShortVersionString</key>
<string>2.1.0</string>
<string>2.2.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>NSHumanReadableCopyright</key>
Expand Down
4 changes: 2 additions & 2 deletions src/BolWallet/Platforms/iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
<key>NSPhotoLibraryUsageDescription</key>
<string>The app can use the photo library to select photos from your library and use them when creating a new wallet.</string>
<key>CFBundleVersion</key>
<string>2024.1004.1800</string>
<string>2024.1009.1430</string>
<key>CFBundleShortVersionString</key>
<string>2.1.0</string>
<string>2.2.0</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>NSHumanReadableCopyright</key>
Expand Down
Loading

0 comments on commit b9a829a

Please sign in to comment.