1
0
mirror of https://github.com/bitwarden/server synced 2026-02-26 09:23:28 +00:00

[PM-2944] Make Entities Nullable On Unowned Types (#4388)

* Enable `nullable` For Collection

* Enable `nullable` For `CollectionCipher`

* Enable `nullable` For `CollectionGroup`

* Enable `nullable` For `CollectionUser`

* Enable `nullable` For `Device`

* Enable `nullable` For `Event`

* Enable `nullable` For `Folder`

* Enable `nullable` For `Installation`

* Enable `nullable` For `IRevisable`

* Enable `nullable` For `IStorable`

* Enable `nullable` For `IStorableSubscriber`

* Enable `nullable` For `ITableObject`

* Enable `nullable` For `OrganizationApiKey`

* Enable `nullable` For `OrganizationConnection`

* Enable `nullable` For `OrganizationDomain`

* Enable `nullable` For `OrganizationSponsorship`

* Enable `nullable` For `Role`

* Enable `nullable` For `TaxRate`

* Enable `nullable` For `Transaction`

* Enable `nullable` For `User`
This commit is contained in:
Justin Baur
2024-07-03 15:17:02 -04:00
committed by GitHub
parent 0d3a7b3dd5
commit 6eb2a6e75d
20 changed files with 99 additions and 52 deletions

View File

@@ -1,6 +1,8 @@
using System.ComponentModel.DataAnnotations;
using Bit.Core.Utilities;
#nullable enable
namespace Bit.Core.Entities;
public class Device : ITableObject<Guid>
@@ -8,12 +10,12 @@ public class Device : ITableObject<Guid>
public Guid Id { get; set; }
public Guid UserId { get; set; }
[MaxLength(50)]
public string Name { get; set; }
public string Name { get; set; } = null!;
public Enums.DeviceType Type { get; set; }
[MaxLength(50)]
public string Identifier { get; set; }
public string Identifier { get; set; } = null!;
[MaxLength(255)]
public string PushToken { get; set; }
public string? PushToken { get; set; }
public DateTime CreationDate { get; internal set; } = DateTime.UtcNow;
public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow;
@@ -21,20 +23,20 @@ public class Device : ITableObject<Guid>
/// Intended to be the users symmetric key that is encrypted in some form, the current way to encrypt this is with
/// the devices public key.
/// </summary>
public string EncryptedUserKey { get; set; }
public string? EncryptedUserKey { get; set; }
/// <summary>
/// Intended to be the public key that was generated for a device upon trust and encrypted. Currenly encrypted using
/// a users symmetric key so that when trusted and unlocked a user can decrypt the public key for all their devices.
/// This enabled a user to rotate the keys for all of their devices.
/// </summary>
public string EncryptedPublicKey { get; set; }
public string? EncryptedPublicKey { get; set; }
/// <summary>
/// Intended to be the private key that was generated for a device upon trust and encrypted. Currenly encrypted with
/// the devices key, that upon successful login a user can decrypt this value and therefor decrypt their vault.
/// </summary>
public string EncryptedPrivateKey { get; set; }
public string? EncryptedPrivateKey { get; set; }
public void SetNewId()