migrate to per-model UUID Primary key, remove UUIDModel (#26)

* *: migrate to per-model UUID Primary key, remove UUIDModel

* *: fix import order, fix unittests
This commit is contained in:
Jens L
2020-05-20 09:17:06 +02:00
committed by GitHub
parent 13a20478fd
commit 24a3e787dd
104 changed files with 671 additions and 2189 deletions

View File

@ -1,6 +1,7 @@
"""passbook crypto models"""
from binascii import hexlify
from typing import Optional
from uuid import uuid4
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
@ -10,13 +11,15 @@ from cryptography.x509 import Certificate, load_pem_x509_certificate
from django.db import models
from django.utils.translation import gettext_lazy as _
from passbook.lib.models import CreatedUpdatedModel, UUIDModel
from passbook.lib.models import CreatedUpdatedModel
class CertificateKeyPair(UUIDModel, CreatedUpdatedModel):
class CertificateKeyPair(CreatedUpdatedModel):
"""CertificateKeyPair that can be used for signing or encrypting if `key_data`
is set, otherwise it can be used to verify remote data."""
kp_uuid = models.UUIDField(primary_key=True, editable=False, default=uuid4)
name = models.TextField()
certificate_data = models.TextField(help_text=_("PEM-encoded Certificate data"))
key_data = models.TextField(