1.0.1 • Published 4 years ago

@rojo2/turn-credentials v1.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

@rojo2/turn-credentials

A library to create TURN credentials RFC.

import turnCredentials from '@rojo2/turn-credentials'

const credentials = turnCredentials('username', {
  secret: process.env.TURN_SECRET
})

How to test it against a running TURN server

Installing it as a global dependency

npm i -g @rojo2/turn-credentials
turn-credentials <userName> <secret>

This small CLI program returns a JSON with two properties username and credential, this can be piped into a program like jq and the finally use it with testing utilities like turnutils_uclient (you can find it in coTURN).

for s in $(turn-credentials <userName> <secret> | jq -r "to_entries|map(\"turn_\(.key|tostring)=\(.value|tostring)\")|.[]" ); do
  export $s
done
turnutils_uclient -t -v -y -X -M -p 443 -u $turn_username -w $turn_credential -W <secret> <TURN server>

Made with :heart: by rojo2