{"id":15063670,"url":"https://github.com/elixir-webrtc/ex_dtls","last_synced_at":"2025-08-20T22:30:45.730Z","repository":{"id":39996040,"uuid":"295432032","full_name":"elixir-webrtc/ex_dtls","owner":"elixir-webrtc","description":"DTLS and DTLS-SRTP library for Elixir, based on OpenSSL","archived":false,"fork":false,"pushed_at":"2024-09-20T17:25:08.000Z","size":132,"stargazers_count":13,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-07T23:05:02.558Z","etag":null,"topics":["dtls","dtls-srtp","elixir","openssl","webrtc"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elixir-webrtc.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":"2020-09-14T13:55:06.000Z","updated_at":"2024-09-20T17:25:09.000Z","dependencies_parsed_at":"2023-11-16T19:51:37.600Z","dependency_job_id":"3651b2e9-c8ba-42c2-bc0c-fec8cee007be","html_url":"https://github.com/elixir-webrtc/ex_dtls","commit_stats":{"total_commits":96,"total_committers":8,"mean_commits":12.0,"dds":"0.42708333333333337","last_synced_commit":"5edcbc6c870e7e93de7a8eb18767d749dd28d2b7"},"previous_names":["elixir-webrtc/ex_dtls","membraneframework/ex_dtls"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-webrtc%2Fex_dtls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-webrtc%2Fex_dtls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-webrtc%2Fex_dtls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-webrtc%2Fex_dtls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elixir-webrtc","download_url":"https://codeload.github.com/elixir-webrtc/ex_dtls/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230219745,"owners_count":18192177,"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":["dtls","dtls-srtp","elixir","openssl","webrtc"],"created_at":"2024-09-25T00:05:52.284Z","updated_at":"2025-08-20T22:30:45.700Z","avatar_url":"https://github.com/elixir-webrtc.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ExDTLS\n\n[![Hex.pm](https://img.shields.io/hexpm/v/ex_dtls.svg)](https://hex.pm/packages/ex_dtls)\n[![API Docs](https://img.shields.io/badge/api-docs-yellow.svg?style=flat)](https://hexdocs.pm/ex_dtls/)\n[![CI](https://img.shields.io/github/actions/workflow/status/elixir-webrtc/ex_dtls/ci.yml?logo=github\u0026label=CI)](https://github.com/elixir-webrtc/ex_dtls/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/elixir-webrtc/ex_dtls/graph/badge.svg?token=E98NHC8B00)](https://codecov.io/gh/elixir-webrtc/ex_dtls)\n\nDTLS and DTLS-SRTP library for Elixir, based on [OpenSSL].\n\n`ExDTLS` allows a user to perform DTLS handshake (including DTLS-SRTP one)\nwithout requiring any socket.\nInstead, it generates DTLS packets that a user has to transport to the peer.\nThanks to this DTLS handshake can be performed on the third-party socket e.g. one used to\nestablish a connection via ICE protocol.\n\nStarting from v0.16.0, `ExDTLS` can also be used to send arbitrary data using DTLS datagrams, see `ExDTLS.write_data/2`.\n\n## Installation\n\nThe package can be installed by adding `ex_dtls` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:ex_dtls, \"~\u003e 0.18.0\"}\n  ]\nend\n```\n\nPlease note that `ex_dtls` uses OpenSSL under the hood.\nWe use `pkg-config` to search for include and lib files so you must make sure\nthat `openssl.pc` file is searchable by `pkg-config`.\nIf it is not in the default `pkg-config` search path, locate your `openssl.pc`\nand add its parent directory to the `PKG_CONFIG_PATH`.\nFor example:\n\n```sh\nexport PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/homebrew/Cellar/openssl@3/3.1.0/lib/pkgconfig\n```\n\nIf OpenSSL was installed using `brew`, you can use the following syntax\nto make sure that the path will still be correct after OpenSSL update:\n\n```sh\nexport PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(brew --prefix openssl@3)/lib/pkgconfig\n```\n\n## Usage\n\n`ExDTLS` uses OpenSSL under the hood.\nMake sure you have it installed on your OS.\n\nInit `ExDTLS` on both peers with:\n\n```elixir\n# One peer should be a client (use `mode: :client`) and the other\n# one a server (use `mode: :server`).\n# DTLS-SRTP is the most common use case for ExDTLS, we'll enable it.\ndtls = ExDTLS.init(mode: :client, dtls_srtp: true)\n```\n\nOn a peer running in a client mode start performing DTLS handshake\n\n```elixir\n{packets, timeout} = ExDTLS.do_handshake(dtls)\n```\n\nYou will obtain initial handshake packets and a `timeout`.\n`packets` has to be passed to the second peer (using your own socket UDP).\n`timeout` is a time after which `ExDTLS.handle_timeout/1` should be called.\n\nAfter receiving initial DTLS packets on the second peer pass them to `ExDTLS`:\n\n```elixir\n{:handshake_packets, packets, timeout} = ExDTLS.handle_data(dtls, packets)\n```\n\nAs a result, we will also get some new packets that have to be passed to the first peer.\n\nAfter some back and forth DTLS handshake should be finished successfully.\nThe peer that finishes the handshake first will return `{:handshake_finished, local_keying_material, remote_keying_material, protection_profile, packets}` tuple.\nThese packets have to be sent to the second peer, so it can finish its handshake too and\nreturn `{:handshake_finished, local_keying_material, remote_keying_material, protection_profile}` tuple.\n\nFor more complete examples please refer to [ex_webrtc] where we use `ex_dtls`\nor to our integration tests.\n\n## Debugging\n\nAdd `compiler_flags: [\"-DEXDTLS_DEBUG\"],` in `bundlex.exs` to\nget debug logs from the native code.\n\n## Copyright and License\n\nCopyright 2020, [Software Mansion](https://swmansion.com/?utm_source=git\u0026utm_medium=readme\u0026utm_campaign=ex_dtls)\n\n[![Software Mansion](https://logo.swmansion.com/logo?color=white\u0026variant=desktop\u0026width=200\u0026tag=membrane-github)](https://swmansion.com/?utm_source=git\u0026utm_medium=readme\u0026utm_campaign=ex_dtls)\n\nLicensed under the [Apache License, Version 2.0](LICENSE)\n\n[OpenSSL]: https://www.openssl.org/\n[ex_webrtc]: https://github.com/elixir-webrtc/ex_webrtc\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-webrtc%2Fex_dtls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felixir-webrtc%2Fex_dtls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-webrtc%2Fex_dtls/lists"}