Fix gen_vapid_keys

This commit is contained in:
3wc 2021-04-07 16:26:13 +02:00
parent 89680cf6f1
commit c05a8e65dc
1 changed files with 7 additions and 7 deletions

View File

@ -3,7 +3,7 @@ from ecdsa import SigningKey
from base64 import urlsafe_b64encode
from django.core.management.base import BaseCommand
from djangoldp_notification.models import VAPIDKeyset
from djangoldp_webpushnotification.models import VAPIDKeyset
class Command(BaseCommand):
@ -13,11 +13,11 @@ class Command(BaseCommand):
priv_key = SigningKey.generate(curve=ecdsa.NIST256p)
pub_key = priv_key.get_verifying_key()
VAPIDKeyset.objects.create(
public_key=urlsafe_b64encode(b"\x04" + pub_key.to_string()).strip(b"="),
private_key=urlsafe_b64encode(priv_key.to_string()).strip(b"=")
)
VAPIDKeyset.objects.create(
public_key=urlsafe_b64encode(b"\x04" + pub_key.to_string()).strip(b"="),
private_key=urlsafe_b64encode(priv_key.to_string()).strip(b"=")
)
self.stdout.write("VAPID Keyset succesfully generated")
self.stdout.write("VAPID Keyset succesfully generated")
exit(0)
exit(0)