syntax = "proto3";

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

import "core/proto/core.proto";
import "google/protobuf/empty.proto";

service RegistrationAuthority {
  rpc NewRegistration(core.Registration) returns (core.Registration) {}
  rpc UpdateRegistration(UpdateRegistrationRequest) returns (core.Registration) {}
  rpc PerformValidation(PerformValidationRequest) returns (core.Authorization) {}
  rpc RevokeCertificateWithReg(RevokeCertificateWithRegRequest) returns (google.protobuf.Empty) {}
  rpc DeactivateRegistration(core.Registration) returns (google.protobuf.Empty) {}
  rpc DeactivateAuthorization(core.Authorization) returns (google.protobuf.Empty) {}
  rpc RevokeCertByApplicant(RevokeCertByApplicantRequest) returns (google.protobuf.Empty) {}
  rpc RevokeCertByKey(RevokeCertByKeyRequest) returns (google.protobuf.Empty) {}
  rpc AdministrativelyRevokeCertificate(AdministrativelyRevokeCertificateRequest) returns (google.protobuf.Empty) {}
  rpc NewOrder(NewOrderRequest) returns (core.Order) {}
  rpc FinalizeOrder(FinalizeOrderRequest) returns (core.Order) {}
}

message UpdateRegistrationRequest {
  core.Registration base = 1;
  core.Registration update = 2;
}

message UpdateAuthorizationRequest {
  core.Authorization authz = 1;
  int64 challengeIndex = 2;
  core.Challenge response = 3;
}

message PerformValidationRequest {
  core.Authorization authz = 1;
  int64 challengeIndex = 2;
}

message RevokeCertificateWithRegRequest {
  bytes cert = 1;
  int64 code = 2;
  int64 regID = 3;
}

message RevokeCertByApplicantRequest {
  bytes cert = 1;
  int64 code = 2;
  int64 regID = 3;
}

message RevokeCertByKeyRequest {
  bytes cert = 1;
  int64 code = 2;
}

message AdministrativelyRevokeCertificateRequest {
  bytes cert = 1;
  string serial = 4;
  int64 code = 2;
  string adminName = 3;
  bool skipBlockKey = 5;
}

message NewOrderRequest {
  int64 registrationID = 1;
  repeated string names = 2;
}

message FinalizeOrderRequest {
  core.Order order = 1;
  bytes csr = 2;
}
