{"id":19174605,"url":"https://github.com/equalitie/ouinet-inject","last_synced_at":"2026-06-13T01:33:08.353Z","repository":{"id":85416631,"uuid":"174005511","full_name":"equalitie/ouinet-inject","owner":"equalitie","description":"This is a read-only mirror of: https://gitlab.com/equalitie/ouinet-inject/ \"Sign content to be published using Ouinet\"","archived":false,"fork":false,"pushed_at":"2021-07-01T16:13:56.000Z","size":123,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-02-23T00:44:02.516Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/equalitie.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":"2019-03-05T19:11:50.000Z","updated_at":"2023-03-15T23:40:22.000Z","dependencies_parsed_at":"2023-03-03T08:46:41.535Z","dependency_job_id":null,"html_url":"https://github.com/equalitie/ouinet-inject","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/equalitie/ouinet-inject","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equalitie%2Fouinet-inject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equalitie%2Fouinet-inject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equalitie%2Fouinet-inject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equalitie%2Fouinet-inject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/equalitie","download_url":"https://codeload.github.com/equalitie/ouinet-inject/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/equalitie%2Fouinet-inject/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34269363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-09T10:18:29.372Z","updated_at":"2026-06-13T01:33:08.325Z","avatar_url":"https://github.com/equalitie.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ouinet offline injector\n\nThis script allows someone owning the necessary private keys to perform\noffline injection (signing) of content for later insertion into\n[Ouinet](https://github.com/equalitie/ouinet).\n\n## Keys\n\nTwo injection mechanisms are supported:\n\n  - BitTorrent BEP44 keys for creating Ouinet URI descriptors that support\n    sharing resources over IPFS (obsolete).\n\n  - Ed25519 keys for creating a [Ouinet static cache][] repository with\n    signatures of HTTP response heads and bodies' data blocks, ready for\n    streaming to other users.\n\n[Ouinet static cache]: https://github.com/equalitie/ouinet/blob/master/doc/ouinet-network-whitepaper.md#out-of-band-cache-entry-exchange\n\nIf you are running a Ouinet injector, you may use the ``ed25519-private-key``\nfile present in its repository directory.  If you have PyNaCl installed (see\n[Setup](#setup) below), you can also generate a test key with:\n\n    $ python3 -c 'import nacl.signing as S; print(S.SigningKey.generate().encode().hex())' \u003e sig.key\n\n## Input\n\nThree kinds of input are supported:\n\n  - HTTP GET responses stored as head and body in an ad hoc file-based format\n    (obsolete).\n\n    See the doc string of `ouinet.inject.inject_dir()` for a description of\n    this format.\n\n  - A WARC file coming from web crawling.\n\n    See \u003chttps://en.wikipedia.org/wiki/Web_ARChive\u003e for more information on\n    the WARC file format and tools to produce it.\n\n  - An arbitrary hierarchy of content files and directories plus a base URL,\n    so that ``ROOT/path/to/file.txt`` with ``https://example.com/base/``\n    becomes ``https://example.com/base/path/to/file.txt``.\n\n## Output\n\nThe script produces a set of insertion and (depending on the kind of input)\ncontent data files which are added to a given output directory.  That\ndirectory can then be circulated and used on a different machine running a\nOuinet client (configured to trust the public keys matching the private keys\nused for injection) and used there as if the content was retrieved over the\nOuinet network (e.g. for local access or seeding to others).\n\nOnly a single injection per URI is supported.  The creation of resource groups\ncan be customized to a certain point by using the ``--group`` option.  Please\nnote that certain grouping methods can result in a considerable number of\nresource groups to be announced by the receiving client.  More sensible\ngrouping mechanisms will be added in the future.\n\nPlease look for ``readme.txt`` files under the output directory for a\ndescription of its format.\n\n## Setup\n\nInstallation of the package is not yet supported, but you can install its\nPython dependencies with:\n\n    $ pip install -r requirements.txt\n\nOf course, you can also do this in a virtual environment.\n\nFor injection using BEP44 keys (obsolete), you will also need to have the\n``ipfs`` binary on your search path and an initialized IPFS repo (i.e. run\n``ipfs init``).  Please note that the binary will only be used for some hash\ncomputations and that neither a running IPFS daemon nor a connection to the\nInternet are needed, and no changes to your IPFS repo will happen.\n\n## Usage\n\nTo inject the content in ``INPUT.warc.gz`` and put injection data in\n``OUTPUT_DIR``, run:\n\n    $ python3 -m ouinet.inject \\\n      --httpsig-private-key=/path/to/httpsig.key \\\n      INPUT.warc.gz OUTPUT_DIR\n\nWhere ``/path/to/httpsig.key`` should contain the hex-encoded *private*\nsignature key.  Please keep that key secret and safe!  The matching *public*\nkey will be printed as part of the program's diagnostics.\n\nTo inject a hierarchy of files and directories, you also need to specify a\nbase URL to synthesize full HTTP responses to be injected:\n\n    $ python3 -m ouinet.inject \\\n      --httpsig-private-key=/path/to/httpsig.key \\\n      --content-base-uri=https://example.com/pub/files/ \\\n      INPUT_DIR OUTPUT_DIR\n\nSo that ``INPUT_DIR/images/index.html`` becomes accessible via the URL\n``https://example.com/pub/files/images/index.html``.  Please note that in this\ncase it is safe to use the input directory as the output directory, as\ninsertion data will just sit along the data files and point to them to avoid\nduplication.  Like that, you only need to distribute the resulting\n``INPUT_DIR`` (instead of both the ``INPUT_DIR`` and the ``OUTPUT_DIR``).\n\nPlease note that running the script on an output directory with existing\ninsertion data or content will add the new injections to it without\noverwriting or deleting existing files.  This is equivalent to indicating\n``--overwrite=never``.  You can also use ``--overwrite=always`` (overwrites\nall existing insertion data, never content files), or ``--overwrite=older``\n(overwrites insertion data older than content in the input directory).\n\nYou can use the ``--content-type`` option to control how ``Content-Type`` and\n``Content-Encoding`` headers are assigned to synthesized HTTP responses.  By\ndefault, MIME types are inferred from the file name (customizable via files in\n`mimetypes.knownfiles`), but you can also use a common type for all files, or\nno type at all.\n\nThe ``--group`` option allows you to control how Ouinet clients will announce\ncontents from a static cache to the network, i.e. how URLs will be put\ntogether into cohesive resource groups.  By default, no groups are computed\n(thus making the cache only useful for local access), and a few strategies are\nalready provided; however, since this is a very application-dependent issue,\nyou may specify ``--group=cmd`` and point the ``OUINET_GROUP_CMD`` environment\nvariable to a program that receives a URL as an argument and outputs the\nassociated group.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fequalitie%2Fouinet-inject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fequalitie%2Fouinet-inject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fequalitie%2Fouinet-inject/lists"}