Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion BREAKING_CHANGES.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# Breaking Changes
# Breaking Changes

## 2.0.0

* Added support for .NET 7.
* Dropped support for .NET 6.
* Renamed method parameters of `IBiometryService` from `keyName` to `key` and from `keyValue` to `value`.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ await biometryService.ScanBiometry(CancellationToken.None);
This method encrypts a value and stores it into the platform secure storage with the given key name.

``` cs
await biometryService.Encrypt(CancellationToken.None, "KeyName", "KeyValue");
await biometryService.Encrypt(CancellationToken.None, "Key", "Value");
```

On Android, a new `CryptoObject` from `AndroidX.Biometric` is created with a key as a parameter. Then the data is encrypted and presented to the `BiometricPrompt` manager.
Expand All @@ -182,7 +182,7 @@ On iOS, the `SecKeyChain` is used to store a string linked to a key. The OS is i
This method decrypts and gets the data associated to the given key.

``` cs
await biometryService.Decrypt(CancellationToken.None, "KeyName");
await biometryService.Decrypt(CancellationToken.None, "Key");
```

On Android, the method retrieves the shared preference encrypted data, then decrypts it with the secret as a parameter by presenting it to the `BiometricPrompt` manager.
Expand All @@ -194,7 +194,7 @@ On iOS, the method retrieves the encrypted data from the `SecKeyChain` with the
This method removes the ecrypted value from the platform secure storage.

``` cs
biometryService.Remove("KeyName");
biometryService.Remove("Key");
```

On Android, the method removes the encrypted data from the shared preferences.
Expand Down
15 changes: 4 additions & 11 deletions build/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ trigger:
include:
- main

resources:
containers:
- container: windows
image: nventive/vs_build-tools:17.2.5

variables:
- name: NUGET_VERSION
value: 6.2.0
Expand All @@ -29,8 +24,8 @@ variables:
value: nventive.internal.p12 # This is the certificate from the entreprise account used to sign internal builds.
- name: InternalKeystore
value: com.nventive.internal.applicationtemplate.jks
- name: windowsPoolName
value: 'windows 2022'
- name: windowsHostedAgentImage
value: 'windows-2022'

stages:
- stage: Build
Expand All @@ -45,7 +40,7 @@ stages:
GeneratePackageOnBuild: true

pool:
name: $(windowsPoolName)
vmImage: $(windowsHostedAgentImage)

variables:
- name: PackageOutputPath # Path where nuget packages will be copied to.
Expand All @@ -54,8 +49,6 @@ stages:
workspace:
clean: all # Cleanup the workspace before starting

container: windows

steps:
- template: stage-build.yml
parameters:
Expand All @@ -73,7 +66,7 @@ stages:
- job: Publish_NuGet_External

pool:
name: $(windowsPoolName)
vmImage: $(windowsHostedAgentImage)

workspace:
clean: all # Cleanup the workspace before starting
Expand Down
13 changes: 8 additions & 5 deletions build/stage-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
configFilePath: $(Build.SourcesDirectory)/build/gitversion.yml
displayName: 'Calculate version'

- task: DotNetCoreCLI@2
displayName: 'Install dotnet 6 workloads'
- script: dotnet workload install android ios macos maccatalyst"
displayName: 'Install .NET workloads'

- task: JavaToolInstaller@0
displayName: "Install Java SDK 11"
inputs:
command: 'custom'
custom: 'workload'
arguments: 'install android ios macos maccatalyst'
versionSpec: '11'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'

- task: MSBuild@1
displayName: 'Restore solution packages'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios</TargetFrameworks>
<TargetFrameworks>net7.0-android;net7.0-ios</TargetFrameworks>
<SingleProject>true</SingleProject>
<OutputType>Exe</OutputType>
<IsUnoHead>true</IsUnoHead>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net7.0-ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net7.0-android'">21.0</SupportedOSPlatformVersion>
<DefineConstants>$(DefineConstants);WINUI</DefineConstants>
</PropertyGroup>

Expand All @@ -19,7 +19,7 @@
</ItemGroup>

