async def decrypt(
            self,
            ciphertext: bytes,
            authn_check: bool = None,
            to_verkey: str = None,
            from_verkey: str = None) -> (bytes, str):
        """
        Decrypt ciphertext and optionally authenticate sender.

        Raise BadKey if authentication operation checks and reveals sender key distinct from input
        sender verification key.  Raise AbsentMessage for missing ciphertext, or WalletState if
        wallet is closed.

        :param ciphertext: ciphertext, as bytes
        :param authn_check: True to authenticate and check sender verification key,
            False to authenticate and return sender verification key for client to decide fitness, or
            None to use anonymous decryption
        :param to_verkey: recipient verification key, default anchor's own
        :param from_verkey: sender verification key, ignored for anonymous decryption,
            default anchor's own for authenticated decryption
        :return: decrypted bytes and sender verification key (None for anonymous decryption)
        """

        LOGGER.debug(
            'Wallet.decrypt >>> ciphertext: %s, authn_check: %s, to_verkey: %s, from_verkey: %s',
            ciphertext,
            authn_check,
            to_verkey,
            from_verkey)

        if not ciphertext:
            LOGGER.debug('Wallet.decrypt <!< No ciphertext to decrypt')
            raise AbsentMessage('No ciphertext to decrypt')

        if not self.handle:
            LOGGER.debug('Wallet.decrypt <!< Wallet %s is closed', self.name)
            raise WalletState('Wallet {} is closed'.format(self.name))

        sender_verkey = None
        if authn_check is None:
            plaintext = await crypto.anon_decrypt(self.handle, to_verkey or self.verkey, ciphertext)
        else:
            (sender_verkey, plaintext) = await crypto.auth_decrypt(self.handle, to_verkey or self.verkey, ciphertext)
            if authn_check and sender_verkey != (from_verkey or self.verkey):
                LOGGER.debug('Wallet.decrypt <!< Authentication revealed unexpected sender key on decryption')
                raise BadKey('Authentication revealed unexpected sender key on decryption')

        rv = (plaintext, sender_verkey)
        LOGGER.debug('Wallet.decrypt <<< %s', rv)
        return rv
async def decrypt ( self , ciphertext : bytes , authn_check : bool = None , to_verkey : str = None , from_verkey : str = None ) -> ( bytes , str ) : LOGGER . debug ( 'Wallet.decrypt >>> ciphertext: %s, authn_check: %s, to_verkey: %s, from_verkey: %s' , ciphertext , authn_check , to_verkey , from_verkey ) if not ciphertext : LOGGER . debug ( 'Wallet.decrypt <!< No ciphertext to decrypt' ) raise AbsentMessage ( 'No ciphertext to decrypt' ) if not self . handle : LOGGER . debug ( 'Wallet.decrypt <!< Wallet %s is closed' , self . name ) raise WalletState ( 'Wallet {} is closed' . format ( self . name ) ) sender_verkey = None if authn_check is None : plaintext = await crypto . anon_decrypt ( self . handle , to_verkey or self . verkey , ciphertext ) else : ( sender_verkey , plaintext ) = await crypto . auth_decrypt ( self . handle , to_verkey or self . verkey , ciphertext ) if authn_check and sender_verkey != ( from_verkey or self . verkey ) : LOGGER . debug ( 'Wallet.decrypt <!< Authentication revealed unexpected sender key on decryption' ) raise BadKey ( 'Authentication revealed unexpected sender key on decryption' ) rv = ( plaintext , sender_verkey ) LOGGER . debug ( 'Wallet.decrypt <<< %s' , rv ) return rv
Decrypt ciphertext and optionally authenticate sender.

        Raise BadKey if authentication operation checks and reveals sender key distinct from input
        sender verification key.  Raise AbsentMessage for missing ciphertext, or WalletState if
        wallet is closed.

        :param ciphertext: ciphertext, as bytes
        :param authn_check: True to authenticate and check sender verification key,
            False to authenticate and return sender verification key for client to decide fitness, or
            None to use anonymous decryption
        :param to_verkey: recipient verification key, default anchor's own
        :param from_verkey: sender verification key, ignored for anonymous decryption,
            default anchor's own for authenticated decryption
        :return: decrypted bytes and sender verification key (None for anonymous decryption)