2020-04-15 12:02:30 +02:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
2020-03-24 13:01:14 +01:00
|
|
|
|
using ModernKeePass.Domain.Dtos;
|
|
|
|
|
using ModernKeePass.Domain.Entities;
|
2020-03-30 19:43:04 +02:00
|
|
|
|
using ModernKeePass.Domain.Enums;
|
2020-03-24 13:01:14 +01:00
|
|
|
|
|
|
|
|
|
namespace ModernKeePass.Application.Common.Interfaces
|
|
|
|
|
{
|
|
|
|
|
public interface IDatabaseProxy
|
|
|
|
|
{
|
2020-04-23 19:00:38 +02:00
|
|
|
|
// PW Database properties
|
2020-03-24 13:01:14 +01:00
|
|
|
|
bool IsOpen { get; }
|
2020-03-24 17:31:34 +01:00
|
|
|
|
string Name { get; }
|
2020-04-01 19:37:30 +02:00
|
|
|
|
string RootGroupId { get; }
|
|
|
|
|
string RecycleBinId { get; set; }
|
2020-03-26 12:25:22 +01:00
|
|
|
|
string CipherId { get; set; }
|
|
|
|
|
string KeyDerivationId { get; set; }
|
2020-03-24 13:01:14 +01:00
|
|
|
|
string Compression { get; set; }
|
2020-03-27 18:45:13 +01:00
|
|
|
|
bool IsRecycleBinEnabled { get; set; }
|
2020-04-23 19:00:38 +02:00
|
|
|
|
|
|
|
|
|
// Custom properties
|
2020-04-06 20:20:45 +02:00
|
|
|
|
string FileAccessToken { get; set; }
|
2020-04-14 13:44:07 +02:00
|
|
|
|
int Size { get; set; }
|
|
|
|
|
bool IsDirty { get; set; }
|
2020-03-24 13:01:14 +01:00
|
|
|
|
|
2020-04-06 20:20:45 +02:00
|
|
|
|
Task Open(byte[] file, Credentials credentials);
|
|
|
|
|
Task ReOpen(byte[] file);
|
2020-05-02 14:21:59 +02:00
|
|
|
|
Task Create(Credentials credentials, string name, DatabaseVersion version = DatabaseVersion.V4);
|
2020-04-06 20:20:45 +02:00
|
|
|
|
Task<byte[]> SaveDatabase();
|
|
|
|
|
void UpdateCredentials(Credentials credentials);
|
2020-03-24 13:01:14 +01:00
|
|
|
|
void CloseDatabase();
|
2020-03-26 12:25:22 +01:00
|
|
|
|
|
2020-04-15 12:02:30 +02:00
|
|
|
|
EntryEntity GetEntry(string id);
|
2020-03-26 12:25:22 +01:00
|
|
|
|
Task AddEntry(string parentGroupId, string entryId);
|
2020-04-09 19:43:06 +02:00
|
|
|
|
Task MoveEntry(string parentGroupId, string entryId, int index);
|
2020-03-27 13:27:29 +01:00
|
|
|
|
void UpdateEntry(string entryId, string fieldName, object fieldValue);
|
2020-05-11 10:53:14 +02:00
|
|
|
|
void DeleteField(string entryId, string fieldName);
|
2020-04-02 19:12:16 +02:00
|
|
|
|
Task RemoveEntry(string parentGroupId, string entryId);
|
2020-05-11 10:53:14 +02:00
|
|
|
|
EntryEntity CreateEntry(string parentGroupId);
|
|
|
|
|
void SortEntries(string groupId);
|
|
|
|
|
|
|
|
|
|
GroupEntity GetGroup(string id);
|
|
|
|
|
Task AddGroup(string parentGroupId, string groupId);
|
|
|
|
|
void UpdateGroup(GroupEntity group);
|
2020-04-02 19:12:16 +02:00
|
|
|
|
Task RemoveGroup(string parentGroupId, string groupId);
|
2020-04-06 20:20:45 +02:00
|
|
|
|
void DeleteEntity(string entityId);
|
2020-04-07 17:29:03 +02:00
|
|
|
|
GroupEntity CreateGroup(string parentGroupId, string name, bool isRecycleBin = false);
|
2020-03-26 12:25:22 +01:00
|
|
|
|
void SortSubGroups(string groupId);
|
2020-05-11 10:53:14 +02:00
|
|
|
|
|
2020-05-07 12:11:12 +02:00
|
|
|
|
void AddAttachment(string entryId, string attachmentName, byte[] attachmentContent);
|
|
|
|
|
void DeleteAttachment(string entryId, string attachmentName);
|
2020-04-15 12:02:30 +02:00
|
|
|
|
|
2020-04-16 17:16:03 +02:00
|
|
|
|
EntryEntity AddHistory(string entryId);
|
|
|
|
|
EntryEntity RestoreFromHistory(string entryId, int historyIndex);
|
2020-04-16 14:08:50 +02:00
|
|
|
|
void DeleteHistory(string entryId, int historyIndex);
|
2020-04-15 19:06:13 +02:00
|
|
|
|
|
2020-04-15 12:02:30 +02:00
|
|
|
|
IEnumerable<EntryEntity> Search(string groupId, string text);
|
2020-04-28 15:20:47 +02:00
|
|
|
|
IEnumerable<BaseEntity> GetAllGroups(string groupId);
|
2020-03-24 13:01:14 +01:00
|
|
|
|
}
|
|
|
|
|
}
|