Skip to content

What is IP_ADDRESS_SALT? #317

Discussion options

You must be logged in to vote

Hi, it's for this function

import { createHash } from 'crypto';
import { NextApiRequest } from 'next';
export const getSessionId = (req: NextApiRequest) => {
const ipAddress =
req.headers['x-forwarded-for'] ||
// Fallback for localhost or non Vercel deployments
'0.0.0.0';
// Since a users IP address is part of the sessionId in our database, we
// hash it to protect their privacy. By combining it with a salt, we get
// get a unique id we can refer to, but we won't know what their ip
// address was.
const currentUserId = createHash('md5')
.u…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tszhong0411
Comment options

Answer selected by tszhong0411
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants