feat(EnvelopeReceiverReadOnly): Modelldaten und Dokument im Endpunkt sind so eingestellt, dass sie als Bytes geladen werden.

This commit is contained in:
Developer 02
2024-10-05 02:04:57 +02:00
parent bc6955055a
commit efa9160c04
4 changed files with 78 additions and 24 deletions

View File

@@ -66,21 +66,25 @@ namespace EnvelopeGenerator.Extensions
public static bool TryDecode(this string encodedKey, out string[] decodedKeys)
{
if (!encodedKey.IsBase64String())
try
{
decodedKeys = Array.Empty<string>();
return false;
byte[] bytes = Convert.FromBase64String(encodedKey);
string decodedString = Encoding.UTF8.GetString(bytes);
decodedKeys = decodedString.Split(new string[] { "::" }, StringSplitOptions.None);
return true;
}
byte[] bytes = Convert.FromBase64String(encodedKey);
string decodedString = Encoding.UTF8.GetString(bytes);
decodedKeys = decodedString.Split(new string[] { "::" }, StringSplitOptions.None);
return true;
catch(ArgumentNullException) { }
catch (FormatException) { }
catch(ArgumentException) { }
decodedKeys = Array.Empty<string>();
return false;
}
public static EncodeType GetEncodeType(this string[] decodedKeys) => decoded.Length switch
public static EncodeType GetEncodeType(this string[] decodedKeys) => decodedKeys.Length switch
{
2 => EncodeType.EnvelopeReceiver,
3 => long.TryParse(decoded[1], out var _) ? EncodeType.EnvelopeReceiverReadOnly : EncodeType.Undefined,
3 => long.TryParse(decodedKeys[1], out var _) ? EncodeType.EnvelopeReceiverReadOnly : EncodeType.Undefined,
_ => EncodeType.Undefined,
};