<Choose>
<When Condition="'$(TargetFramework)'=='net6.0-android'">
<When Condition="'$(TargetFramework)'=='net7.0-android'">
<ItemGroup>
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.6.1.1" />
<PackageReference Include="Uno.UniversalImageLoader" Version="1.9.36" />
Expand All @@ -28,8 +28,8 @@
<AndroidEnvironment Include="Android/environment.conf" />
</ItemGroup>
</When>
<When Condition="'$(TargetFramework)'=='net6.0-ios'">
<PropertyGroup Condition="'$(TargetFramework)'=='net6.0-ios'">
<When Condition="'$(TargetFramework)'=='net7.0-ios'">
<PropertyGroup Condition="'$(TargetFramework)'=='net7.0-ios'">
<MtouchExtraArgs>$(MtouchExtraArgs) --setenv=MONO_GC_PARAMS=soft-heap-limit=512m,nursery-size=64m,evacuation-threshold=66,major=marksweep,concurrent-sweep</MtouchExtraArgs>
<!-- See https://github.com/unoplatform/uno/issues/9430 for more details. -->
<MtouchExtraArgs>$(MtouchExtraArgs) --registrar:static</MtouchExtraArgs>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.18362.0</TargetPlatformMinVersion>
<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<RootNamespace>BiometryService.SampleApp.Uno.WinUI</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;arm64</Platforms>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<LangVersion>10.0</LangVersion>
<LangVersion>11.0</LangVersion>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>BiometryService</RootNamespace>
<Authors>nventive</Authors>
Expand Down
18 changes: 9 additions & 9 deletions src/BiometryService.Abstractions/IBiometryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,32 @@ public interface IBiometryService
Task ScanBiometry(CancellationToken ct);

/// <summary>
/// Encrypts the value and stores it into the platform secure storage with the given <paramref name="keyName"/>.
/// Encrypts the value and stores it into the platform secure storage with the given <paramref name="key"/>.
/// </summary>
/// <remarks>
/// Catch and throw <see cref="BiometryException"/> for general biometry errors.
/// </remarks>
/// <param name="ct"><see cref="CancellationToken" />.</param>
/// <param name="keyName">The name of the key.</param>
/// <param name="keyValue">The value to be encrypt.</param>
Task Encrypt(CancellationToken ct, string keyName, string keyValue);
/// <param name="key">The name of the key.</param>
/// <param name="value">The value to be encrypted.</param>
Task Encrypt(CancellationToken ct, string key, string value);

/// <summary>
/// Decrypts and gets the data associated to the given <paramref name="keyName"/>.
/// Decrypts and gets the data associated to the given <paramref name="key"/>.
/// </summary>
/// <remarks>
/// Catch and throw <see cref="BiometryException"/> for general biometry errors.
/// Catch and throw <see cref="OperationCanceledException"/> if the user cancelled the operation.
/// </remarks>
/// <param name="ct"><see cref="CancellationToken" />.</param>
/// <param name="keyName">The name of the Key.</param>
/// <param name="key">The name of the Key.</param>
/// <returns>The decrypted data associated to the key.</returns>
Task<string> Decrypt(CancellationToken ct, string keyName);
Task<string> Decrypt(CancellationToken ct, string key);

/// <summary>
/// Removes the ecrypted value in the platform secure storage.
/// </summary>
/// <param name="keyName">The name of the Key.</param>
/// <param name="key">The name of the Key.</param>
/// <exception cref="BiometryException">Thrown for general biometry errors.</exception>
void Remove(string keyName);
void Remove(string key);
}
6 changes: 3 additions & 3 deletions src/BiometryService/BaseBiometryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ public BaseBiometryService(ILoggerFactory loggerFactory = null)
}

/// <inheritdoc/>
public abstract Task<string> Decrypt(CancellationToken ct, string keyName);
public abstract Task<string> Decrypt(CancellationToken ct, string key);

/// <inheritdoc/>
public abstract Task Encrypt(CancellationToken ct, string keyName, string keyValue);
public abstract Task Encrypt(CancellationToken ct, string key, string value);

/// <inheritdoc/>
public abstract Task<BiometryCapabilities> GetCapabilities(CancellationToken ct);

/// <inheritdoc/>
public abstract void Remove(string keyName);
public abstract void Remove(string key);

/// <inheritdoc/>
public abstract Task ScanBiometry(CancellationToken ct);
Expand Down
Loading