I have the following function, I am using TypeScript and the library OpenPGP JS
import * as openpgp from "openpgp"