syntax = "proto3";

package va;
option go_package = "github.com/letsencrypt/boulder/va/proto";

import "core/proto/core.proto";

service VA {
  rpc DoDCV(PerformValidationRequest) returns (ValidationResult) {}
}

service CAA {
  rpc DoCAA(IsCAAValidRequest) returns (IsCAAValidResponse) {}
}

message IsCAAValidRequest {
  // TODO: Accept an identifier instead of a domain (purely for consistency,
  // because only DNS identifiers support CAA checks).
  //
  // NOTE: Domain may be a name with a wildcard prefix (e.g. `*.example.com`)
  string domain = 1;
  string validationMethod = 2;
  int64 accountURIID = 3;
  string authzID = 4;
}

// If CAA is valid for the requested domain, the problem will be empty
message IsCAAValidResponse {
  core.ProblemDetails problem = 1;
  string perspective = 3;
  string rir = 4;
}

message PerformValidationRequest {
  // Next unused field number: 6
  // TODO(#8023): dnsNames are being deprecated in favour of identifiers.
  string dnsName = 1;
  core.Identifier identifier = 5;
  core.Challenge challenge = 2;
  AuthzMeta authz = 3;
  string expectedKeyAuthorization = 4;
}

message AuthzMeta {
  string id = 1;
  int64 regID = 2;
}

message ValidationResult {
  repeated core.ValidationRecord records = 1;
  core.ProblemDetails problem = 2;
  string perspective = 3;
  string rir = 4;
}
