Edit: /tmp/tsx-0/17887-f91f8cbb931dfee9f60b7317028a8a92c0382abe (3955B)
{"code":"__filename=\"/opt/canhelp/node_modules/better-auth/dist/plugins/jwt/utils.mjs\";(()=>{\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 utils_exports={};__export(utils_exports,{createJwk:()=>createJwk,generateExportedKeyPair:()=>generateExportedKeyPair,toExpJWT:()=>toExpJWT});module.exports=__toCommonJS(utils_exports);var import_crypto=require(\"../../crypto/index.mjs\");var import_time=require(\"../../utils/time.mjs\");var import_adapter=require(\"./adapter.mjs\");var import_jose=require(\"jose\");function toExpJWT(expirationTime,iat){if(typeof expirationTime===\"number\")return expirationTime;else if(expirationTime instanceof Date)return Math.floor(expirationTime.getTime()/1e3);else return iat+(0,import_time.sec)(expirationTime)}__name(toExpJWT,\"toExpJWT\");async function generateExportedKeyPair(options){const{alg,...cfg}=options?.jwks?.keyPairConfig??{alg:\"EdDSA\",crv:\"Ed25519\"};const{publicKey,privateKey}=await(0,import_jose.generateKeyPair)(alg,{...cfg,extractable:true});return{publicWebKey:await(0,import_jose.exportJWK)(publicKey),privateWebKey:await(0,import_jose.exportJWK)(privateKey),alg,cfg}}__name(generateExportedKeyPair,\"generateExportedKeyPair\");async function createJwk(ctx,options){const{publicWebKey,privateWebKey,alg,cfg}=await generateExportedKeyPair(options);const stringifiedPrivateWebKey=JSON.stringify(privateWebKey);const privateKeyEncryptionEnabled=!options?.jwks?.disablePrivateKeyEncryption;const jwk={alg,...cfg&&\"crv\"in cfg?{crv:cfg.crv}:{},publicKey:JSON.stringify(publicWebKey),privateKey:privateKeyEncryptionEnabled?JSON.stringify(await(0,import_crypto.symmetricEncrypt)({key:ctx.context.secretConfig,data:stringifiedPrivateWebKey})):stringifiedPrivateWebKey,createdAt:new Date,...options?.jwks?.rotationInterval?{expiresAt:new Date(Date.now()+options.jwks.rotationInterval*1e3)}:{}};return await(0,import_adapter.getJwksAdapter)(ctx.context.adapter,options).createJwk(ctx,jwk)}__name(createJwk,\"createJwk\");0&&(module.exports={createJwk,generateExportedKeyPair,toExpJWT});\n})()\n","warnings":[],"map":{"version":3,"mappings":";suBAAA,8MAAiC,kCACjC,gBAAoB,gCACpB,mBAA+B,yBAC/B,gBAA2C,gBAY3C,SAAS,SAAS,eAAgB,IAAK,CACtC,GAAI,OAAO,iBAAmB,SAAU,OAAO,uBACtC,0BAA0B,KAAM,OAAO,KAAK,MAAM,eAAe,QAAQ,EAAI,GAAG,MACpF,QAAO,OAAM,iBAAI,cAAc,CACrC,CAJS,4BAKT,eAAe,wBAAwB,QAAS,CAC/C,KAAM,CAAE,IAAK,GAAG,GAAI,EAAI,SAAS,MAAM,eAAiB,CACvD,IAAK,QACL,IAAK,SACN,EACA,KAAM,CAAE,UAAW,UAAW,EAAI,QAAM,6BAAgB,IAAK,CAC5D,GAAG,IACH,YAAa,IACd,CAAC,EACD,MAAO,CACN,aAAc,QAAM,uBAAU,SAAS,EACvC,cAAe,QAAM,uBAAU,UAAU,EACzC,IACA,GACD,CACD,CAfe,0DAuBf,eAAe,UAAU,IAAK,QAAS,CACtC,KAAM,CAAE,aAAc,cAAe,IAAK,GAAI,EAAI,MAAM,wBAAwB,OAAO,EACvF,MAAM,yBAA2B,KAAK,UAAU,aAAa,EAC7D,MAAM,4BAA8B,CAAC,SAAS,MAAM,4BACpD,MAAM,IAAM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