feat(SW-2116): Use refId instead of confirmationNumber

This commit is contained in:
Michael Zetterberg
2025-05-04 11:11:15 +02:00
parent f681fa7675
commit b910b6a313
59 changed files with 491 additions and 310 deletions

View File

@@ -0,0 +1,21 @@
import "server-only"
import { decrypt, encrypt } from "./encryption"
export function calculateRefId(confirmationNumber: string, lastName: string) {
const encryptedRefId = encrypt(`${confirmationNumber},${lastName}`)
return encryptedRefId
}
export function parseRefId(refId: string) {
const data = decrypt(refId)
const parts = data.split(",")
if (parts.length !== 2) {
throw new Error("Invalid refId format")
}
return {
confirmationNumber: parts[0],
lastName: parts[1],
}
}