Making homemade chocolate sauce can be a tasty treat. But to can a chocolate sauce safely raises some food safety risks.
Chocolate sauces are low acid foods which could be a risk for botulism food poisoning. There are no chocolate sauce recipes tested for pressure canning.
There are very few recipes that have been tested to be water bath canned. These contain fruit or bottled lemon juice to raise the overall acidity. These also contain unsweetened cocoa powder which has a red-brown color. Recipes that list cocoa powder as an ingredient use unsweetened cocoa powder. An example is Chocolate Raspberry Sauce from Newell Brands.
Do not use Dutch-process or alkalized unsweetened cocoa powder because this will lower the overall acidity. This can lead to an unsafe product. Dutch-process cocoa powder has a dark brown color. Never substitute hot chocolate or cocoa mixes, chocolate syrups, or chocolate bars.
A safe alternative to preserve chocolate sauce is freezing. The National Center for Home Food Preservation has a Freezer Chocolate Fudge Sauce.
Source: Canning with Chocolate, UCCE Master Food Preservers of El Dorado County, University of California ANR