From 625df229895d6542485c93828cc87a299490541e Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 26 Jun 2020 10:31:03 +0300 Subject: [PATCH] Make item encryption key optional for collections/items Collections still have a unique encryption key (their collection key), and items just have a unique key per item in a collection that's derived from the main key and if we ever want to share items across collections or do something fancy like that we can just add an encrypted key in there. --- django_etebase/serializers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django_etebase/serializers.py b/django_etebase/serializers.py index 9ca33b1..a76f388 100644 --- a/django_etebase/serializers.py +++ b/django_etebase/serializers.py @@ -116,7 +116,7 @@ class CollectionItemRevisionSerializer(serializers.ModelSerializer): class CollectionItemSerializer(serializers.ModelSerializer): - encryptionKey = BinaryBase64Field() + encryptionKey = BinaryBase64Field(required=False, default=None) etag = serializers.CharField(allow_null=True, write_only=True) content = CollectionItemRevisionSerializer(many=False) @@ -186,7 +186,7 @@ class CollectionSerializer(serializers.ModelSerializer): stoken = serializers.CharField(read_only=True) uid = serializers.CharField(source='main_item.uid') - encryptionKey = BinaryBase64Field(source='main_item.encryptionKey') + encryptionKey = BinaryBase64Field(source='main_item.encryptionKey', required=False, default=None) etag = serializers.CharField(allow_null=True, write_only=True) version = serializers.IntegerField(min_value=0, source='main_item.version') content = CollectionItemRevisionSerializer(many=False, source='main_item.content')