Add a separate pubkey/privatekey for sharing.

It's separated from the login one so that encryption key and identity
can be rotated separately.
This commit is contained in:
Tom Hacohen
2020-05-26 13:44:40 +03:00
parent 863c405802
commit e94e2f9d70
3 changed files with 33 additions and 1 deletions

View File

@@ -326,9 +326,12 @@ class InvitationAcceptSerializer(serializers.Serializer):
class UserSerializer(serializers.ModelSerializer):
pubkey = BinaryBase64Field(source='userinfo.pubkey')
encryptedSeckey = BinaryBase64Field(source='userinfo.encryptedSeckey')
class Meta:
model = User
fields = (User.USERNAME_FIELD, User.EMAIL_FIELD)
fields = (User.USERNAME_FIELD, User.EMAIL_FIELD, 'pubkey', 'encryptedSeckey')
class UserQuerySerializer(serializers.ModelSerializer):
@@ -349,6 +352,8 @@ class AuthenticationSignupSerializer(serializers.Serializer):
user = UserQuerySerializer(many=False)
salt = BinaryBase64Field()
loginPubkey = BinaryBase64Field()
pubkey = BinaryBase64Field()
encryptedSeckey = BinaryBase64Field()
def create(self, validated_data):
"""Function that's called when this serializer creates an item"""