// Copyright 2026 Bloomberg Finance L.P
//
// 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 build.buildbox;

import "google/protobuf/timestamp.proto";
import "google/protobuf/struct.proto";

// Request sent to credential helper (serialized to JSON on stdin)
message GetCredentialsRequest {
  // The full URI for the gRPC service being accessed
  // Example: "grpcs://example.com/build.bazel.remote.execution.v2.Execution/Execute"
  string uri = 1;
}

// Response from credential helper (parsed from JSON on stdout)
message GetCredentialsResponse {
  // Map of header names to arrays of header values
  // Example: {"headers": {"Authorization": ["Bearer token"]}}
  // Each header name must map to an array of string values
  google.protobuf.Struct headers = 1;

  // Optional expiration timestamp (RFC 3339 format when serialized to JSON)
  // Example: "2026-02-25T12:00:00Z"
  // If present, credentials should not be used after this time
  google.protobuf.Timestamp expires = 2;
}
