{"id":15681589,"url":"https://github.com/andrewda/node-securelogin","last_synced_at":"2025-05-07T12:42:04.996Z","repository":{"id":138526874,"uuid":"94513199","full_name":"andrewda/node-securelogin","owner":"andrewda","description":"A tiny module used to verify SecureLogin tokens","archived":false,"fork":false,"pushed_at":"2017-07-02T17:11:35.000Z","size":50,"stargazers_count":10,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-04T01:32:14.104Z","etag":null,"topics":["auth","authentication","securelogin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrewda.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2017-06-16T06:35:24.000Z","updated_at":"2019-09-17T06:13:34.000Z","dependencies_parsed_at":"2023-03-21T10:17:39.919Z","dependency_job_id":null,"html_url":"https://github.com/andrewda/node-securelogin","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewda%2Fnode-securelogin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewda%2Fnode-securelogin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewda%2Fnode-securelogin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewda%2Fnode-securelogin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewda","download_url":"https://codeload.github.com/andrewda/node-securelogin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252879457,"owners_count":21818799,"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":["auth","authentication","securelogin"],"created_at":"2024-10-03T16:57:13.658Z","updated_at":"2025-05-07T12:42:04.973Z","avatar_url":"https://github.com/andrewda.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node SecureLogin\n\n[![Travis][travis-img]][travis-url]\n[![Coveralls][coveralls-img]][coveralls-url]\n[![Release][release-img]][release-url]\n[![Downloads][downloads-img]][downloads-url]\n[![License][license-img]][license-url]\n\nA tiny module used to verify SecureLogin tokens.\n\nFor a more complete and high-level module, try using\n[passport-securelogin](https://github.com/andrewda/passport-securelogin).\n\n## Installation\n\n```bash\nnpm install securelogin --save\n```\n\n## Usage\n\n```javascript\nconst SecureLogin = require('securelogin');\n\nconst sltoken = 'https%3A%2F%2Fmy.app%252Chttps%3A%2F%2Fmy.app%2Fsecurelogin%252C%252C1496586322%2C2YNnncbnq7won%2B13AzJJqeBRREA9CTjYq%2FDwuGQAGy8LaQGnuH6OE10oLxV4kgJJhflnqdu0qY8bBC08v969Cg%3D%3D%252C%2Fbf0P0dBdDcQlak07UZpR4YnzPc2qw40jCSz1NAuw%2Bs%3D%2Ckdbjcc08YBKWdCY56lQJIi92wcGOW%2BKcMvbSgHN6WbU%3D%252C1uP20QU%2BWYvFf1KAxn3Re0ZYd2pm5vLdQhgkXTCjl44%3D%2Chomakov%40gmail.com';\n\nSecureLogin.verify(decodeURIComponent(sltoken), {\n    origins: 'https://my.app/',\n    ignoreExpiration: true\n});\n\n/**\n * { email: 'homakov@gmail.com',\n *   message:\n *    { _raw: 'https://my.app,https://my.app/securelogin,,1496586322',\n *      provider: 'https://my.app',\n *      client: 'https://my.app/securelogin',\n *      scope: { _raw: '' },\n *      expiration: '1496586322' },\n *   signatures:\n *    { signature: '2YNnncbnq7won+13AzJJqeBRREA9CTjYq/DwuGQAGy8LaQGnuH6OE10oLxV4kgJJhflnqdu0qY8bBC08v969Cg==',\n *      hmac: '/bf0P0dBdDcQlak07UZpR4YnzPc2qw40jCSz1NAuw+s=' },\n *   authkeys:\n *    { public: 'kdbjcc08YBKWdCY56lQJIi92wcGOW+KcMvbSgHN6WbU=',\n *      secret: '1uP20QU+WYvFf1KAxn3Re0ZYd2pm5vLdQhgkXTCjl44=' } }\n */\n```\n\n## API Reference\n\n### parse(sltoken)\n\n- `sltoken` - A SecureLogin token\n\nParses a SecureLogin token and returns an object with the token's contents.\n\nExample return data:\n\n```javascript\n{\n    email: 'example@email.com',\n    message: {\n        _raw: 'http://localhost:3001,http://localhost:3001,,4651339663',\n        provider: 'http://localhost:3001',\n        client: 'http://localhost:3001',\n        scope: { _raw: '' },\n        expiration: '4651339663'\n    },\n    signatures: {\n        signature: 'gjs+D1dTCf8FFHWmQizu7Nlt9uVm4jRhEG3J96gzktGKj5IkQcOb+qkJyTEBt9LY99pqqNrtKwxXNrlRyvocAA==',\n        hmac: 'UNKOGVd/odZL071ic8sGijtAuBF6Jc262nSAI4O+El4='\n    },\n    authkeys: {\n        public: 'FPS/onjSa0ojlSzp9zXEiot5MgZcMwXR0sAIdgJMxaE=',\n        secret: 'bruQ61utUBPay5QJ6Rity4S6AW+sma4NTt+7udhMveM='\n    }\n}\n```\n\n### verify(sltoken[, options])\n\n- `sltoken` - A SecureLogin token\n- `options` - (optional) An object containing zero or more options\n    - `origins` - A string or array of strings containing acceptable\n    client/provider domain(s)\n    - `ignoreProvider` - Ignore provider domain name\n    - `ignoreClient` - Ignore client domain name\n    - `ignoreExpiration` - Ignore the token expiration date\n\nVerifies a SecureLogin token and, if successful, returns the parsed object (see\n[`parse` method](#parsesltoken) above). If unsuccessful, returns an object\nwith the `errors` property, an array of errors that occurred while parsing the\ntoken.\n\n\u003c!-- Badges --\u003e\n\n[travis-img]: https://img.shields.io/travis/andrewda/node-securelogin.svg?style=flat-square\n[travis-url]: https://travis-ci.org/andrewda/node-securelogin\n[coveralls-img]: https://img.shields.io/coveralls/andrewda/node-securelogin.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/github/andrewda/node-securelogin\n[release-img]: https://img.shields.io/npm/v/securelogin.svg?style=flat-square\n[release-url]: https://www.npmjs.com/package/securelogin\n[downloads-img]: https://img.shields.io/npm/dm/securelogin.svg?style=flat-square\n[downloads-url]: https://www.npmjs.com/package/securelogin\n[license-img]: https://img.shields.io/npm/l/securelogin.svg?style=flat-square\n[license-url]: https://github.com/andrewda/node-securelogin/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewda%2Fnode-securelogin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewda%2Fnode-securelogin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewda%2Fnode-securelogin/lists"}