Revision: add salt.

This commit is contained in:
Tom Hacohen 2020-06-04 15:23:10 +03:00
parent 119479d22b
commit e062fcd429
3 changed files with 21 additions and 1 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 3.0.3 on 2020-06-04 12:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_etesync', '0014_auto_20200602_1558'),
]
operations = [
migrations.AddField(
model_name='collectionitemrevision',
name='salt',
field=models.BinaryField(default=b'', editable=True),
),
]

View File

@ -115,6 +115,7 @@ class CollectionItemRevision(models.Model):
stoken = models.OneToOneField(Stoken, on_delete=models.PROTECT)
uid = models.CharField(db_index=True, unique=True, blank=False, null=False,
max_length=43, validators=[Base64Url256BitlValidator])
salt = models.BinaryField(editable=True, blank=False, null=False, default=b'')
item = models.ForeignKey(CollectionItem, related_name='revisions', on_delete=models.CASCADE)
meta = models.BinaryField(editable=True, blank=False, null=False)
current = models.BooleanField(db_index=True, default=True, null=True)

View File

@ -106,11 +106,12 @@ class CollectionItemRevisionSerializer(serializers.ModelSerializer):
queryset=models.RevisionChunkRelation.objects.all(),
many=True
)
salt = BinaryBase64Field()
meta = BinaryBase64Field()
class Meta:
model = models.CollectionItemRevision
fields = ('chunks', 'meta', 'uid', 'deleted')
fields = ('chunks', 'meta', 'uid', 'salt', 'deleted')
class CollectionItemSerializer(serializers.ModelSerializer):