1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-15 07:43:37 +00:00
Files
mobile/src/Core/Models/Domain/LoginUri.cs
Carlos Gonçalves f6a58e469f [PM-4739] Implement checksum uri validation (#2893)
* PM-4739 Implement checksum uri validation

* PM-4739 Add missing field

* PM-4739 Fix PR comments

* PM-4739 Remove unnecessary comment

* PM-4739 Add try catch and log exception

* PM-4739 Added missing files from last commit

* PM-4739 Change arg name

* [PM-5461] Fix item saving with blank URI (#2948)

* PM-5461 Fix item saving with blank URI

* PM-5461 Fix PR comment
2024-01-24 13:15:24 +00:00

43 lines
1.2 KiB
C#

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Bit.Core.Enums;
using Bit.Core.Models.Data;
using Bit.Core.Models.View;
namespace Bit.Core.Models.Domain
{
public class LoginUri : Domain
{
private HashSet<string> _map = new HashSet<string>
{
nameof(Uri),
nameof(UriChecksum)
};
public LoginUri() { }
public LoginUri(LoginUriData obj, bool alreadyEncrypted = false)
{
Match = obj.Match;
BuildDomainModel(this, obj, _map, alreadyEncrypted);
}
public EncString Uri { get; set; }
public UriMatchType? Match { get; set; }
public EncString UriChecksum { get; set; }
public Task<LoginUriView> DecryptAsync(string orgId, SymmetricCryptoKey key = null)
{
return DecryptObjAsync(new LoginUriView(this), this, _map.Where(m => m != nameof(UriChecksum)).ToHashSet<string>(), orgId, key);
}
public LoginUriData ToLoginUriData()
{
var u = new LoginUriData();
BuildDataModel(this, u, _map, new HashSet<string> { "Match" });
return u;
}
}
}