[SG-10] Refactor Cipher data model#76
Open
lizard-boy wants to merge 7 commits into
Open
Conversation
…itional-item-types
…itional-item-types
…itional-item-types
There was a problem hiding this comment.
14 file(s) reviewed, 15 comment(s)
Edit PR Review Bot Settings | Greptile
Comment on lines
+89
to
+91
| default: | ||
| throw new ArgumentException("Unsupported type: " + nameof(Type) + "."); | ||
| existingCipher.Data = JsonSerializer.Serialize(Data, JsonHelpers.IgnoreWritingNull); | ||
| break; |
There was a problem hiding this comment.
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.
logic: Ensure that JsonSerializer.Deserialize can handle null cipher.Data
Comment on lines
+61
to
+67
| 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.
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.
style: consider adding XML documentation for each property
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.