Fix gen_vapid_keys
This commit is contained in:
parent
89680cf6f1
commit
c05a8e65dc
@ -3,7 +3,7 @@ from ecdsa import SigningKey
|
|||||||
from base64 import urlsafe_b64encode
|
from base64 import urlsafe_b64encode
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from djangoldp_notification.models import VAPIDKeyset
|
from djangoldp_webpushnotification.models import VAPIDKeyset
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
@ -13,11 +13,11 @@ class Command(BaseCommand):
|
|||||||
priv_key = SigningKey.generate(curve=ecdsa.NIST256p)
|
priv_key = SigningKey.generate(curve=ecdsa.NIST256p)
|
||||||
pub_key = priv_key.get_verifying_key()
|
pub_key = priv_key.get_verifying_key()
|
||||||
|
|
||||||
VAPIDKeyset.objects.create(
|
VAPIDKeyset.objects.create(
|
||||||
public_key=urlsafe_b64encode(b"\x04" + pub_key.to_string()).strip(b"="),
|
public_key=urlsafe_b64encode(b"\x04" + pub_key.to_string()).strip(b"="),
|
||||||
private_key=urlsafe_b64encode(priv_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)
|
||||||
|
Reference in New Issue
Block a user