http signatures: hold actor keys in an LRU cache

This commit is contained in:
kaniini 2019-01-08 05:14:59 +00:00
parent 950cd1e720
commit 18b17f91e3
2 changed files with 4 additions and 0 deletions

View file

@ -7,6 +7,8 @@ from Crypto.PublicKey import RSA
from Crypto.Hash import SHA, SHA256, SHA512
from Crypto.Signature import PKCS1_v1_5
from async_lru import alru_cache
from .remote_actor import fetch_actor
@ -57,6 +59,7 @@ def sign_headers(headers, key, key_id):
return ','.join(chunks)
@alru_cache(maxsize=16384)
async def fetch_actor_key(actor):
actor_data = await fetch_actor(actor)

View file

@ -10,3 +10,4 @@ PyYAML==3.13
simplejson==3.16.0
yarl==1.2.6
cachetools
async_lru