HP Support – HP OfficeJet 3830 All-in-One Printer series
HP Support – HP printers - 'Encryption Credentials Expired' error (macOS, iOS)
HP Support – Use the HP printer Embedded Web Server (EWS)
It sounds like you are using AirPrint – which allows printing to a printer without installing separate drivers. There is some security on the connection (to protect against eavesdropping), and it relies on a certificate provided by HP – one stored in the printer.
Certificates often have expiration dates. The one in your printer did, and it has expired. HP's Help page says that you need to "generate a new self-signed certificate in the EWS from any Windows PC." That is telling us that the printer itself can act as a Web site, and that if you visit that Web site ("visit your printer"), you can tell it to create a new certificate that, according to the Support article, will be good for another 10 years. Then your printer should work until it is time to do this all over again, or until your printer breaks, whichever comes first.
The part I don't like is "from any Windows PC." You might be able to carry out the update procedure using Safari, on your Mac. But there is a possibility that HP has coded the EWS in the printer in such a way that it will only work properly with browsers running on Windows PCs. That would not be very Mac-friendly for a printer that HP claims is compatible with Macs.