Squishy Cookies 🍪

Easily sign and verify cookies.

Be Careful out there, there are alpha software out there with no guarantee.

Usage

import {
  cookieSign, cookieVerify
  createSignedCookie, verifySignedCookie,
} from 'mod.ts'

const cookie = await cookieSign('hello', 'super_secret')
// hello.gsSaKanhysk-CuNkIJhUWsHItAOcFZbrNNTa95qCfAE.

await cookieVerify('hello.gsSaKanhysk-CuNkIJhUWsHItAOcFZbrNNTa95qCfAE.', 'super_secret')
// true



const { headers, cookie } = await createSignedCookie(
    'id', '1', 'super_secret',
    { httpOnly: true, path: '/' }
)
return new Response(page, { headers })

// or

const headers = new Headers()
headers.set('set-cookie', cookie)