{"id":24120845,"url":"https://github.com/diodechain/diode_client_ex","last_synced_at":"2025-09-18T09:31:56.047Z","repository":{"id":42478314,"uuid":"456473237","full_name":"diodechain/diode_client_ex","owner":"diodechain","description":"Elixir SDK for the diode network","archived":false,"fork":false,"pushed_at":"2025-08-19T13:35:15.000Z","size":294,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-19T15:33:25.611Z","etag":null,"topics":["elixir","end-to-end-encryption","peer-to-peer"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/diode_client","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diodechain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2022-02-07T11:15:31.000Z","updated_at":"2025-08-19T13:35:18.000Z","dependencies_parsed_at":"2023-10-04T16:04:01.999Z","dependency_job_id":"6b4cbfd5-7959-4038-9ad4-805d61c3a912","html_url":"https://github.com/diodechain/diode_client_ex","commit_stats":{"total_commits":62,"total_committers":2,"mean_commits":31.0,"dds":"0.032258064516129004","last_synced_commit":"a3e9c57b84c5e03787839e6e182064ec7014900c"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/diodechain/diode_client_ex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diodechain%2Fdiode_client_ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diodechain%2Fdiode_client_ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diodechain%2Fdiode_client_ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diodechain%2Fdiode_client_ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diodechain","download_url":"https://codeload.github.com/diodechain/diode_client_ex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diodechain%2Fdiode_client_ex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275743428,"owners_count":25520459,"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","status":"online","status_checked_at":"2025-09-18T02:00:09.552Z","response_time":77,"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":["elixir","end-to-end-encryption","peer-to-peer"],"created_at":"2025-01-11T10:26:11.724Z","updated_at":"2025-09-18T09:31:55.511Z","avatar_url":"https://github.com/diodechain.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DiodeClient\n\nDiodeClient secure end-to-end encrypted connections between any two machines. Connections are established\neither through direct peer-to-peer TCP connections or bridged via the Diode network. To learn more about the\ndecentralized Diode network visit https://diode.io/\n\nExample usage with a simple server + client. For this to work open each in individual terminal:\n\n\n```elixir\n# Server\nDiodeClient.interface_add(\"example_server_interface\")\naddress = DiodeClient.Base16.encode(DiodeClient.address())\n\n{:ok, port} = DiodeClient.port_listen(5000)\nspawn_link(fn -\u003e\n  IO.puts(\"server #{address} started\")\n  {:ok, ssl} = DiodeClient.port_accept(port)\n  peer = DiodeClient.Port.peer(ssl)\n  IO.puts(\"got a connection from #{Base.encode16(peer)}\")\n  :ssl.controlling_process(ssl, self())\n  :ssl.setopts(ssl, [packet: :line, active: true])\n  for x \u003c- 1..10 do\n    IO.puts(\"sending message #{x}\")\n    :ssl.send(ssl, \"Hello #{Base.encode16(peer)} this is message #{x}\\n\")\n  end\n  receive do\n    {:ssl_closed, _ssl} -\u003e IO.puts(\"closed!\")\n  end\nend)\n\n```\n\nAnd the client. Here insert in the server address the address that has been printed above.\nFor example `server_address = \"0x389eba94b330140579cdce1feb1a6e905ff876e6\"`\n\n```elixir\n  # Client: Below enter your server address\n  server_address = \"0x389eba94b330140579cdce1feb1a6e905ff876e6\"\n  DiodeClient.interface_add(\"example_client_interface\")\n\n  spawn_link(fn -\u003e\n    {:ok, ssl} = DiodeClient.port_connect(server_address, 5000)\n    :ssl.controlling_process(ssl, self())\n    :ssl.setopts(ssl, [packet: :line, active: true])\n    Enum.reduce_while(1..10, nil, fn _, _ -\u003e\n      receive do\n        {:ssl, _ssl, msg} -\u003e {:cont, IO.inspect(msg)}\n        other -\u003e {:halt, IO.inspect(other)}\n      end\n    end)\n    :ssl.close(ssl)\n    IO.puts(\"closed!\")\n  end)\n```\n\nAnd the client. Here insert in the server address the address that has been printed above.\nFor example `server_address = \"0x389eba94b330140579cdce1feb1a6e905ff876e6\"`\n\n```elixir\n  # Client:\n  server_address = \"0x389eba94b330140579cdce1feb1a6e905ff876e6\"\n  DiodeClient.interface_add(\"example_client_interface\")\n\n  spawn_link(fn -\u003e\n    {:ok, ssl} = DiodeClient.port_connect(server_address, 5000)\n    :ssl.controlling_process(ssl, self())\n    :ssl.setopts(ssl, [packet: :line, active: true])\n    Enum.reduce_while(1..10, nil, fn _, _ -\u003e\n      receive do\n        {:ssl, _ssl, msg} -\u003e {:cont, IO.inspect(msg)}\n        other -\u003e {:halt, IO.inspect(other)}\n      end\n    end)\n    :ssl.close(ssl)\n    IO.puts(\"closed!\")\n  end)\n```\n\n## Encryption and Authentication\n\nFor encryption standard TLS as builtin into Erlang from OpenSSL is used. For authentication though the Ethereum signature scheme using the elliptic curve `secp256k1` is used. The generated public addresses of the form `0x389eba94b330140579cdce1feb1a6e905ff876e6` actually represent hashes of public keys. When opening a port using `DiodeClient.port_open(\"0x389eba94b330140579cdce1feb1a6e905ff876e6\", 5000)` this first locates the correct peer and then uses cryptographic handshakes to ensure the peer is in fact in possession of the corresponding private key.\n\nTo this regard the `DiodeClient` will by default store private keys in local files. In the example above `example_client_interface` and `example_server_interface`. These represent both the address as well as the private key needed to authenticate as such.\n\n## Todos\n\n* Add actual support for multiple interfaces in a single session\n* Add standard contract call interfaces e.g. for BNS to be able to resolve human readable names such as `somename.diode`\n\n## Installation\n\nThe package can be installed by adding `diode_client` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:diode_client, \"~\u003e 1.1\"}\n  ]\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiodechain%2Fdiode_client_ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiodechain%2Fdiode_client_ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiodechain%2Fdiode_client_ex/lists"}