drop obsolete User.href, it was only for OStatus

🫗
pull/650/head
Ryan Barrett 2023-10-04 12:30:20 -07:00
rodzic b4d5ab15ef
commit ae25baba8c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 0 dodań i 10 usunięć

Wyświetl plik

@ -279,7 +279,6 @@ class User(StringIdModel, metaclass=ProtocolUserMeta):
# these can use urandom() and do nontrivial math, so they can take time
# depending on the amount of randomness available and compute needed.
if cls.LABEL != 'activitypub':
# originally from django_salmon.magicsigs
key = RSA.generate(KEY_BITS, randfunc=random.randbytes if DEBUG else None)
user.mod = long_to_base64(key.n)
user.public_exponent = long_to_base64(key.e)
@ -375,9 +374,6 @@ class User(StringIdModel, metaclass=ProtocolUserMeta):
"""Returns handle if we know it, otherwise id."""
return self.handle or self.key.id()
def href(self):
return f'data:application/magic-public-key,RSA.{self.mod}.{self.public_exponent}'
def public_pem(self):
"""Returns: bytes"""
rsa = RSA.construct((base64_to_long(str(self.mod)),

Wyświetl plik

@ -104,12 +104,6 @@ class UserTest(TestCase):
self.assertEqual('y.z', Fake.get_or_create('a.b').key.id())
def test_href(self):
href = g.user.href()
self.assertTrue(href.startswith('data:application/magic-public-key,RSA.'), href)
self.assertIn(g.user.mod, href)
self.assertIn(g.user.public_exponent, href)
def test_public_pem(self):
pem = g.user.public_pem()
self.assertTrue(pem.decode().startswith('-----BEGIN PUBLIC KEY-----\n'), pem)