2019-06-27 03:28:23 +03:00
|
|
|
|
using Bit.Core.Enums;
|
|
|
|
|
using Bit.Core.Models.View;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace Bit.iOS.Core.Models
|
|
|
|
|
{
|
|
|
|
|
public class CipherViewModel
|
|
|
|
|
{
|
|
|
|
|
public CipherViewModel(CipherView cipher)
|
|
|
|
|
{
|
2019-06-27 22:48:25 +03:00
|
|
|
|
CipherView = cipher;
|
2019-06-27 03:28:23 +03:00
|
|
|
|
Id = cipher.Id;
|
|
|
|
|
Name = cipher.Name;
|
|
|
|
|
Username = cipher.Login?.Username;
|
|
|
|
|
Password = cipher.Login?.Password;
|
|
|
|
|
Totp = cipher.Login?.Totp;
|
|
|
|
|
Uris = cipher.Login?.Uris?.Select(u => new LoginUriModel(u)).ToList();
|
|
|
|
|
Fields = cipher.Fields?.Select(f => new Tuple<string, string>(f.Name, f.Value)).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
public string Username { get; set; }
|
|
|
|
|
public string Password { get; set; }
|
|
|
|
|
public List<LoginUriModel> Uris { get; set; }
|
|
|
|
|
public string Totp { get; set; }
|
|
|
|
|
public List<Tuple<string, string>> Fields { get; set; }
|
2019-06-27 22:48:25 +03:00
|
|
|
|
public CipherView CipherView { get; set; }
|
2019-06-27 03:28:23 +03:00
|
|
|
|
|
|
|
|
|
public class LoginUriModel
|
|
|
|
|
{
|
|
|
|
|
public LoginUriModel(LoginUriView data)
|
|
|
|
|
{
|
|
|
|
|
Uri = data?.Uri;
|
|
|
|
|
Match = data?.Match;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Uri { get; set; }
|
|
|
|
|
public UriMatchType? Match { get; set; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|