VAPID Keyset private key is either bytes or memoryview object
It seems the private_key sometimes exists as a bytes object but also sometimes exists as a memoryview object. The latter can't be concatenated with a bytes object so throws an exception when trying to add padding for b64 decoding it
Below is a git diff of a proposed change that would work in the interim but surely a better solution exists? If the private_key is a memoryview object it will perform the tobytes() function to return it to a bytes object
diff --git a/djangoldp_webpushnotification/models.py b/djangoldp_webpushnotification/models.py
index 87b62c8..50bf5a7 100644
--- a/djangoldp_webpushnotification/models.py
+++ b/djangoldp_webpushnotification/models.py
@@ -14,7 +14,8 @@ class VAPIDKeyset(models.Model):
@property
def public_key(self):
- key_str = self.private_key.tobytes()
+ key_str = self.private_key
+ if (not isinstance(self.private_key, bytes) ) : key_str = key_str.tobytes()
padding = len(key_str) % 4
key_str += b"=" * padding