Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

couchdb-generate-session-id

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

couchdb-generate-session-id

generates valid CouchDB session IDs using username, salt, secret & timestamp

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

couchdb-generate-session-id

generates valid CouchDB session IDs using username, salt, secret & timestamp

Build Status Coverage Status Dependency Status devDependency Status

Example

var generateSessionId = require('couchdb-generate-session-id')

var sessionId = generateSessionId(
  'pat',
  '24eb90e9e1343977b8323857287ffca4',
  '78875068a1979fb910d5d8f37d316aa4',
  1449689785
)

Arguments

ArgumentTypeDescription
usernameStringname property of \_users doc
usersaltStringsalt property of \_users doc
serversecretStringcouch_httpd_auth.secret of CouchDB configuration
timestampNumberNumber of seconds elapsed since 1 January 1970 00:00:00 UTC

How CouchDB does it using Erlang

make_cookie_hash(UserName, Secret, TimeStamp) ->
    SessionData = UserName ++ ":" ++ erlang:integer_to_list(TimeStamp, 16),
    Hash = crypto:sha_mac(Secret, SessionData),
    couch_util:encodeBase64Url(SessionData ++ ":" ++ ?b2l(Hash)).

Credits

All credits due to @christophwitzko, @indutny & @janl: https://gist.github.com/janl/4583f5eb4c0d8216cc5f

License

Apache-2.0

Keywords

FAQs

Package last updated on 11 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc