const rawTokenPattern = /^[A-Za-z0-9_-]{43}$/ const phoenixSignedTokenPattern = /^SFMyNTY\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]{43}$/ const phoenixSignedTokenForms = new Set([ "support-confirmation-fragment-form", "content-removal-confirmation-fragment-form" ]) const rawTokenForms = new Set([ "magic-link-fragment-form", "email-change-fragment-form" ]) export const isProtectedFragmentTokenForForm = (formID, token) => { if (typeof token !== "string") return false if (phoenixSignedTokenForms.has(formID)) { return phoenixSignedTokenPattern.test(token) } if (rawTokenForms.has(formID)) { return rawTokenPattern.test(token) } return false }