mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-19 11:37:28 +02:00
Version 3.0.363
This commit is contained in:
parent
4ff3307997
commit
91d42552c7
212 changed files with 1799 additions and 1318 deletions
|
@ -441,7 +441,7 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
if (authInfo.K_seed.Length != SEEDLENGTH
|
||||
|| authInfo.K_u.Length <= 0)
|
||||
{
|
||||
throw new AuthKeyException($"Can not authenticate. Invalid seed-/ k-user-lenght {authInfo.K_seed.Length}/ {authInfo.K_u.Length} detected.");
|
||||
throw new AuthKeyException($"Can not authenticate. Invalid seed-/ k-user-length {authInfo.K_seed.Length}/ {authInfo.K_u.Length} detected.");
|
||||
}
|
||||
|
||||
if (Device.State == Plugin.BLE.Abstractions.DeviceState.Connected)
|
||||
|
@ -551,7 +551,7 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
if (authInfo.K_seed.Length != SEEDLENGTH
|
||||
|| authInfo.K_u.Length <= 0)
|
||||
{
|
||||
throw new AuthKeyException($"Can not authenticate. Invalid seed-/ k-user-lenght {authInfo.K_seed.Length}/ {authInfo.K_u.Length} detected.");
|
||||
throw new AuthKeyException($"Can not authenticate. Invalid seed-/ k-user-length {authInfo.K_seed.Length}/ {authInfo.K_u.Length} detected.");
|
||||
}
|
||||
|
||||
Log.ForContext<LockItBase>().Debug($"Connection state is {deviceState} in context of auth.");
|
||||
|
@ -636,11 +636,11 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
cts.CancelAfter(READ_TIMEOUT_MS);
|
||||
try
|
||||
{
|
||||
seedLockEncrypted = await authCharacteristic.ReadAsync(cts.Token); // encrypted seed value (random value) from lock to decypt using k_user
|
||||
seedLockEncrypted = await authCharacteristic.ReadAsync(cts.Token); // encrypted seed value (random value) from lock to decrypt using k_user
|
||||
}
|
||||
catch (System.Exception exception)
|
||||
{
|
||||
Log.ForContext<LockItBase>().Error("Retrieveing encrypted random value from lock (seed)(ReadAsync-call) failed.{ReadCharacteristic}{Exception}", ToSerilogString(authCharacteristic), exception);
|
||||
Log.ForContext<LockItBase>().Error("Retrieving encrypted random value from lock (seed)(ReadAsync-call) failed.{ReadCharacteristic}{Exception}", ToSerilogString(authCharacteristic), exception);
|
||||
throw new System.Exception(string.Format("Can not authenticate. Reading encrypted seed failed. {0}", exception.Message), exception);
|
||||
}
|
||||
finally
|
||||
|
@ -648,7 +648,7 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
cts.Dispose();
|
||||
}
|
||||
|
||||
Log.ForContext<LockItBase>().Debug("Retrieveing encrypted random value from lock (seed)(ReadAsync-call) succeeded.{ReadCharacteristic}{Reading}", ToSerilogString(authCharacteristic), "***");
|
||||
Log.ForContext<LockItBase>().Debug("Retrieving encrypted random value from lock (seed)(ReadAsync-call) succeeded.{ReadCharacteristic}{Reading}", ToSerilogString(authCharacteristic), "***");
|
||||
|
||||
var crypto = new AuthCryptoHelper(
|
||||
seedLockEncrypted,
|
||||
|
@ -701,7 +701,7 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
/// <exception cref="BluetoothDisconnectedException">App is not connected to lock.</exception>
|
||||
/// <exception cref="CoundntGetCharacteristicException">Getting state characteristic to read from failed.</exception>
|
||||
/// <exception cref="Exception">
|
||||
/// Call not from main thread or unkonwn platform detected or
|
||||
/// Call not from main thread or unknown platform detected or
|
||||
/// query device state (connected, disconnected, ....) failed for an unknown reason or returned an unexpected value or
|
||||
/// reading state characteristic failed or reading from characteristic was empty.
|
||||
/// </exception>
|
||||
|
@ -1044,8 +1044,8 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
{
|
||||
ActivateLockWriteCounter--;
|
||||
Log.ForContext<LockItBase>().Error(open
|
||||
? "Encypting command to open lock failed. {Exception}"
|
||||
: "Encypting command to close lock failed. {Exception}",
|
||||
? "Encrypting command to open lock failed. {Exception}"
|
||||
: "Encrypting command to close lock failed. {Exception}",
|
||||
exception);
|
||||
throw new System.Exception(open
|
||||
? $"Can not open lock. Encrypting command to lock/ unlock failed. {exception.Message}"
|
||||
|
@ -1251,6 +1251,6 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
=> charcteristic.Id.ToString();
|
||||
|
||||
private static string ToSerilogString(byte[] byteArray)
|
||||
=> "***"; // For debuging purposes it might be reqired to return string.Join(",", byteArray); Do not log any confidental value in production context.
|
||||
=> "***"; // For debugging purposes it might be required to return string.Join(",", byteArray); Do not log any confidental value in production context.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
// - LockitLockingState.Closed
|
||||
// - LockitLockingState.Unknown
|
||||
// - LockitLockingState.CouldntOpenBoldBlocked
|
||||
// Internal error which sould never occure. Lock refuses to open but connection is ok.
|
||||
// Internal error which should never occur. Lock refuses to open but connection is ok.
|
||||
Log.ForContext<LockItEventBased>().Debug($"Opening lock failed. Unexpected lock state {lockingState.Value.GetLockingState()} detected.");
|
||||
throw new CouldntOpenInconsistentStateExecption(lockingState.Value.GetLockingState());
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
// - LockitLockingState.Open
|
||||
// - LockitLockingState.Unknown
|
||||
// - LockitLockingState.CouldntOpenBoldBlocked
|
||||
// Internal error which sould never occurre. Lock refuses to close but connection is ok.
|
||||
// Internal error which should never occur. Lock refuses to close but connection is ok.
|
||||
Log.ForContext<LockItEventBased>().Debug($"Opening lock failed. Unexpected lock state {lockingState.Value.GetLockingState()} detected.");
|
||||
throw new CouldntCloseInconsistentStateExecption(lockingState.Value.GetLockingState());
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
// - LockitLockingState.Closed
|
||||
// - LockitLockingState.CouldntCloseMoving (should never happen because command open was send)
|
||||
// - LockitLockingState.CouldntCloseBoldBlocked (should never happen because command open was send)
|
||||
// Internal error which sould never occure. Lock refuses to open but connection is ok.
|
||||
// Internal error which should never occur. Lock refuses to open but connection is ok.
|
||||
Log.ForContext<LockItPolling>().Debug($"Opening lock failed. Unexpected lock state {info.State.Value.GetLockingState()} detected.");
|
||||
throw new CouldntOpenInconsistentStateExecption(info.State.Value.GetLockingState());
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
// - LockitLockingState.Open
|
||||
// - LockitLockingState.Unknown
|
||||
// - LockitLockingState.CouldntOpenBoldBlocked
|
||||
// Internal error which sould never occurre. Lock refuses to close but connection is ok.
|
||||
// Internal error which should never occur. Lock refuses to close but connection is ok.
|
||||
Log.ForContext<LockItPolling>().Debug($"Closing lock failed. Unexpected lock state {info.State.Value.GetLockingState()} detected.");
|
||||
throw new CouldntCloseInconsistentStateExecption(info.State.Value.GetLockingState());
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -20,7 +20,7 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
Cipher = cipher;
|
||||
}
|
||||
|
||||
/// <summary> Holds timeout values for series of connecting attemps to a lock or multiple locks. </summary>
|
||||
/// <summary> Holds timeout values for series of connecting attempts to a lock or multiple locks. </summary>
|
||||
public ITimeOutProvider TimeOut { get; set; }
|
||||
|
||||
protected ICipher Cipher { get; }
|
||||
|
@ -179,4 +179,4 @@ namespace TINK.Services.BluetoothLock.BLE
|
|||
return LockingState.UnknownDisconnected;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue