The surety may tender to the creditor the amount of his debt and demand that the evidence of and the securities for the same be delivered up to him to be enforced against his principal or cosureties; and a failure of the creditor to comply, when within his power, shall operate to discharge the surety.