eligibility_api/server.py
def make_token(
    payload: dict,
    jws_signing_alg: str,
    server_private_key,
    jwe_encryption_alg: str,
    jwe_cek_enc: str,
    client_public_key,
) -> str:
    """Wrap payload in a signed and encrypted JWT for response."""
    # sign the payload with server's private key
    header = {"typ": "JWS", "alg": jws_signing_alg}
    signed_token = jwt.JWT(header=header, claims=payload)
    signed_token.make_signed_token(_create_jwk(server_private_key))
    signed_payload = signed_token.serialize()
    # encrypt the signed payload with client's public key
    header = {
        "typ": "JWE",
        "alg": jwe_encryption_alg,
        "enc": jwe_cek_enc,
    }
    encrypted_token = jwt.JWT(header=header, claims=signed_payload)
    encrypted_token.make_encrypted_token(_create_jwk(client_public_key))
    return encrypted_token.serialize()
Wrap payload in a signed and encrypted JWT for response.
Wrap payload in a signed and encrypted JWT for response.
Wrap payload in a signed and encrypted JWT for response .
def make_token(
    payload: dict,
    jws_signing_alg: str,
    server_private_key,
    jwe_encryption_alg: str,
    jwe_cek_enc: str,
    client_public_key,
) -> str:
    header = {"typ": "JWS", "alg": jws_signing_alg}
    signed_token = jwt.JWT(header=header, claims=payload)
    signed_token.make_signed_token(_create_jwk(server_private_key))
    signed_payload = signed_token.serialize()
    header = {
        "typ": "JWE",
        "alg": jwe_encryption_alg,
        "enc": jwe_cek_enc,
    }
    encrypted_token = jwt.JWT(header=header, claims=signed_payload)
    encrypted_token.make_encrypted_token(_create_jwk(client_public_key))
    return encrypted_token.serialize()
def make_token ( payload : dict , jws_signing_alg : str , server_private_key , jwe_encryption_alg : str , jwe_cek_enc : str , client_public_key , ) -> str : header = { "typ" : "JWS" , "alg" : jws_signing_alg } signed_token = jwt . JWT ( header = header , claims = payload ) signed_token . make_signed_token ( _create_jwk ( server_private_key ) ) signed_payload = signed_token . serialize ( ) header = { "typ" : "JWE" , "alg" : jwe_encryption_alg , "enc" : jwe_cek_enc , } encrypted_token = jwt . JWT ( header = header , claims = signed_payload ) encrypted_token . make_encrypted_token ( _create_jwk ( client_public_key ) ) return encrypted_token . serialize ( )
Wrap payload in a signed and encrypted JWT for response.
Wrap payload in a signed and encrypted JWT for response .
"""Wrap payload in a signed and encrypted JWT for response.""" # sign the payload with server's private key # encrypt the signed payload with client's public key
payload
dict
jws_signing_alg
str
server_private_key
jwe_encryption_alg
str
jwe_cek_enc
str
client_public_key