Edit: /tmp/tsx-0/17887-01538e7d41e99af31fbd9306d1f0321c0344ae19 (5404B)
{"code":"__filename=\"/opt/canhelp/node_modules/jose/dist/webapi/jwk/thumbprint.js\";(()=>{\nvar __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __name=(target,value)=>__defProp(target,\"name\",{value,configurable:true});var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:true})};var __copyProps=(to,from,except,desc)=>{if(from&&typeof from===\"object\"||typeof from===\"function\"){for(let key of __getOwnPropNames(from))if(!__hasOwnProp.call(to,key)&&key!==except)__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable})}return to};var __toCommonJS=mod=>__copyProps(__defProp({},\"__esModule\",{value:true}),mod);var thumbprint_exports={};__export(thumbprint_exports,{calculateJwkThumbprint:()=>calculateJwkThumbprint,calculateJwkThumbprintUri:()=>calculateJwkThumbprintUri});module.exports=__toCommonJS(thumbprint_exports);var import_helpers=require(\"../lib/helpers.js\");var import_base64url=require(\"../util/base64url.js\");var import_errors=require(\"../util/errors.js\");var import_buffer_utils=require(\"../lib/buffer_utils.js\");var import_is_key_like=require(\"../lib/is_key_like.js\");var import_type_checks=require(\"../lib/type_checks.js\");var import_export=require(\"../key/export.js\");var import_invalid_key_input=require(\"../lib/invalid_key_input.js\");const check=__name((value,description)=>{if(typeof value!==\"string\"||!value){throw new import_errors.JWKInvalid(`${description} missing or invalid`)}},\"check\");async function calculateJwkThumbprint(key,digestAlgorithm){let jwk;if((0,import_type_checks.isJWK)(key)){jwk=key}else if((0,import_is_key_like.isKeyLike)(key)){jwk=await(0,import_export.exportJWK)(key)}else{throw new TypeError((0,import_invalid_key_input.invalidKeyInput)(key,\"CryptoKey\",\"KeyObject\",\"JSON Web Key\"))}digestAlgorithm??=\"sha256\";if(digestAlgorithm!==\"sha256\"&&digestAlgorithm!==\"sha384\"&&digestAlgorithm!==\"sha512\"){throw new TypeError('digestAlgorithm must one of \"sha256\", \"sha384\", or \"sha512\"')}let components;switch(jwk.kty){case\"AKP\":check(jwk.alg,'\"alg\" (Algorithm) Parameter');check(jwk.pub,'\"pub\" (Public key) Parameter');components={alg:jwk.alg,kty:jwk.kty,pub:jwk.pub};break;case\"EC\":check(jwk.crv,'\"crv\" (Curve) Parameter');check(jwk.x,'\"x\" (X Coordinate) Parameter');check(jwk.y,'\"y\" (Y Coordinate) Parameter');components={crv:jwk.crv,kty:jwk.kty,x:jwk.x,y:jwk.y};break;case\"OKP\":check(jwk.crv,'\"crv\" (Subtype of Key Pair) Parameter');check(jwk.x,'\"x\" (Public Key) Parameter');components={crv:jwk.crv,kty:jwk.kty,x:jwk.x};break;case\"RSA\":check(jwk.e,'\"e\" (Exponent) Parameter');check(jwk.n,'\"n\" (Modulus) Parameter');components={e:jwk.e,kty:jwk.kty,n:jwk.n};break;case\"oct\":check(jwk.k,'\"k\" (Key Value) Parameter');components={k:jwk.k,kty:jwk.kty};break;default:throw new import_errors.JOSENotSupported('\"kty\" (Key Type) Parameter missing or unsupported')}const data=(0,import_buffer_utils.encode)(JSON.stringify(components));return(0,import_base64url.encode)(await(0,import_helpers.digest)(digestAlgorithm,data))}__name(calculateJwkThumbprint,\"calculateJwkThumbprint\");async function calculateJwkThumbprintUri(key,digestAlgorithm){digestAlgorithm??=\"sha256\";const thumbprint=await calculateJwkThumbprint(key,digestAlgorithm);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${digestAlgorithm.slice(-3)}:${thumbprint}`}__name(calculateJwkThumbprintUri,\"calculateJwkThumbprintUri\");0&&(module.exports={calculateJwkThumbprint,calculateJwkThumbprintUri});\n})()\n","warnings":[],"map":{"version":3,"mappings":";suBAAA,sOAAuB,6BACvB,qBAA+B,gCAC/B,kBAA6C,6BAC7C,wBAAuB,kCACvB,uBAA0B,iCAC1B,uBAAsB,iCACtB,kBAA0B,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