server/lib/src/generated/holger.doors.v1.rs
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AllowFirstImportRequest {
/// The bundle's vendor (its `supplier`).
#[prost(string, tag = "1")]
pub vendor: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub product: ::prost::alloc::string::String,
/// The sequence that establishes the floor.
#[prost(uint64, tag = "3")]
pub sequence: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AllowFirstImportReply {
#[prost(string, tag = "1")]
pub vendor: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub product: ::prost::alloc::string::String,
#[prost(uint64, tag = "3")]
pub sequence: u64,
/// Who authorized it.
#[prost(string, tag = "4")]
pub by: ::prost::alloc::string::String,
/// Unix seconds.
#[prost(int64, tag = "5")]
pub at: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExportBundleRequest {
#[prost(string, tag = "1")]
pub bundle_id: ::prost::alloc::string::String,
/// Monotonic per (supplier, product): the secure side's anti-rollback floor.
#[prost(uint64, tag = "2")]
pub sequence: u64,
#[prost(string, tag = "3")]
pub supplier: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub product: ::prost::alloc::string::String,
#[prost(string, tag = "5")]
pub release_version: ::prost::alloc::string::String,
/// 0 is the default of 30 days.
#[prost(uint32, tag = "6")]
pub expires_days: u32,
/// Only these artifacts (file name, name or `name@version`). Empty: every AVAILABLE
/// artifact in production.
#[prost(string, repeated, tag = "7")]
pub artifacts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExportBundleChunk {
/// The member these bytes belong to (relative to the candidate directory).
#[prost(string, tag = "1")]
pub path: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "2")]
pub data: ::prost::alloc::vec::Vec<u8>,
/// Set on the last chunk only.
#[prost(message, optional, tag = "3")]
pub summary: ::core::option::Option<ExportBundleSummary>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExportBundleSummary {
#[prost(string, tag = "1")]
pub bundle_id: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub sequence: u64,
/// Computed from the stored evidence, never typed in.
#[prost(string, tag = "3")]
pub verdict: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub candidate_sha256: ::prost::alloc::string::String,
/// One line per exported artifact, as `holger export` prints it.
#[prost(string, repeated, tag = "5")]
pub artifacts: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(uint32, tag = "6")]
pub members: u32,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FirstKeyRequest {
/// The name the first admin is enrolled under. Empty: theirs to choose at enrolment.
#[prost(string, tag = "1")]
pub display: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FirstKeyReply {
/// The invite secret: shown ONCE, never stored (only its hash is).
#[prost(string, tag = "1")]
pub invite: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub id: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub expires: i64,
/// The groups the redeemed key holds.
#[prost(string, repeated, tag = "4")]
pub groups: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// Where to redeem it, relative to the console's origin (`/login?invite=<secret>`).
#[prost(string, tag = "5")]
pub path: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub words: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DownstreamInviteRequest {
/// The enrolled downstream's name.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// A direct invite's door (`http(s)://host:port`). Empty: the server's own sync door.
#[prost(string, tag = "2")]
pub door: ::prost::alloc::string::String,
/// A WireGuard invite's front key and endpoint. Empty: the front's own, as it offered them.
#[prost(string, tag = "3")]
pub hub_key: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub endpoint: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DownstreamInviteReply {
/// The signed invite (JSON): the file the downstream's RON names in `sync.upstreams\[\].invite`.
#[prost(bytes = "vec", tag = "1")]
pub invite: ::prost::alloc::vec::Vec<u8>,
#[prost(string, tag = "2")]
pub schema: ::prost::alloc::string::String,
/// The door the downstream reaches this server at.
#[prost(string, tag = "3")]
pub door: ::prost::alloc::string::String,
/// A WireGuard downstream's address on the front's interface; empty for a direct one.
#[prost(string, tag = "4")]
pub address: ::prost::alloc::string::String,
/// This server's sync name and key: what the downstream's RON trusts.
#[prost(string, tag = "5")]
pub upstream: ::prost::alloc::string::String,
#[prost(string, tag = "6")]
pub key: ::prost::alloc::string::String,
}
/// Generated client implementations.
pub mod bundle_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct BundleServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl BundleServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> BundleServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> BundleServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
BundleServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// The candidate's members, in order: each member's bytes in one or more chunks that
/// name its path; the LAST chunk carries the summary and no data.
pub async fn export(
&mut self,
request: impl tonic::IntoRequest<super::ExportBundleRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::ExportBundleChunk>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/holger.doors.v1.BundleService/Export",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("holger.doors.v1.BundleService", "Export"));
self.inner.server_streaming(req, path, codec).await
}
/// The admin's authorization of a FIRST import (lanes HOL-CDS, HOL-NCSC): this vendor,
/// product and sequence may set the anti-rollback floor once. Admin only, audited, used
/// once; the same act as `holger bundle allow-first-import` and
/// `POST /-/bundle/first-import`.
pub async fn allow_first_import(
&mut self,
request: impl tonic::IntoRequest<super::AllowFirstImportRequest>,
) -> std::result::Result<
tonic::Response<super::AllowFirstImportReply>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/holger.doors.v1.BundleService/AllowFirstImport",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("holger.doors.v1.BundleService", "AllowFirstImport"),
);
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod bundle_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with BundleServiceServer.
#[async_trait]
pub trait BundleService: std::marker::Send + std::marker::Sync + 'static {
/// Server streaming response type for the Export method.
type ExportStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::ExportBundleChunk, tonic::Status>,
>
+ std::marker::Send
+ 'static;
/// The candidate's members, in order: each member's bytes in one or more chunks that
/// name its path; the LAST chunk carries the summary and no data.
async fn export(
&self,
request: tonic::Request<super::ExportBundleRequest>,
) -> std::result::Result<tonic::Response<Self::ExportStream>, tonic::Status>;
/// The admin's authorization of a FIRST import (lanes HOL-CDS, HOL-NCSC): this vendor,
/// product and sequence may set the anti-rollback floor once. Admin only, audited, used
/// once; the same act as `holger bundle allow-first-import` and
/// `POST /-/bundle/first-import`.
async fn allow_first_import(
&self,
request: tonic::Request<super::AllowFirstImportRequest>,
) -> std::result::Result<
tonic::Response<super::AllowFirstImportReply>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct BundleServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> BundleServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for BundleServiceServer<T>
where
T: BundleService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/holger.doors.v1.BundleService/Export" => {
#[allow(non_camel_case_types)]
struct ExportSvc<T: BundleService>(pub Arc<T>);
impl<
T: BundleService,
> tonic::server::ServerStreamingService<super::ExportBundleRequest>
for ExportSvc<T> {
type Response = super::ExportBundleChunk;
type ResponseStream = T::ExportStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ExportBundleRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BundleService>::export(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ExportSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/holger.doors.v1.BundleService/AllowFirstImport" => {
#[allow(non_camel_case_types)]
struct AllowFirstImportSvc<T: BundleService>(pub Arc<T>);
impl<
T: BundleService,
> tonic::server::UnaryService<super::AllowFirstImportRequest>
for AllowFirstImportSvc<T> {
type Response = super::AllowFirstImportReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AllowFirstImportRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as BundleService>::allow_first_import(&inner, request)
.await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = AllowFirstImportSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for BundleServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "holger.doors.v1.BundleService";
impl<T> tonic::server::NamedService for BundleServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
/// Generated client implementations.
pub mod first_key_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct FirstKeyServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl FirstKeyServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> FirstKeyServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> FirstKeyServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
FirstKeyServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// A single-use invite that enrols the first admin key. Refused once an admin key exists.
pub async fn invite(
&mut self,
request: impl tonic::IntoRequest<super::FirstKeyRequest>,
) -> std::result::Result<tonic::Response<super::FirstKeyReply>, tonic::Status> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/holger.doors.v1.FirstKeyService/Invite",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("holger.doors.v1.FirstKeyService", "Invite"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod first_key_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with FirstKeyServiceServer.
#[async_trait]
pub trait FirstKeyService: std::marker::Send + std::marker::Sync + 'static {
/// A single-use invite that enrols the first admin key. Refused once an admin key exists.
async fn invite(
&self,
request: tonic::Request<super::FirstKeyRequest>,
) -> std::result::Result<tonic::Response<super::FirstKeyReply>, tonic::Status>;
}
#[derive(Debug)]
pub struct FirstKeyServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> FirstKeyServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for FirstKeyServiceServer<T>
where
T: FirstKeyService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/holger.doors.v1.FirstKeyService/Invite" => {
#[allow(non_camel_case_types)]
struct InviteSvc<T: FirstKeyService>(pub Arc<T>);
impl<
T: FirstKeyService,
> tonic::server::UnaryService<super::FirstKeyRequest>
for InviteSvc<T> {
type Response = super::FirstKeyReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::FirstKeyRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as FirstKeyService>::invite(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = InviteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for FirstKeyServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "holger.doors.v1.FirstKeyService";
impl<T> tonic::server::NamedService for FirstKeyServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
/// Generated client implementations.
pub mod downstream_service_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
/// `DownstreamService.Invite` (lane HOL-PRODUCTS-7, 2026-10-30): the signed invite a
/// downstream of this server is handed (`holger-cli downstream invite`, the console's
/// Invite button). A `via: Front` downstream gets a direct invite (schema v1: the server's
/// sync door, no tunnel); a `via: Wireguard` one gets the estate's (schema v2, the link's
/// pre-shared key inside the signed bytes, the front's interface). Signed with the server's
/// sync key, for the downstream's key; admin only, audited.
#[derive(Debug, Clone)]
pub struct DownstreamServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl DownstreamServiceClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> DownstreamServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> DownstreamServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
DownstreamServiceClient::new(InterceptedService::new(inner, interceptor))
}
/// Compress requests with the given encoding.
///
/// This requires the server to support it otherwise it might respond with an
/// error.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
/// Enable decompressing responses.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn invite(
&mut self,
request: impl tonic::IntoRequest<super::DownstreamInviteRequest>,
) -> std::result::Result<
tonic::Response<super::DownstreamInviteReply>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic_prost::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/holger.doors.v1.DownstreamService/Invite",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("holger.doors.v1.DownstreamService", "Invite"));
self.inner.unary(req, path, codec).await
}
}
}
/// Generated server implementations.
pub mod downstream_service_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with DownstreamServiceServer.
#[async_trait]
pub trait DownstreamService: std::marker::Send + std::marker::Sync + 'static {
async fn invite(
&self,
request: tonic::Request<super::DownstreamInviteRequest>,
) -> std::result::Result<
tonic::Response<super::DownstreamInviteReply>,
tonic::Status,
>;
}
/// `DownstreamService.Invite` (lane HOL-PRODUCTS-7, 2026-10-30): the signed invite a
/// downstream of this server is handed (`holger-cli downstream invite`, the console's
/// Invite button). A `via: Front` downstream gets a direct invite (schema v1: the server's
/// sync door, no tunnel); a `via: Wireguard` one gets the estate's (schema v2, the link's
/// pre-shared key inside the signed bytes, the front's interface). Signed with the server's
/// sync key, for the downstream's key; admin only, audited.
#[derive(Debug)]
pub struct DownstreamServiceServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> DownstreamServiceServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
Self {
inner,
accept_compression_encodings: Default::default(),
send_compression_encodings: Default::default(),
max_decoding_message_size: None,
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
InterceptedService::new(Self::new(inner), interceptor)
}
/// Enable decompressing requests with the given encoding.
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
/// Compress responses with the given encoding, if the client supports it.
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
/// Limits the maximum size of a decoded message.
///
/// Default: `4MB`
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
/// Limits the maximum size of an encoded message.
///
/// Default: `usize::MAX`
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.max_encoding_message_size = Some(limit);
self
}
}
impl<T, B> tonic::codegen::Service<http::Request<B>> for DownstreamServiceServer<T>
where
T: DownstreamService,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/holger.doors.v1.DownstreamService/Invite" => {
#[allow(non_camel_case_types)]
struct InviteSvc<T: DownstreamService>(pub Arc<T>);
impl<
T: DownstreamService,
> tonic::server::UnaryService<super::DownstreamInviteRequest>
for InviteSvc<T> {
type Response = super::DownstreamInviteReply;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DownstreamInviteRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as DownstreamService>::invite(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = InviteSvc(inner);
let codec = tonic_prost::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
_ => {
Box::pin(async move {
let mut response = http::Response::new(
tonic::body::Body::default(),
);
let headers = response.headers_mut();
headers
.insert(
tonic::Status::GRPC_STATUS,
(tonic::Code::Unimplemented as i32).into(),
);
headers
.insert(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
);
Ok(response)
})
}
}
}
}
impl<T> Clone for DownstreamServiceServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
inner,
accept_compression_encodings: self.accept_compression_encodings,
send_compression_encodings: self.send_compression_encodings,
max_decoding_message_size: self.max_decoding_message_size,
max_encoding_message_size: self.max_encoding_message_size,
}
}
}
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "holger.doors.v1.DownstreamService";
impl<T> tonic::server::NamedService for DownstreamServiceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}