we have livekit server in ec2 instance and fronten...
# ask-ai
f
we have livekit server in ec2 instance and frontend, agent services running AWS ecs with livekit api keys in environment variables in task definition, maintain codes in git repo and we created GitHub actions also for code review, build and deploy in ecs based on push event LiveKit API keys cannot be scoped - they grant full admin access to everything Anyone with credentials can join ANY room, dispatch ANY agent, delete rooms, etc. This violates zero-trust security requirements for enterprise applications
t
Thanks for reaching out, karthi. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi there! I wanted to share some helpful info about LiveKit API keys. While the API keys themselves can’t be scoped to limit access directly, you can definitely use Access Tokens with granular permissions to manage access more securely. These tokens are created using your API key and secret, and they let you set specific permissions for participants, like: • Joining particular rooms • Publishing or subscribing to tracks • Allowing recording capabilities For instance, if you’re working with the Node.js SDK, here’s how you might create a token with some restricted permissions:
Copy code
const at = new AccessToken('api-key', 'secret-key', {
  identity: 'user-name',
});

at.addGrant({
  roomJoin: true,
  room: 'my-room',
  canPublish: false,  // Cannot publish
  canSubscribe: true, // Can subscribe
  canPublishData: true,
});

const token = await at.toJwt();
Also, a quick but important tip: make sure to keep your API keys safe by storing them in environment variables and never expose them in client-side code. If you ever suspect a key has been compromised, rotating and revoking them is a great way to stay secure. Using short-lived tokens can also help minimize any risks. If you’d like to dive deeper, here’s a handy Token Creation and Permissions Guide that walks through everything in detail. Sources: LiveKit | LiveKit Security | Mini tutorial: setting up a LiveKit Cloud project | Testing and evaluation | LiveKit Docs | CLI Tools & Token Management | livekit/livekit_composite | DeepWiki
f
as of now unable to restrict agents to agent to join particular room, i have two agents one is default name and another one is sales agent name. While starting call from frontend app, both agents are joining in my room. even i am calling sales agent with agenttype and agentname. unable to restrict that default agent
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!