1
|
|
2
|
# cookie-signature
|
3
|
|
4
|
Sign and unsign cookies.
|
5
|
|
6
|
## Example
|
7
|
|
8
|
```js
|
9
|
var cookie = require('cookie-signature');
|
10
|
|
11
|
var val = cookie.sign('hello', 'tobiiscool');
|
12
|
val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI');
|
13
|
|
14
|
var val = cookie.sign('hello', 'tobiiscool');
|
15
|
cookie.unsign(val, 'tobiiscool').should.equal('hello');
|
16
|
cookie.unsign(val, 'luna').should.be.false;
|
17
|
```
|
18
|
|
19
|
## License
|
20
|
|
21
|
(The MIT License)
|
22
|
|
23
|
Copyright (c) 2012 LearnBoost <tj@learnboost.com>
|
24
|
|
25
|
Permission is hereby granted, free of charge, to any person obtaining
|
26
|
a copy of this software and associated documentation files (the
|
27
|
'Software'), to deal in the Software without restriction, including
|
28
|
without limitation the rights to use, copy, modify, merge, publish,
|
29
|
distribute, sublicense, and/or sell copies of the Software, and to
|
30
|
permit persons to whom the Software is furnished to do so, subject to
|
31
|
the following conditions:
|
32
|
|
33
|
The above copyright notice and this permission notice shall be
|
34
|
included in all copies or substantial portions of the Software.
|
35
|
|
36
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
37
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
38
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
39
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
40
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
41
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
42
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|