inbox: store user's inbox keys (#47)
This commit is contained in:
@@ -77,7 +77,8 @@ namespace Notesnook.API.Controllers
|
||||
var keys = new UserKeys
|
||||
{
|
||||
AttachmentsKey = user.AttachmentsKey,
|
||||
MonographPasswordsKey = user.MonographPasswordsKey
|
||||
MonographPasswordsKey = user.MonographPasswordsKey,
|
||||
InboxKeys = user.InboxKeys
|
||||
};
|
||||
await UserService.SetUserKeysAsync(userId, keys);
|
||||
return Ok();
|
||||
|
||||
@@ -15,6 +15,9 @@ namespace Notesnook.API.Models.Responses
|
||||
[JsonPropertyName("monographPasswordsKey")]
|
||||
public EncryptedData MonographPasswordsKey { get; set; }
|
||||
|
||||
[JsonPropertyName("inboxKeys")]
|
||||
public InboxKeys InboxKeys { get; set; }
|
||||
|
||||
[JsonPropertyName("subscription")]
|
||||
public ISubscription Subscription { get; set; }
|
||||
|
||||
|
||||
@@ -23,5 +23,12 @@ namespace Notesnook.API.Models
|
||||
{
|
||||
public EncryptedData AttachmentsKey { get; set; }
|
||||
public EncryptedData MonographPasswordsKey { get; set; }
|
||||
public InboxKeys InboxKeys { get; set; }
|
||||
}
|
||||
|
||||
public class InboxKeys
|
||||
{
|
||||
public string Public { get; set; }
|
||||
public EncryptedData Private { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace Notesnook.API.Models
|
||||
public EncryptedData VaultKey { get; set; }
|
||||
public EncryptedData AttachmentsKey { get; set; }
|
||||
public EncryptedData MonographPasswordsKey { get; set; }
|
||||
public InboxKeys InboxKeys { get; set; }
|
||||
public Limit StorageLimit { get; set; }
|
||||
|
||||
[BsonId]
|
||||
|
||||
@@ -148,6 +148,17 @@ namespace Notesnook.API.Services
|
||||
{
|
||||
userSettings.MonographPasswordsKey = keys.MonographPasswordsKey;
|
||||
}
|
||||
if (keys.InboxKeys != null)
|
||||
{
|
||||
if (keys.InboxKeys.Public == null || keys.InboxKeys.Private == null)
|
||||
{
|
||||
userSettings.InboxKeys = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
userSettings.InboxKeys = keys.InboxKeys;
|
||||
}
|
||||
}
|
||||
|
||||
await Repositories.UsersSettings.UpdateAsync(userSettings.Id, userSettings);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user