UNPKG

@pit-front-end/utils

Version:

湖南创智艾泰克科技有限公司

26 lines (25 loc) 562 B
import { KEYUTIL as f, KJUR as h } from "jsrsasign"; import { DEFINE_JWKS_PATH as m, DEFINE_JWKS_KID as E } from "./define.js"; function _(e) { return new Promise((n, o) => { fetch(m).then((t) => t.json()).then((t) => { const r = E, c = t.keys.filter( (K) => K.kid === r )[0], { kty: s, e: i, n: p } = c, y = f.getKey({ kty: s, e: i, n: p }), k = h.crypto.Cipher.encrypt( e, y, "RSA" ); n(k); }).catch((t) => { o(t); }); }); } export { _ as getJwks };