JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/openpgp/4.6.2/openpgp.js" integrity="sha256-EIIAtH8D7LvDfWCxczbwq1bmStEOpb2fTn4tlo6AwAw=" crossorigin="anonymous"></script>

JavaScript

const options = {
  userIds: [{ name:'Jon Smith', email:'[email protected]' }],
  rsaBits: 4096,
  passphrase: 'super long and hard to guess secret'
};

openpgp.generateKey(options).then(function(key) {
  return key.privateKeyArmored;
}).then(function(armoredPrivKey) {
	return openpgp.key.readArmored(armoredPrivKey);
}).then(function(parsed) {
	console.log(parsed.keys[0].getKeyId());
  const div = document.createElement('div');
  div.innerHTML = 'key id: ' + parsed.keys[0].getKeyId().toHex();
  document.body.appendChild(div);
});