def aes_decrypt(key: bytes, cipher_text: bytes) -> bytes:
    """
    AES-GCM decryption

    Parameters
    ----------
    key: bytes
        AES session key, which derived from two secp256k1 keys
    cipher_text: bytes
        Encrypted text:
            nonce(16 bytes) + tag(16 bytes) + encrypted data

    Returns
    -------
    bytes
        Plain text

    >>> data = b'this is test data'
    >>> key = get_valid_secret()
    >>> aes_decrypt(key, aes_encrypt(key, data)) == data
    True
    >>> import os
    >>> key = os.urandom(32)
    >>> aes_decrypt(key, aes_encrypt(key, data)) == data
    True
    """
    nonce = cipher_text[:16]
    tag = cipher_text[16:32]
    ciphered_data = cipher_text[32:]

    aes_cipher = AES.new(key, AES_CIPHER_MODE, nonce=nonce)
    return aes_cipher.decrypt_and_verify(ciphered_data, tag)
def aes_decrypt ( key : bytes , cipher_text : bytes ) -> bytes : nonce = cipher_text [ : 16 ] tag = cipher_text [ 16 : 32 ] ciphered_data = cipher_text [ 32 : ] aes_cipher = AES . new ( key , AES_CIPHER_MODE , nonce = nonce ) return aes_cipher . decrypt_and_verify ( ciphered_data , tag )
AES-GCM decryption

    Parameters
    ----------
    key: bytes
        AES session key, which derived from two secp256k1 keys
    cipher_text: bytes
        Encrypted text:
            nonce(16 bytes) + tag(16 bytes) + encrypted data

    Returns
    -------
    bytes
        Plain text

    >>> data = b'this is test data'
    >>> key = get_valid_secret()
    >>> aes_decrypt(key, aes_encrypt(key, data)) == data
    True
    >>> import os
    >>> key = os.urandom(32)
    >>> aes_decrypt(key, aes_encrypt(key, data)) == data
    True