{"id":21905414,"url":"https://github.com/hex7c0/cookie-encryption","last_synced_at":"2025-04-15T23:47:06.931Z","repository":{"id":20454186,"uuid":"23731343","full_name":"hex7c0/cookie-encryption","owner":"hex7c0","description":"encrypt/decrypt data to store on cookie with memoization for Nodejs","archived":false,"fork":false,"pushed_at":"2024-03-25T22:50:37.000Z","size":294,"stargazers_count":7,"open_issues_count":5,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-13T19:19:45.082Z","etag":null,"topics":["cookie","nodejs"],"latest_commit_sha":null,"homepage":"https://github.com/hex7c0/cookie-encryption","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hex7c0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2014-09-06T09:33:10.000Z","updated_at":"2024-04-23T01:31:02.413Z","dependencies_parsed_at":"2024-04-23T01:31:01.032Z","dependency_job_id":"3afea74a-5bfb-462e-9e41-0f1a4d641d85","html_url":"https://github.com/hex7c0/cookie-encryption","commit_stats":{"total_commits":138,"total_committers":2,"mean_commits":69.0,"dds":0.007246376811594235,"last_synced_commit":"0a0612559b79ee604be29b784f6c63885cbbd0bf"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Fcookie-encryption","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Fcookie-encryption/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Fcookie-encryption/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hex7c0%2Fcookie-encryption/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hex7c0","download_url":"https://codeload.github.com/hex7c0/cookie-encryption/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249173060,"owners_count":21224481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cookie","nodejs"],"created_at":"2024-11-28T16:33:17.960Z","updated_at":"2025-04-15T23:47:06.917Z","avatar_url":"https://github.com/hex7c0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [cookie-encryption](https://github.com/hex7c0/cookie-encryption)\n\n[![NPM version](https://img.shields.io/npm/v/cookie-encryption.svg)](https://www.npmjs.com/package/cookie-encryption)\n[![Linux Status](https://img.shields.io/travis/hex7c0/cookie-encryption.svg?label=linux-osx)](https://travis-ci.org/hex7c0/cookie-encryption)\n[![Windows Status](https://img.shields.io/appveyor/ci/hex7c0/cookie-encryption.svg?label=windows)](https://ci.appveyor.com/project/hex7c0/cookie-encryption)\n[![Dependency Status](https://img.shields.io/david/hex7c0/cookie-encryption.svg)](https://david-dm.org/hex7c0/cookie-encryption)\n[![Coveralls](https://img.shields.io/coveralls/hex7c0/cookie-encryption.svg)](https://coveralls.io/r/hex7c0/cookie-encryption)\n\nEncrypt/decrypt data to store on cookie, with memoization.\nThis class is built with \n[arc4 cipher](https://github.com/hex7c0/arc4), \n[autokey cipher](https://github.com/hex7c0/autokey), \n[nodejs ciphers](http://nodejs.org/api/crypto.html#crypto_crypto_getciphers), \n[nodejs hash](http://nodejs.org/api/crypto.html#crypto_crypto_gethashes), \n[nodejs hmac](http://nodejs.org/api/crypto.html#crypto_crypto_createhmac_algorithm_key), \n[nodejs pbkdf2](http://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen) and \n[nodejs diffiehellman](http://nodejs.org/api/crypto.html#crypto_crypto_getdiffiehellman_group_name), \n\n## Installation\n\nInstall through NPM\n\n```bash\nnpm install cookie-encryption\n```\nor\n```bash\ngit clone git://github.com/hex7c0/cookie-encryption.git\n```\n\n## API\n\ninside expressjs project\n```js\nvar cookiee = require('cookie-encryption');\n\nvar vault = cookiee('ciao');\n```\n\nreturn supported ciphers\n```js\nvar cookiee = require('cookie-encryption');\n\ncookiee.getCiphers();\n```\n\nCheck [Cookie options](http://expressjs.com/api.html#res.cookie)\n\n### Methods\n\nwrite data ('pippo') to selected cookie\n```js\nvault.write(req, 'pippo');\n```\n\nread data from selected cookie\n```js\nvault.read(req);\n```\n\nflush data cache\n```js\nvault.flush();\n```\n\noptional arguments inside of previous methods\n```\n * @param {String} [cookie] - fast cookie\n * @param {String} [encoding] - fast encoding\n```\n\n### cookiee(secret [, options])\n\n#### secret\n\n - `secret`- **String | Buffer** Set password *(default \"required\")*\n\n#### [options]\n\n - `cipher` - **String** Type of cipher, grab list from `getCiphers` *(default \"arc4\")*\n - `domain` - **String** Domain of cookie *(default \"null\")*\n - `cookie` - **String** Name of cookie *(default \"vault\")*\n - `path` - **String** Path of cookie *(default \"/\")*\n - `maxAge` - **Number** Age of cookie in millisecond *(default \"1 year\")*\n - `httpOnly` - **Boolean** Flag for http only cookie *(default \"false\")*\n - `secure` - **Boolean** Flag for using cookie over TLS/SSL *(default \"false\")*\n - `signed` - **Boolean** Will use the secret passed to cookieParser(secret) to sign the value *(default \"false\")*\n - `encoding` - **String** Type of output encoding by [nodejs](http://nodejs.org/api/buffer.html#apicontent) *(default \"hex\")*\n - `extra` - **Array** Extra info for `Hmac` (`[true]` to enable instead of `Hash`) and `pbkdf2` (`[salt, iterations, keylen]`) *(default \"`[ ]`\")*\n\n## Examples\n\nTake a look at my [examples](examples)\n\n### [License GPLv3](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhex7c0%2Fcookie-encryption","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhex7c0%2Fcookie-encryption","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhex7c0%2Fcookie-encryption/lists"}