diff --git a/little_boxes/httpsig.py b/little_boxes/httpsig.py index 96bd3dd..c6a7941 100644 --- a/little_boxes/httpsig.py +++ b/little_boxes/httpsig.py @@ -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 diff --git a/little_boxes/key.py b/little_boxes/key.py index b0a4f70..5002c63 100644 --- a/little_boxes/key.py +++ b/little_boxes/key.py @@ -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 { diff --git a/tests/test_httpsig.py b/tests/test_httpsig.py index 47e46b7..2a378d5 100644 --- a/tests/test_httpsig.py +++ b/tests/test_httpsig.py @@ -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", }