Fix HTTP signatures

master
Thomas Sileo 2019-04-17 23:10:15 +02:00
rodzic f29ae556cd
commit 21672a7e4d
3 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -63,7 +63,7 @@ def _body_digest(body: str) -> str:
def _get_public_key(key_id: str) -> Key:
actor = get_backend().fetch_iri(key_id)
k = Key(actor["id"])
k = Key(actor["id"], key_id)
k.load_pub(actor["publicKey"]["publicKeyPem"])
return k

Wyświetl plik

@ -34,7 +34,7 @@ class Key(object):
self.privkey = k
def key_id(self) -> str:
return f"{self.owner}#main-key"
return self._id or f"{self.owner}#main-key"
def to_dict(self) -> Dict[str, Any]:
return {

Wyświetl plik

@ -16,9 +16,9 @@ def test_httpsig():
back = InMemBackend()
ap.use_backend(back)
k = Key("https://lol.com")
k = Key("https://lol.com", "https://lol.com#lol")
k.new()
back.FETCH_MOCK["https://lol.com#main-key"] = {
back.FETCH_MOCK["https://lol.com#lol"] = {
"publicKey": k.to_dict(),
"id": "https://lol.com",
}