from authlib.jose import JsonWebKey
from aws_lambda_powertools.event_handler.api_gateway import Router

from util import read_file_path

router = Router()
public_jwk = JsonWebKey.import_key(read_file_path('public.pem'))


@router.get('/.well-known/jwks.json')
def jwks():
    return {
        'keys': [
            public_jwk.as_dict(),
        ]
    }
