{"id":19680075,"url":"https://github.com/drewolson/purescript-biscotti-session","last_synced_at":"2026-03-19T11:03:21.984Z","repository":{"id":35106613,"uuid":"205398578","full_name":"drewolson/purescript-biscotti-session","owner":"drewolson","description":"PureScript Session Management","archived":false,"fork":false,"pushed_at":"2023-03-05T01:34:04.000Z","size":225,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-10T06:58:24.312Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PureScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drewolson.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-30T14:29:30.000Z","updated_at":"2023-07-25T14:28:40.000Z","dependencies_parsed_at":"2022-08-08T05:01:19.974Z","dependency_job_id":null,"html_url":"https://github.com/drewolson/purescript-biscotti-session","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewolson%2Fpurescript-biscotti-session","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewolson%2Fpurescript-biscotti-session/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewolson%2Fpurescript-biscotti-session/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drewolson%2Fpurescript-biscotti-session/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drewolson","download_url":"https://codeload.github.com/drewolson/purescript-biscotti-session/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240989223,"owners_count":19889649,"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":[],"created_at":"2024-11-11T18:03:53.846Z","updated_at":"2026-03-02T16:46:13.504Z","avatar_url":"https://github.com/drewolson.png","language":"PureScript","readme":"# purescript-biscotti-session\n\n[![Build\nStatus](https://github.com/drewolson/purescript-biscotti-session/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/drewolson/purescript-biscotti-session/actions/workflows/test.yml)\n\nDocumentation is available on\n[Pursuit](https://pursuit.purescript.org/packages/purescript-biscotti-session).\n\nThis library provides tools to manage sessions in PureScript. It makes the\nassumption that your session data is JSON-serializable (using the Argonaut\n`EncodeJson` and `DecodeJson` type classes). Two session stores are provided:\n`Cookie` and `Memory`.\n\n`Session` provides 4 basic functions: `create`, `get`, `set` and `destroy`.\n\n* `create` takes a `SessionStore` and your session data and returns a\n  [Cookie](https://github.com/drewolson/purescript-biscotti-cookie) representing\n  your new session.\n* `get` takes a `SessionStore` and a `Cookie` and returns your session data, if\n  available.\n* `set` takes a `SessionStore`, your session data and your current session\n  `Cookie`. It returns a new session `Cookie`.\n* `destroy` takes a `SessionStore` and your session `Cookie` and returns a new,\nempty session `Cookie`.\n\n## Session Stores\n\n### Cookie Store\n\nThe `Cookie` session store uses\n[libsodium](https://github.com/jedisct1/libsodium.js) to encrypt and decrypt\nsession data directly in the cookie. You'll need to install the npm package\n`libsodium-wrappers`:\n\n```text\nnpm install libsodium-wrappers\n```\n\nYou create a `Cookie` store by calling `Biscotti.Session.cookieStore` with a\nname for your session cookie and a `libsodium`-compatible secret, hex encoded.\n\n```purescript\nimport Biscotti.Session as Session\n\nlet store = Session.cookieStore \"_my_app\" \"724b092810ec86d7e35c9d067702b31ef90bc43a7b598626749914d6a3e033ed\"\n```\n\n**Note**: This is an example secret.  Please don't\ncommit your production secret to your git repo or post it on the internet. Also,\nplease don't use this secret as it is already posted on the internet. It's\nliterally right above this paragraph and you're reading this on the internet.\n\n### Memory Store\n\nThe `Memory` session store uses an in-memory map to store sessions. This is\nprimarily for development purposes as it will not persist sessions across\nmultiple application servers. You'll need to install two npm packages to\ngenerate UUIDs:\n\n```text\nnpm install uuid uuid-validate\n```\n\nYou create a `Memory` store by calling `Biscotti.Session.memoryStore` with a\nname for your session cookie. Note that this returns a `Effect SessionStore`\nbecause it requires initializing a `Ref`.\n\n```purescript\nimport Biscotti.Session as Session\n\nlaunchAff_ do\n  store \u003c- liftEffect $ Session.memoryStore \"_my_app\"\n```\n\n## Running the tests\n\n```text\nspago test\n```\n\n## Contributing\n\nMake sure the CI build will pass before opening a pull request:\n\n```text\nnpm run ci\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrewolson%2Fpurescript-biscotti-session","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrewolson%2Fpurescript-biscotti-session","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrewolson%2Fpurescript-biscotti-session/lists"}