Lines 2659-2699javascript
2659var require_import = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports) => {
2660 Object.defineProperty(exports, "__esModule", { value: true });
2661 exports.importSPKI = importSPKI;
2662 exports.importX509 = importX509;
2663 exports.importPKCS8 = importPKCS8;
2664 exports.importJWK = importJWK;
2665 const base64url_js_1 = require_base64url$1();
2666 const asn1_js_1 = require_asn1();
2667 const jwk_to_key_js_1 = require_jwk_to_key();
2668 const errors_js_1 = require_errors();
2669 const is_object_js_1 = require_is_object();
2670 async function importSPKI(spki, alg, options) {
2671 if (typeof spki !== "string" || spki.indexOf("-----BEGIN PUBLIC KEY-----") !== 0) throw new TypeError("\"spki\" must be SPKI formatted string");
2672 return (0, asn1_js_1.fromSPKI)(spki, alg, options);
2674 async function importX509(x509, alg, options) {
2675 if (typeof x509 !== "string" || x509.indexOf("-----BEGIN CERTIFICATE-----") !== 0) throw new TypeError("\"x509\" must be X.509 formatted string");
2676 return (0, asn1_js_1.fromX509)(x509, alg, options);
2678 async function importPKCS8(pkcs8, alg, options) {
2679 if (typeof pkcs8 !== "string" || pkcs8.indexOf("-----BEGIN PRIVATE KEY-----") !== 0) throw new TypeError("\"pkcs8\" must be PKCS#8 formatted string");
CriticalCritical Secret
Package contains a critical-looking secret pattern.
dist/cjs-C2fugEI8.cjsView on unpkg · L2679 2680 return (0, asn1_js_1.fromPKCS8)(pkcs8, alg, options);
2682 async function importJWK(jwk, alg) {
2683 if (!(0, is_object_js_1.default)(jwk)) throw new TypeError("JWK must be an object");
2687 if (typeof jwk.k !== "string" || !jwk.k) throw new TypeError("missing \"k\" (Key Value) Parameter value");
2688 return (0, base64url_js_1.decode)(jwk.k);
2689 case "RSA": if ("oth" in jwk && jwk.oth !== void 0) throw new errors_js_1.JOSENotSupported("RSA JWK \"oth\" (Other Primes Info) Parameter value is not supported");
2691 case "OKP": return (0, jwk_to_key_js_1.default)({
2695 default: throw new errors_js_1.JOSENotSupported("Unsupported \"kty\" (Key Type) Parameter value");