-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed description Refine documentation Changed TypeScript compile output location Added installation instruction
- Loading branch information
1 parent
dbcedcf
commit da70e91
Showing
7 changed files
with
34 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,35 @@ | ||
# cookie-signature-edge | ||
#### An Edge Runtime package that sign and unsign cookies. This package is currently for Edge Runtime only. | ||
#### A package that sign and unsign cookies for Edge API Routes. | ||
|
||
## Installation | ||
### With NPM | ||
```bash | ||
npm i cookie-signature-edge --save | ||
``` | ||
### With Yarn | ||
```bash | ||
yarn add cookie-signature-edge --save | ||
``` | ||
|
||
## Example | ||
### Use this module in Edge API Routes | ||
```js | ||
import {sign,unsign} from 'cookie-signature-edge' | ||
const value = "hello"; | ||
const secret='qwertyuiasdfghjkzxcvbnm'; | ||
const signedValue=await sign(value,secret); | ||
const unsignedValue = await unsign(signedValue,secret) | ||
// value===unsignedValue | ||
|
||
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. |
File renamed without changes.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,8 @@ | |
{ | ||
"name": "next" | ||
} | ||
] | ||
], | ||
"outDir": "dist" | ||
}, | ||
"include": [ | ||
"**/*.ts", | ||
|
This file was deleted.
Oops, something went wrong.