syntax = "proto3";

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

import "core/proto/core.proto";

service RegistrationAuthority {
  rpc NewRegistration(core.Registration) returns (core.Registration) {}
  rpc NewAuthorization(NewAuthorizationRequest) returns (core.Authorization) {}
  rpc NewCertificate(NewCertificateRequest) returns (core.Certificate) {}
  rpc UpdateRegistration(UpdateRegistrationRequest) returns (core.Registration) {}
  rpc PerformValidation(PerformValidationRequest) returns (core.Authorization) {}
  rpc RevokeCertificateWithReg(RevokeCertificateWithRegRequest) returns (core.Empty) {}
  rpc DeactivateRegistration(core.Registration) returns (core.Empty) {}
  rpc DeactivateAuthorization(core.Authorization) returns (core.Empty) {}
  rpc AdministrativelyRevokeCertificate(AdministrativelyRevokeCertificateRequest) returns (core.Empty) {}
  rpc NewOrder(NewOrderRequest) returns (core.Order) {}
  rpc FinalizeOrder(FinalizeOrderRequest) returns (core.Order) {}
}

message NewAuthorizationRequest {
  core.Authorization authz = 1;
  int64 regID = 2;
}

message NewCertificateRequest {
  bytes csr = 1;
  int64 regID = 2;
  int64 issuerNameID = 3;
}

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 AdministrativelyRevokeCertificateRequest {
  bytes cert = 1;
  int64 code = 2;
  string adminName = 3;
}

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

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