def _parse_to_recoverable_signature(sig):
    """
        Returns a parsed recoverable signature of length 65 bytes
    """
    # Buffer for getting values of signature object
    assert isinstance(sig, bytes)
    assert len(sig) == 65

    # Make a recoverable signature of 65 bytes
    rec_sig = ffi.new("secp256k1_ecdsa_recoverable_signature *")
    # Retrieving the recid from the last byte of the signed key
    recid = ord(sig[64:65])

    # Parse a revoverable signature
    parsable_sig = lib.secp256k1_ecdsa_recoverable_signature_parse_compact(
        ctx,
        rec_sig,
        sig,
        recid
    )
    # Verify that the signature is parsable
    if not parsable_sig:
        raise InvalidSignatureError()

    return rec_sig
def _parse_to_recoverable_signature ( sig ) : assert isinstance ( sig , bytes ) assert len ( sig ) == 65 rec_sig = ffi . new ( "secp256k1_ecdsa_recoverable_signature *" ) recid = ord ( sig [ 64 : 65 ] ) parsable_sig = lib . secp256k1_ecdsa_recoverable_signature_parse_compact ( ctx , rec_sig , sig , recid ) if not parsable_sig : raise InvalidSignatureError ( ) return rec_sig
Returns a parsed recoverable signature of length 65 bytes