/*
 * Copyright 2023 Signal Messenger, LLC
 * SPDX-License-Identifier: AGPL-3.0-only
 */

syntax = "proto3";

option java_multiple_files = true;

package org.signal.chat.calling;

/**
 * Provides methods for getting credentials for one-on-one and group calls.
 */
service Calling {

  /**
   * Generates and returns TURN credentials for the caller.
   *
   * This RPC may fail with a `RESOURCE_EXHAUSTED` status if a rate limit for
   * generating TURN credentials has been exceeded, in which case a
   * `retry-after` header containing an ISO 8601 duration string will be present
   * in the response trailers.
   */
  rpc GetTurnCredentials(GetTurnCredentialsRequest) returns (GetTurnCredentialsResponse) {}
}

message GetTurnCredentialsRequest {}

message GetTurnCredentialsResponse {
  /**
   * A username that can be presented to authenticate with a TURN server.
   */
  string username = 1;

  /**
   * A password that can be presented to authenticate with a TURN server.
   */
  string password = 2;

  /**
   * A list of TURN (or TURNS or STUN) servers where the provided credentials
   * may be used.
   */
  repeated string urls = 3;
}
