Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/p4irin/turn_ephemeral_credentials
Generate time limited, i.e. ephemeral, long term credentials to authenticate against and use a TURN server
https://github.com/p4irin/turn_ephemeral_credentials
ice stun turn turn-servers
Last synced: 1 day ago
JSON representation
Generate time limited, i.e. ephemeral, long term credentials to authenticate against and use a TURN server
- Host: GitHub
- URL: https://github.com/p4irin/turn_ephemeral_credentials
- Owner: p4irin
- License: mit
- Created: 2023-09-05T00:54:16.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-10-08T19:47:03.000Z (about 1 year ago)
- Last Synced: 2024-10-11T10:52:52.514Z (25 days ago)
- Topics: ice, stun, turn, turn-servers
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TURN Ephemeral Credentials - v1.0.1
Generate time limited, i.e. ephemeral, long term credentials to authenticate against a TURN server. The _default_ duration for the validity of the credentials is set to _one day_ as recommended in [A REST API For Access To TURN Services](https://datatracker.ietf.org/doc/html/draft-uberti-behave-turn-rest-00#section-2.1:~:text=ttl%3A%20the%20duration%20for%20which%20the%20username%20and%20password%20are%20valid%2C%0A%20%20%20%20%20%20in%20seconds.%20%20A%20value%20of%20one%20day%20(86400%20seconds)%20is%20recommended). The same document describes how to generate the _username_ and _password_ [here](https://datatracker.ietf.org/doc/html/draft-uberti-behave-turn-rest-00#section-2.1:~:text=username%3A%20the%20TURN,algorithm%0A%20%20%20%20%20%20and%20secret.).
## Stack
- Python 3.8.10 on Ubuntu 20.04.2 LTS
## Installation
### From PyPI
```bash
(venv) $ pip install turn-ephemeral-credentials
```### From GitHub
```bash
(venv) $ pip install git+https://github.com/p4irin/turn_ephemeral_credentials.git
```## Usage
```python
from turn_ephemeral_credentials import generate# Generate a username and use the default ttl of one day
credentials = generate(shared_secret='A shared secret with a TURN server')# Pass a username and use the default ttl
credentials = generate(username='username', shared_secret='A shared secret with a TURN server')# Generate a username and use a ttl of half a day
credentials = generate(shared_secret='A shared secret with a TURN server', ttl=43200)turn_username=credentials['turn_username']
turn_password=credentials['turn_password']
```## Reference
- [A REST API For Access To TURN Services](https://datatracker.ietf.org/doc/html/draft-uberti-behave-turn-rest-00#section-2.1)
- [RFC 5766. Traversal Using Relays around NAT (TURN):Relay Extensions to Session Traversal Utilities for NAT (STUN)](https://datatracker.ietf.org/doc/html/rfc5766)
- [RFC 5389, Session Traversal Utilities for NAT (STUN)](https://datatracker.ietf.org/doc/html/rfc5389#section-10.2)