M little_boxes/httpsig.py +1 -1
@@ 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
M little_boxes/key.py +1 -1
@@ 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 {
M tests/test_httpsig.py +2 -2
@@ 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",
}