Edit: /tmp/tsx-0/17887-508f68633a41f0fb300c351c56476a88fb2b1582 (4111B)
{"code":"__filename=\"/opt/canhelp/node_modules/jose/dist/webapi/jwt/unsecured.js\";(()=>{\nvar __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf;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 __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,\"default\",{value:mod,enumerable:true}):target,mod));var __toCommonJS=mod=>__copyProps(__defProp({},\"__esModule\",{value:true}),mod);var unsecured_exports={};__export(unsecured_exports,{UnsecuredJWT:()=>UnsecuredJWT});module.exports=__toCommonJS(unsecured_exports);var b64u=__toESM(require(\"../util/base64url.js\"));var import_buffer_utils=require(\"../lib/buffer_utils.js\");var import_errors=require(\"../util/errors.js\");var import_jwt_claims_set=require(\"../lib/jwt_claims_set.js\");class UnsecuredJWT{static{__name(this,\"UnsecuredJWT\")}#jwt;constructor(payload={}){this.#jwt=new import_jwt_claims_set.JWTClaimsBuilder(payload)}encode(){const header=b64u.encode(JSON.stringify({alg:\"none\"}));const payload=b64u.encode(this.#jwt.data());return`${header}.${payload}.`}setIssuer(issuer){this.#jwt.iss=issuer;return this}setSubject(subject){this.#jwt.sub=subject;return this}setAudience(audience){this.#jwt.aud=audience;return this}setJti(jwtId){this.#jwt.jti=jwtId;return this}setNotBefore(input){this.#jwt.nbf=input;return this}setExpirationTime(input){this.#jwt.exp=input;return this}setIssuedAt(input){this.#jwt.iat=input;return this}static decode(jwt,options){if(typeof jwt!==\"string\"){throw new import_errors.JWTInvalid(\"Unsecured JWT must be a string\")}const{0:encodedHeader,1:encodedPayload,2:signature,length}=jwt.split(\".\");if(length!==3||signature!==\"\"){throw new import_errors.JWTInvalid(\"Invalid Unsecured JWT\")}let header;try{header=JSON.parse(import_buffer_utils.decoder.decode(b64u.decode(encodedHeader)));if(header.alg!==\"none\")throw new Error}catch{throw new import_errors.JWTInvalid(\"Invalid Unsecured JWT\")}const payload=(0,import_jwt_claims_set.validateClaimsSet)(header,b64u.decode(encodedPayload),options);return{payload,header}}}0&&(module.exports={UnsecuredJWT});\n})()\n","warnings":[],"map":{"version":3,"mappings":";i/BAAA,6IAAsB,yCACtB,wBAAwB,kCACxB,kBAA2B,6BAC3B,0BAAoD,oCAC7C,MAAM,YAAa,CAJ1B,MAI0B,6BACtB,KACA,YAAY,QAAU,CAAC,EAAG,CACtB,KAAK,KAAO,IAAI,uCAAiB,OAAO,CAC5C,CACA,QAAS,CACL,MAAM,OAAS,KAAK,OAAO,KAAK,UAAU,CAAE,IAAK,MAAO,CAAC,CAAC,EAC1D,MAAM,QAAU,KAAK,OAAO,KAAK,KAAK,KAAK,CAAC,EAC5C,MAAO,GAAG,MAAM,IAAI,OAAO,GAC/B,CACA,UAAU,OAAQ,CACd,KAAK,KAAK,IAAM,OAChB,OAAO,IACX,CACA,WAAW,QAAS,CAChB,KAAK,KAAK,IAAM,QAChB,OAAO,IACX,CACA,YAAY,SAAU,CAClB,KAAK,KAAK,IAAM,SAChB,OAAO,IACX,CACA,OAAO,MAAO,CACV,KAAK,KAAK,IAAM,MAChB,OAAO,IACX,CACA,aAAa,MAAO,CAChB,KAAK,KAAK,IAAM,MAChB,OAAO,IACX,CACA,kBAAkB,MAAO,CACrB,KAAK,KAAK,IAAM,MAChB,OAAO,IACX,CACA,YAAY,MAAO,CACf,K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