// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.security.safebrowsingohttpgateway.v1;

import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/httpbody.proto";

option go_package = "google.golang.org/genproto/googleapis/security/safebrowsingohttpgateway/v1;safebrowsingohttpgateway";
option java_multiple_files = true;
option java_outer_classname = "SbOhttpGatewayProto";
option java_package = "com.google.security.safebrowsingohttpgateway.v1";

// Gateway endpoints serving OHTTP traffic for Safe Browsing.
service SafeBrowsingOhttpGateway {
  option (google.api.default_host) = "safebrowsingohttpgateway.googleapis.com";

  // Processes OHTTP request and returns OHTTP response, only supported for
  // `Safe Browsing API v5` at the moment. This is a HTTP POST method, with
  // `OHTTP request` added to `HTTP request body` and returns `OHTTP response`
  // returned in `HTTP response body`.
  rpc HandleOhttpEncapsulatedRequest(google.api.HttpBody)
      returns (google.api.HttpBody) {
    option (google.api.http) = {
      post: "/v1/ohttp:handleOhttpEncapsulatedRequest"
      body: "*"
    };
    option (google.api.method_signature) = "";
  }

  // Returns OHTTP public key formatted as per OHTTP key Configuration encoding.
  // Used by clients with GET request to fetch public key for OHTTP. This is a
  // HTTP GET method, with empty `HTTP request body` and OHTTP key returned in
  // `HTTP response body`.
  // https://www.ietf.org/archive/id/draft-ietf-ohai-ohttp-05.html#name-key-configuration-encoding
  rpc GetHpkeKeyConfig(google.api.HttpBody) returns (google.api.HttpBody) {
    option (google.api.http) = {
      get: "/v1/ohttp/hpkekeyconfig"
    };
    option (google.api.method_signature) = "";
  }
}
