Edit: /tmp/tsx-0/17887-62936189336bca3a620d1e17a45dacd266a0200e (27651B)
{"code":"__filename=\"/opt/canhelp/node_modules/better-auth/dist/plugins/phone-number/routes.mjs\";(()=>{\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 routes_exports={};__export(routes_exports,{requestPasswordResetPhoneNumber:()=>requestPasswordResetPhoneNumber,resetPasswordPhoneNumber:()=>resetPasswordPhoneNumber,sendPhoneNumberOTP:()=>sendPhoneNumberOTP,signInPhoneNumber:()=>signInPhoneNumber,verifyPhoneNumber:()=>verifyPhoneNumber});module.exports=__toCommonJS(routes_exports);var import_date=require(\"../../utils/date.mjs\");var import_schema=require(\"../../db/schema.mjs\");var import_db=require(\"../../db/index.mjs\");var import_random=require(\"../../crypto/random.mjs\");var import_cookies=require(\"../../cookies/index.mjs\");var import_session=require(\"../../api/routes/session.mjs\");var import_api=require(\"../../api/index.mjs\");var import_error_codes=require(\"./error-codes.mjs\");var import_error=require(\"@better-auth/core/error\");var import_api2=require(\"@better-auth/core/api\");var z=__toESM(require(\"zod\"));const signInPhoneNumberBodySchema=z.object({phoneNumber:z.string().meta({description:'Phone number to sign in. Eg: \"+1234567890\"'}),password:z.string().meta({description:\"Password to use for sign in.\"}),rememberMe:z.boolean().meta({description:\"Remember the session. Eg: true\"}).optional()});const signInPhoneNumber=__name(opts=>(0,import_api2.createAuthEndpoint)(\"/sign-in/phone-number\",{method:\"POST\",body:signInPhoneNumberBodySchema,metadata:{openapi:{summary:\"Sign in with phone number\",description:\"Use this endpoint to sign in with phone number\",responses:{200:{description:\"Success\",content:{\"application/json\":{schema:{type:\"object\",properties:{user:{$ref:\"#/components/schemas/User\"},session:{$ref:\"#/components/schemas/Session\"}}}}}},400:{description:\"Invalid phone number or password\"}}}}},async ctx=>{const{password,phoneNumber}=ctx.body;if(opts.phoneNumberValidator){if(!await opts.phoneNumberValidator(ctx.body.phoneNumber))throw import_error.APIError.from(\"BAD_REQUEST\",import_error_codes.PHONE_NUMBER_ERROR_CODES.INVALID_PHONE_NUMBER)}const user=await ctx.context.adapter.findOne({model:\"user\",where:[{field:\"phoneNumber\",value:phoneNumber}]});if(!user)throw import_error.APIError.from(\"UNAUTHORIZED\",import_error_codes.PHONE_NUMBER_ERROR_CODES.INVALID_PHONE_NUMBER_OR_PASSWORD);if(opts.requireVerification){if(!user.phoneNumberVerified){const otp=generateOTP(opts.otpLength);await ctx.context.internalAdapter.createVerificationValue({value:otp,identifier:phoneNumber,expiresAt:(0,import_date.getDate)(opts.expiresIn,\"sec\")});if(opts.sendOTP)await ctx.context.runInBackgroundOrAwait(opts.sendOTP({phoneNumber,code:otp},ctx));throw import_error.APIError.from(\"UNAUTHORIZED\",import_error_codes.PHONE_NUMBER_ERROR_CODES.PHONE_NUMBER_NOT_VERIFIED)}}const credentialAccount=(await ctx.context.internalAdapter.findAccountByUserId(user.id)).find(a=>a.providerId===\"credential\");if(!credentialAccount){ctx.context.logger.error(\"Credential account not found\",{phoneNumber});throw import_error.APIError.from(\"UNAUTHORIZED\",import_error_codes.PHONE_NUMBER_ERROR_CODES.INVALID_PHONE_NUMBER_OR_PASSWORD)}const currentPassword=credentialAccount?.password;if(!currentPassword){ctx.context.logger.error(\"Password not found\",{phoneNumber});throw import_error.APIError.from(\"UNAUTHORIZED\",import_error_codes.PHONE_NUMBER_ERROR_CODES.UNEXPECTED_ERROR)}if(!await ctx.context.password.verify({hash:currentPassword,password})){ctx.context.logger.error(\"Invalid password\");throw import_error.APIError.from(\"UNAUTHORIZED\",import_error_codes.PHONE_NUMBER_ERROR_CODES.INVALID_PHONE_NUMBER_OR_PASSWORD)}const session=await ctx.context.internalAdapter.createSession(user.id,ctx.body.rememberMe===false);if(!session){ctx.context.logger.error(\"Failed to create session\");throw import_error.APIError.from(\"UNAUTHORIZED\",import_error.BASE_ERROR_CODES.FAILED_TO_CREATE_SESSION)}await(0,import_cookies.setSessionCookie)(ctx,{session,user},ctx.body.rememberMe===false);return ctx.json({token:session.token,user:(0,import_schema.parseUserOutput)(ctx.context.options,user)})}),\"signInPhoneNumber\");const sendPhoneNumberOTPBodySchema=z.object({phoneNumber:z.string().meta({description:'Phone number to send OTP. Eg: \"+1234567890\"'})});const sendPhoneNumberOTP=__name(opts=>(0,import_api2.createAuthEndpoint)(\"/phone-number/send-otp\",{method:\"POST\",body:sendPhoneNumberOTPBodySchema,metadata:{openapi:{summary:\"Send OTP to phone number\",description:\"Use this endpoint to send OTP to phone number\",responses:{200:{description:\"Success\",content:{\"application/json\":{schema:{type:\"object\",properties:{message:{type:\"string\"}}}}}}}}}},async ctx=>{if(!opts?.sendOTP){ctx.context.logger.warn(\"sendOTP not implemented\");throw import_error.APIError.from(\"NOT_IMPLEMENTED\",import_error_codes.PHONE_NUMBER_ERROR_CODES.SEND_OTP_NOT_IMPLEMENTED)}if(opts.phoneNumberValidator){if(!await opts.phoneNumberValidator(ctx.body.phoneNumber))throw import_error.APIError.from(\"BAD_REQUEST\",import_error_codes.PHONE_NUMBER_ERROR_CODES.INVALID_PHONE_NUMBER)}const code=generateOTP(opts.otpLength);await ctx.context.internalAdapter.createVerificationValue({value:`${code}:0`,identifier:ctx.body.phoneNumber,expiresAt:(0,import_date.getDate)(opts.expiresIn,\"sec\")});await ctx.context.runInBackgroundOrAwait(opts.sendOTP({phoneNumber:ctx.body.phoneNumber,code},ctx));return ctx.json({message:\"code sent\"})}),\"sendPhoneNumberOTP\");const verifyPhoneNumberBodySchema=z.object({phoneNumber:z.string().meta({description:'Phone number to verify. Eg: \"+1234567890\"'}),code:z.string().meta({description:'OTP code. Eg: \"123456\"'}),disableSession:z.boolean().meta({description:\"Disable session creation after verification. Eg: false\"}).optional(),updatePhoneNumber:z.boolean().meta({description:\"Check if there is a session and update the phone number. Eg: true\"}).optional()}).and(z.record(z.string(),z.any()));const verifyPhoneNumber=__name(opts=>(0,import_api2.createAuthEndpoint)(\"/phone-number/verify\",{method:\"POST\",body:verifyPhoneNumberBodySchema,metadata:{openapi:{summary:\"Verify phone number\",description:\"Use this endpoint to verify phone number\",responses:{\"200\":{description:\"Phone number verified successfully\",content:{\"application/json\":{schema:{type:\"object\",properties:{status:{type:\"boolean\",description:\"Indicates if the verification was successful\",enum:[true]},token:{type:\"string\",nullable:true,description:\"Session token if session is created, null if disableSession is true or no session is created\"},user:{type:\"object\",nullable:true,properties:{id:{type:\"string\",description:\"Unique identifier of the user\"},email:{type:\"string\",format:\"email\",nullable:true,description:\"User's email address\"},emailVerified:{type:\"boolean\",nullable:true,description:\"Whether the email is verified\"},name:{type:\"string\",nullable:true,description:\"User's name\"},image:{type:\"string\",format:\"uri\",nullable:true,description:\"User's profile image URL\"},phoneNumber:{type:\"string\",description:\"User's phone number\"},phoneNumberVerified:{type:\"boolean\",description:\"Whether the phone number is verified\"},createdAt:{type:\"string\",format:\"date-time\",description:\"Timestamp when the user was created\"},updatedAt:{type:\"string\",format:\"date-time\",description:\"Timestamp when the user was last updated\"}},required:[\"id\",\"phoneNumber\",\"phoneNumberVerified\",\"createdAt\",\"updatedAt\"],description:\"User object with phone number details, null if no user is created or found\"}},required:[\"status\"]}}}},400:{description:\"Invalid OTP\"}}}}},async ctx=>{if(opts?.verifyOTP){if(!await opts.verifyOTP({phoneNumber:ctx.body.phoneNumber,code:ctx.body.code},ctx))throw import_error.APIError.from(\"BAD_REQUEST\",import_error_codes.PHONE_NUMBER_ERROR_CODES.INVALID_OTP);if(await ctx.context.internalAdapter.findVerificationValue(ctx.body.phoneNumber))await ctx.context.internalAdapter.deleteVerificationByIdentifier(ctx.body.phoneNumber)}else{const otp=await ctx.context.internalAdapter.findVerificationValue(ctx.body.phoneNumber);if(!otp||otp.expiresAt
=allowedAttempts){await ctx.context.internalAdapter.deleteVerificationByIdentifier(ctx.body.phoneNumber);throw import_error.APIError.from(\"FORBIDDEN\",import_error_codes.PHONE_NUMBER_ERROR_CODES.TOO_MANY_ATTEMPTS)}if(otpValue!==ctx.body.code){await ctx.context.internalAdapter.updateVerificationByIdentifier(ctx.body.phoneNumber,{value:`${otpValue}:${parseInt(attempts||\"0\")+1}`});throw import_error.APIError.from(\"BAD_REQUEST\",import_error_codes.PHONE_NUMBER_ERROR_CODES.INVALID_OTP)}await ctx.context.internalAdapter.deleteVerificationByIdentifier(ctx.body.phoneNumber)}if(ctx.body.updatePhoneNumber){const session=await(0,import_session.getSessionFromCtx)(ctx);if(!session)throw import_error.APIError.from(\"UNAUTHORIZED\",import_error.BASE_ERROR_CODES.USER_NOT_FOUND);if((await ctx.context.adapter.findMany({model:\"user\",where:[{field:\"phoneNumber\",value:ctx.body.phoneNumber}]})).length)throw import_error.APIError.from(\"BAD_REQUEST\",import_error_codes.PHONE_NUMBER_ERROR_CODES.PHONE_NUMBER_EXIST);const user2=await ctx.context.internalAdapter.updateUser(session.user.id,{[opts.phoneNumber]:ctx.body.phoneNumber,[opts.phoneNumberVerified]:true});return ctx.json({status:true,token:session.session.token,user:(0,import_schema.parseUserOutput)(ctx.context.options,user2)})}let user=await ctx.context.adapter.findOne({model:\"user\",where:[{value:ctx.body.phoneNumber,field:opts.phoneNumber}]});if(!user){if(opts?.signUpOnVerification){const{phoneNumber,code,disableSession,updatePhoneNumber,...rest}=ctx.body;const additionalFields=(0,import_schema.parseUserInput)(ctx.context.options,rest,\"create\");user=await ctx.context.internalAdapter.createUser({...additionalFields,email:opts.signUpOnVerification.getTempEmail(ctx.body.phoneNumber),name:opts.signUpOnVerification.getTempName?opts.signUpOnVerification.getTempName(ctx.body.phoneNumber):ctx.body.phoneNumber,[opts.phoneNumber]:ctx.body.phoneNumber,[opts.phoneNumberVerified]:true});if(!user)throw import_error.APIError.from(\"INTERNAL_SERVER_ERROR\",import_error.BASE_ERROR_CODES.FAILED_TO_CREATE_USER)}}else user=await ctx.context.internalAdapter.updateUser(user.id,{[opts.phoneNumberVerified]:true});if(!user)throw import_error.APIError.from(\"INTERNAL_SERVER_ERROR\",import_error.BASE_ERROR_CODES.FAILED_TO_UPDATE_USER);await opts?.callbackOnVerification?.({phoneNumber:ctx.body.phoneNumber,user},ctx);if(!ctx.body.disableSession){const session=await ctx.context.internalAdapter.createSession(user.id);if(!session)throw import_error.APIError.from(\"INTERNAL_SERVER_ERROR\",import_error.BASE_ERROR_CODES.FAILED_TO_CREATE_SESSION);await(0,import_cookies.setSessionCookie)(ctx,{session,user});return ctx.json({status:true,token:session.token,user:(0,import_schema.parseUserOutput)(ctx.context.options,user)})}return ctx.json({status:true,token:null,user:(0,import_schema.parseUserOutput)(ctx.context.options,user)})}),\"verifyPhoneNumber\");const requestPasswordResetPhoneNumberBodySchema=z.object({phoneNumber:z.string()});const requestPasswordResetPhoneNumber=__name(opts=>(0,import_api2.createAuthEndpoint)(\"/phone-number/request-password-reset\",{method:\"POST\",body:requestPasswordResetPhoneNumberBodySchema,metadata:{openapi:{description:\"Request OTP for password reset via phone number\",responses:{\"200\":{description:\"OTP sent successfully for password reset\",content:{\"application/json\":{schema:{type:\"object\",properties:{status:{type:\"boolean\",description:\"Indicates if the OTP was sent successfully\",enum:[true]}},required:[\"status\"]}}}}}}}},async ctx=>{const user=await ctx.context.adapter.findOne({model:\"user\",where:[{value:ctx.body.phoneNumber,field:opts.phoneNumber}]});const code=generateOTP(opts.otpLength);await ctx.context.internalAdapter.createVerificationValue({value:`${code}:0`,identifier:`${ctx.body.phoneNumber}-request-password-reset`,expiresAt:(0,import_date.getDate)(opts.expiresIn,\"sec\")});if(!user)return ctx.json({status:true});if(opts.sendPasswordResetOTP)await ctx.context.runInBackgroundOrAwait(opts.sendPasswordResetOTP({phoneNumber:ctx.body.phoneNumber,code},ctx));return ctx.json({status:true})}),\"requestPasswordResetPhoneNumber\");const resetPasswordPhoneNumberBodySchema=z.object({otp:z.string().meta({description:'The one time password to reset the password. Eg: \"123456\"'}),phoneNumber:z.string().meta({description:'The phone number to the account which intends to reset the password for. Eg: \"+1234567890\"'}),newPassword:z.string().meta({description:`The new password. Eg: \"new-and-secure-password\"`})});const resetPasswordPhoneNumber=__name(opts=>(0,import_api2.createAuthEndpoint)(\"/phone-number/reset-password\",{method:\"POST\",body:resetPasswordPhoneNumberBodySchema,metadata:{openapi:{description:\"Reset password using phone number OTP\",responses:{\"200\":{description:\"Password reset successfully\",content:{\"application/json\":{schema:{type:\"object\",properties:{status:{type:\"boolean\",description:\"Indicates if the password was reset successfully\",enum:[true]}},required:[\"status\"]}}}}}}}},async ctx=>{const verification=await ctx.context.internalAdapter.findVerificationValue(`${ctx.body.phoneNumber}-request-password-reset`);if(!verification)throw import_error.APIError.from(\"BAD_REQUEST\",import_error_codes.PHONE_NUMBER_ERROR_CODES.OTP_NOT_FOUND);if(verification.expiresAt=allowedAttempts){await ctx.context.internalAdapter.deleteVerificationByIdentifier(phoneResetIdentifier);throw import_error.APIError.from(\"FORBIDDEN\",import_error_codes.PHONE_NUMBER_ERROR_CODES.TOO_MANY_ATTEMPTS)}if(ctx.body.otp!==otpValue){await ctx.context.internalAdapter.updateVerificationByIdentifier(phoneResetIdentifier,{value:`${otpValue}:${parseInt(attempts||\"0\")+1}`});throw import_error.APIError.from(\"BAD_REQUEST\",import_error_codes.PHONE_NUMBER_ERROR_CODES.INVALID_OTP)}const userRes=await ctx.context.adapter.findOne({model:\"user\",where:[{field:\"phoneNumber\",value:ctx.body.phoneNumber}],join:{account:true}});if(!userRes)throw import_error.APIError.from(\"BAD_REQUEST\",import_error_codes.PHONE_NUMBER_ERROR_CODES.UNEXPECTED_ERROR);const{account:accounts=[],...user}=userRes;const minLength=ctx.context.password.config.minPasswordLength;const maxLength=ctx.context.password.config.maxPasswordLength;if(ctx.body.newPassword.lengthmaxLength)throw import_error.APIError.from(\"BAD_REQUEST\",import_error.BASE_ERROR_CODES.PASSWORD_TOO_LONG);const hashedPassword=await ctx.context.password.hash(ctx.body.newPassword);if(!accounts.find(account=>account.providerId===\"credential\"))await ctx.context.internalAdapter.createAccount({userId:user.id,providerId:\"credential\",accountId:user.id,password:hashedPassword});else await ctx.context.internalAdapter.updatePassword(user.id,hashedPassword);await ctx.context.internalAdapter.deleteVerificationByIdentifier(phoneResetIdentifier);if(ctx.context.options.emailAndPassword?.onPasswordReset)await ctx.context.options.emailAndPassword.onPasswordReset({user},ctx.request);if(ctx.context.options.emailAndPassword?.revokeSessionsOnPasswordReset)await ctx.context.internalAdapter.deleteSessions(user.id);return ctx.json({status:true})}),\"resetPasswordPhoneNumber\");function generateOTP(size){return(0,import_random.generateRandomString)(size,\"0-9\")}__name(generateOTP,\"generateOTP\");0&&(module.exports={requestPasswordResetPhoneNumber,resetPasswordPhoneNumber,sendPhoneNumberOTP,signInPhoneNumber,verifyPhoneNumber});\n})()\n","warnings":[],"map":{"version":3,"mappings":";i/BAAA,iWAAwB,gCACxB,kBAAgD,+BAChD,cAAO,8BACP,kBAAqC,mCACrC,mBAAiC,mCACjC,mBAAkC,wCAClC,eAAO,+BACP,uBAAyC,6BACzC,iBAA2C,mCAC3C,IAAAA,YAAmC,iCACnC,MAAmB,wBAGnB,MAAM,4BAA8B,EAAE,OAAO,CAC5C,YAAa,EAAE,OAAO,EAAE,KAAK,CAAE,YAAa,4CAA+C,CAAC,EAC5F,SAAU,EAAE,OAAO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