inbox: store user's inbox keys (#47)

This commit is contained in:
01zulfi
2025-09-06 09:32:44 +05:00
committed by GitHub
parent 201a235357
commit 34a09ad15d
5 changed files with 24 additions and 1 deletions
+2 -1
View File
@@ -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; }
+7
View File
@@ -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; }
}
}
+1
View File
@@ -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]
+11
View File
@@ -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);
}