{"id":15451784,"url":"https://github.com/willscott/onionservice","last_synced_at":"2025-05-07T11:14:57.513Z","repository":{"id":57314767,"uuid":"49374868","full_name":"willscott/onionservice","owner":"willscott","description":"like http.createServer(), but for onions.","archived":false,"fork":false,"pushed_at":"2016-01-18T00:01:59.000Z","size":8,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-21T19:50:16.544Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/willscott.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2016-01-10T16:25:59.000Z","updated_at":"2023-04-12T07:31:54.000Z","dependencies_parsed_at":"2022-09-18T20:50:56.294Z","dependency_job_id":null,"html_url":"https://github.com/willscott/onionservice","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willscott%2Fonionservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willscott%2Fonionservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willscott%2Fonionservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willscott%2Fonionservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willscott","download_url":"https://codeload.github.com/willscott/onionservice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252709552,"owners_count":21791985,"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-10-01T21:39:14.561Z","updated_at":"2025-05-07T11:14:57.485Z","avatar_url":"https://github.com/willscott.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Onion Service\n=============\n\nBinds and listens for connections on a tor Onion Service. Meant to behave\nidentically to an `http.Server`.\n\n```javascript\nvar onion = require('onionservice');\n\nvar server = onion.createServer(function (request, response) {\n  response.end('Hello, Onion!');\n}).listen(80);\n```\n\n# Safety\n\nNode.js is not known to be a particularly hardened code base, and it is\ninadvisable to use this code base in security-critical situations.\nIt is also worth understanding the NPM package dependencies in a code base and\nthe risks you take on by relying on a code base with varied lineage. That being\nsaid, onionservice does not expose you to particularly more risk than running a\npublic Node web server. Just remember that connections from tor will be\nconnected from the local binary - don't use `remoteAddress` for permissions!\n\nOnionService can still be an effective tool! In addition\nto hidden web services, Onion Services provide NAT avoidance capabilities and\nthe ability to easily construct P2P overlays. In these circumstances, use a\nrandom high port for listening to limit risk of crawling, and don't publish\naddresses publicly.\n\n## `createServer([options], [handler])`\n\nThe key material used for construction of the onion service will be directory-\nlocal, and will remain stable across runs. It can be configured with additional\nkeys in the `options` object, which has the following defaults:\n\n```javascript\n{\n  cacheKeyMaterial: true,\n  keyMaterial: path.join(process.cwd(), \".onionservice\")\n}\n```\n\nIf `cacheKeyMaterial` is `false`, a new onion address will be generated each\ntime the application is run.\n\nIf `keyMaterial` is a string, it will be interpreted as a file path, and used\nto read and write key material. If it is a (duplex) stream, key material will be\nread from the stream, and updated material will be written back.\n\n## `server.address()`\nReturns the bound onion address, the family name, and the port of the server.\nUseful for learning the generated onion. Returns an object with three\nproperties, e.g.\n`{ port: 80, family: 'Onion', address: '3g2upl4pq6kufc4m.onion'}`\n\nExample:\n```javascript\nvar server = onion.createServer((req, resp) =\u003e {\n  resp.end('Onion\\n');\n});\n\n// Listen on a random port.\nserver.listen(() =\u003e {\n  address = server.address();\n  console.log('Opened server on %j', address);\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillscott%2Fonionservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillscott%2Fonionservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillscott%2Fonionservice/lists"}