timeUntilTokenExpiry: convertExpiresAtToExpiryTimeInMs()

in src/server/routes/register.ts [177:211]


					timeUntilTokenExpiry: convertExpiresAtToExpiryTimeInMs(
						encryptedState.stateHandleExpiresAt,
					),
				},
			}),
			pageTitle: 'Check Your Inbox',
		});
		return res.type('html').send(html);
	}
	return res.redirect(
		303,
		addQueryParamsToPath('/register/email', state.queryParams),
	);
});

// Handler for the passcode input form
router.post(
	'/register/code',
	redirectIfLoggedIn,
	handleAsyncErrors(
		async (req: Request, res: ResponseWithRequestState, next: NextFunction) => {
			const { code } = req.body;

			const encryptedState = readEncryptedStateCookie(req);

			// make sure we have the encrypted state cookie and the code otherwise redirect to the email registration page
			if (encryptedState?.stateHandle && code) {
				const { stateHandle, userState } = encryptedState;

				try {
					// if the user is not in the NON_ACTIVE state, we know they're an existing user
					// going through the create account flow, so we use the oktaIdxApiSubmitPasscodeController
					// instead of the flow for new users
					if (userState && userState !== 'NOT_ACTIVE') {
						return oktaIdxApiSubmitPasscodeController({