http signatures: hold actor keys in an LRU cache
This commit is contained in:
parent
950cd1e720
commit
18b17f91e3
|
@ -7,6 +7,8 @@ from Crypto.PublicKey import RSA
|
||||||
from Crypto.Hash import SHA, SHA256, SHA512
|
from Crypto.Hash import SHA, SHA256, SHA512
|
||||||
from Crypto.Signature import PKCS1_v1_5
|
from Crypto.Signature import PKCS1_v1_5
|
||||||
|
|
||||||
|
from async_lru import alru_cache
|
||||||
|
|
||||||
from .remote_actor import fetch_actor
|
from .remote_actor import fetch_actor
|
||||||
|
|
||||||
|
|
||||||
|
@ -57,6 +59,7 @@ def sign_headers(headers, key, key_id):
|
||||||
return ','.join(chunks)
|
return ','.join(chunks)
|
||||||
|
|
||||||
|
|
||||||
|
@alru_cache(maxsize=16384)
|
||||||
async def fetch_actor_key(actor):
|
async def fetch_actor_key(actor):
|
||||||
actor_data = await fetch_actor(actor)
|
actor_data = await fetch_actor(actor)
|
||||||
|
|
||||||
|
|
|
@ -10,3 +10,4 @@ PyYAML==3.13
|
||||||
simplejson==3.16.0
|
simplejson==3.16.0
|
||||||
yarl==1.2.6
|
yarl==1.2.6
|
||||||
cachetools
|
cachetools
|
||||||
|
async_lru
|
||||||
|
|
Loading…
Reference in New Issue