(rawValue: string)
| 33 | * @returns The unsigned cookie value. |
| 34 | */ |
| 35 | export const unsign = (rawValue: string): UnsignResult => { |
| 36 | const prefix = rawValue.slice(0, 2); |
| 37 | if (prefix !== 's:') return { valid: false, renew: false, value: null }; |
| 38 | |
| 39 | const value = rawValue.slice(2); |
| 40 | return fastifyCookie.unsign(value, COOKIE_SECRET); |
| 41 | }; |
| 42 | |
| 43 | /** |
| 44 | * Compatibility plugin for using cookies signed by express. By prefixing with |