kopia lustrzana https://github.com/tsileo/little-boxes
Fix HTTP signatures
rodzic
f29ae556cd
commit
21672a7e4d
|
@ -63,7 +63,7 @@ def _body_digest(body: str) -> str:
|
||||||
|
|
||||||
def _get_public_key(key_id: str) -> Key:
|
def _get_public_key(key_id: str) -> Key:
|
||||||
actor = get_backend().fetch_iri(key_id)
|
actor = get_backend().fetch_iri(key_id)
|
||||||
k = Key(actor["id"])
|
k = Key(actor["id"], key_id)
|
||||||
k.load_pub(actor["publicKey"]["publicKeyPem"])
|
k.load_pub(actor["publicKey"]["publicKeyPem"])
|
||||||
return k
|
return k
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Key(object):
|
||||||
self.privkey = k
|
self.privkey = k
|
||||||
|
|
||||||
def key_id(self) -> str:
|
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]:
|
def to_dict(self) -> Dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -16,9 +16,9 @@ def test_httpsig():
|
||||||
back = InMemBackend()
|
back = InMemBackend()
|
||||||
ap.use_backend(back)
|
ap.use_backend(back)
|
||||||
|
|
||||||
k = Key("https://lol.com")
|
k = Key("https://lol.com", "https://lol.com#lol")
|
||||||
k.new()
|
k.new()
|
||||||
back.FETCH_MOCK["https://lol.com#main-key"] = {
|
back.FETCH_MOCK["https://lol.com#lol"] = {
|
||||||
"publicKey": k.to_dict(),
|
"publicKey": k.to_dict(),
|
||||||
"id": "https://lol.com",
|
"id": "https://lol.com",
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue