INNER CODE UNIT · JavaScript

getPublicKey

DinoChiesa/jwt-webtool · src/js/app.js:337

function getPublicKey(header, options) {
  options = options || {};
  editors.publickey.save();
  const fieldValue = $sel("#ta_publickey")
    .value.trim()
    .replace(new RegExp("[^\x00-\x7F]", "g"), ""); // strip non - ASCII

  if (looksLikePem(fieldValue)) {
    // if de-serializing from PEM, apply the kid, if any
    return jose.JWK.asKey(fieldValue, "pem", { ...options, ...header });
  }

  let parseable = false;
  try {
    JSON.parse(fieldValue);
    parseable = true;
  } catch (_e1) {
    setAlert("not parseable as JWKS?");

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…