syntax = "proto3";

option go_package = "github.com/kluctl/kluctl/v2/pkg/sourceoverride";

package sourceoverride;

service Proxy {
  rpc ProxyStream(stream ProxyResponse) returns (stream ProxyRequest) {}
  rpc ResolveOverride(ProxyRequest) returns (ResolveOverrideResponse) {}
}

message ProxyResponse {
  AuthMsg auth = 1;
  optional ResolveOverrideResponse response = 2;
}

message ProxyRequest {
  AuthMsg auth = 1;
  optional ResolveOverrideRequest request = 2;
}

message AuthMsg {
  optional bytes pubKey = 1;

  optional bytes challenge = 2;
  optional bytes pop = 3;

  optional string authError = 4;

  optional string pubKeyHash = 5;
  optional bytes controllerSecret = 6;
}

message ResolveOverrideRequest {
  string repoKey = 1;
}

message ResolveOverrideResponse {
  optional string error = 1;
  optional bytes artifact = 2;
}
