2020-05-24 00:17:52 +01:00
|
|
|
# Generated by Django 3.0.6 on 2020-05-23 23:07
|
|
|
|
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
|
|
|
|
|
|
def create_self_signed(apps, schema_editor):
|
|
|
|
CertificateKeyPair = apps.get_model("passbook_crypto", "CertificateKeyPair")
|
|
|
|
db_alias = schema_editor.connection.alias
|
|
|
|
from passbook.crypto.builder import CertificateBuilder
|
|
|
|
|
|
|
|
builder = CertificateBuilder()
|
|
|
|
builder.build()
|
|
|
|
CertificateKeyPair.objects.using(db_alias).create(
|
|
|
|
name="passbook Self-signed Certificate",
|
|
|
|
certificate_data=builder.certificate,
|
|
|
|
key_data=builder.private_key,
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
2020-05-24 01:06:54 +01:00
|
|
|
("passbook_crypto", "0001_initial"),
|
2020-05-24 00:17:52 +01:00
|
|
|
]
|
|
|
|
|
2020-05-24 01:06:54 +01:00
|
|
|
operations = [migrations.RunPython(create_self_signed)]
|