-
Notifications
You must be signed in to change notification settings - Fork 1
[SG-10] Refactor Cipher data model #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…itional-item-types
…itional-item-types
…itional-item-types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
14 file(s) reviewed, 15 comment(s)
Edit PR Review Bot Settings | Greptile
| default: | ||
| throw new ArgumentException("Unsupported type: " + nameof(Type) + "."); | ||
| existingCipher.Data = JsonSerializer.Serialize(Data, JsonHelpers.IgnoreWritingNull); | ||
| break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: This default case allows for custom cipher types, but ensure that proper validation and type checking are implemented to prevent misuse or data corruption.
| break; | ||
| default: | ||
| throw new ArgumentException("Unsupported " + nameof(Type) + "."); | ||
| var customData = JsonSerializer.Deserialize<EncObject>(cipher.Data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Ensure that JsonSerializer.Deserialize can handle null cipher.Data
| if (cipherData != null) | ||
| { | ||
| Name = cipherData.Name; | ||
| Notes = cipherData.Notes; | ||
| Fields = cipherData.Fields?.Select(f => new CipherFieldModel(f)); | ||
| PasswordHistory = cipherData.PasswordHistory?.Select(ph => new CipherPasswordHistoryModel(ph)); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: This block may leave Name, Notes, Fields, and PasswordHistory uninitialized for custom types
| { | ||
| public class EncObject | ||
| { | ||
| public EncryptionType Type { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: consider adding XML documentation for each property
Type of change
Objective
Draft refactor of the cipher data model. Replaces the
datawith a serialized instance ofEncObjectwhich is controlled by the clients.Code changes
Before you submit
dotnet tool run dotnet-format --check) (required)…itional-item-types
Greptile Summary
This pull request introduces significant changes to the cipher data model, focusing on improved flexibility and encryption handling. Here's a concise summary of the major changes:
EncObjectclass for enhanced encryption controlCipherRequestModelandCipherResponseModelto accommodateEncObjectCipherfolderCipherTypeenum to prepare for potential future additionsCipherAttachmentclass with new properties and nestedMetaDataclassThese changes aim to provide more flexibility in handling different cipher types and improve the overall structure of the cipher data model. However, careful consideration should be given to data consistency and backward compatibility during implementation.