cookie-signature-edge
TypeScript icon, indicating that this package has built-in type declarations

1.0.7 • Public • Published

cookie-signature-edge

A package that sign and unsign cookies for Edge API Routes.

Installation

With NPM

npm i cookie-signature-edge --save

With Yarn

yarn add cookie-signature-edge --save

Example

Use this module in Edge API Routes

import {sign,unsign} from 'cookie-signature-edge'

export const config = {
  runtime: 'edge',
}

export default async (req) => {
  const value = "hello2";
  const secret='qwertyuiasdfghjkzxcvbnm';
  const signedValue=await sign(value,secret);
  const unsignedValue = await unsign(signedValue,secret)
  console.log(unsignedValue);
  // value===unsignedValue
  // unfinished code ...
}

Contribution

Suggestions with code examples or pull requests are encouraged.

Package Sidebar

Install

npm i cookie-signature-edge

Weekly Downloads

6

Version

1.0.7

License

MIT

Unpacked Size

36.6 kB

Total Files

17

Last publish

Collaborators

  • alvinthedeveloper