26 lines
758 B
Markdown
26 lines
758 B
Markdown
# @tinyhttp/cookie-signature
|
|
|
|
[](https://npmjs.com/package/@tinyhttp/cookie-signature) [](https://npmjs.com/package/@tinyhttp/cookie-signature)
|
|
|
|
HTTP cookie signing and unsigning. A rewrite of [cookie-signature](https://github.com/tj/node-cookie-signature) module.
|
|
|
|
## Install
|
|
|
|
```sh
|
|
pnpm i @tinyhttp/cookie-signature
|
|
```
|
|
|
|
## API
|
|
|
|
```js
|
|
import { sign, unsign } from '@tinyhttp/cookie-signature'
|
|
```
|
|
|
|
### `sign(val, secret)`
|
|
|
|
Signd the given `val` with `secret`.
|
|
|
|
### `unsign(val, secret)`
|
|
|
|
Unsign and decode the given `val` with `secret`, returning `false` if the signature is invalid.
|