You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.5 KiB

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