Skip to content

WIP: Crypto - restructure for write access#52

Open
commonism wants to merge 19 commits into
numberly:mainfrom
commonism:crypto
Open

WIP: Crypto - restructure for write access#52
commonism wants to merge 19 commits into
numberly:mainfrom
commonism:crypto

Conversation

@commonism

Copy link
Copy Markdown
Contributor

Hi,

main intention of this PR is creating the foundation to add items such as users or logins to vault/bitwarden.
Currently implementation is limited to read-only access with users/logins.

To do so, the crypto which was inherited from bitwardentools was replaced, major parts of the crypto was moved to the pydantic models, using ModelValidator and ModelSerializers to work the crypto on the models on validation/serialization.

This eliminates all guess work when decrypting a received dataset, no loops trying to find the correct key.
The crypto when receiving data is done when validating the data.
The crypto to create new items is done when serializing the model to json using the proper key.

On sync(), SyncData is processed twice, first iteration is limed to decoding Profile, 2nd iteration decodes Ciphers as well - using the keys in Profile.Key and Profile.Organizations depending on the owner of the Cipher.

It's possible to create new users (RegisterData), logins (Login) and add attachments (Attachment) to logins (v2 api).
The tests to create users/logins/attachments modify the database and cause other tests to fail - therefore disabled for now.

The lack of proper encryption with the unit tests in tests/model/validation breaks them as well - therefore disabled for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant