// This file is @generated by prost-build.
/// A Challenge from the server used to guarantee freshness of attestations
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Challenge {
    /// Output only. The resource name for this Challenge in the format
    /// `projects/*/locations/*/challenges/*`
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    /// Output only. The time at which this Challenge was created
    #[prost(message, optional, tag = "2")]
    pub create_time: ::core::option::Option<::prost_types::Timestamp>,
    /// Output only. The time at which this Challenge will no longer be usable. It
    /// is also the expiration time for any tokens generated from this Challenge.
    #[prost(message, optional, tag = "3")]
    pub expire_time: ::core::option::Option<::prost_types::Timestamp>,
    /// Output only. Indicates if this challenge has been used to generate a token.
    #[prost(bool, tag = "4")]
    pub used: bool,
    /// Output only. Identical to nonce, but as a string.
    #[prost(string, tag = "6")]
    pub tpm_nonce: ::prost::alloc::string::String,
}
/// Message for creating a Challenge
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CreateChallengeRequest {
    /// Required. The resource name of the location where the Challenge will be
    /// used, in the format `projects/*/locations/*`.
    #[prost(string, tag = "1")]
    pub parent: ::prost::alloc::string::String,
    /// Required. The Challenge to be created. Currently this field can be empty as
    /// all the Challenge fields are set by the server.
    #[prost(message, optional, tag = "2")]
    pub challenge: ::core::option::Option<Challenge>,
}
/// A request for an OIDC token, providing all the necessary information needed
/// for this service to verify the platform state of the requestor.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VerifyAttestationRequest {
    /// Required. The name of the Challenge whose nonce was used to generate the
    /// attestation, in the format `projects/*/locations/*/challenges/*`. The
    /// provided Challenge will be consumed, and cannot be used again.
    #[prost(string, tag = "1")]
    pub challenge: ::prost::alloc::string::String,
    /// Optional. Credentials used to populate the "emails" claim in the
    /// claims_token.
    #[prost(message, optional, tag = "2")]
    pub gcp_credentials: ::core::option::Option<GcpCredentials>,
    /// Required. The TPM-specific data provided by the attesting platform, used to
    /// populate any of the claims regarding platform state.
    #[prost(message, optional, tag = "3")]
    pub tpm_attestation: ::core::option::Option<TpmAttestation>,
    /// Optional. Optional information related to the Confidential Space TEE.
    #[prost(message, optional, tag = "4")]
    pub confidential_space_info: ::core::option::Option<ConfidentialSpaceInfo>,
    /// Optional. A collection of optional, workload-specified claims that modify
    /// the token output.
    #[prost(message, optional, tag = "5")]
    pub token_options: ::core::option::Option<TokenOptions>,
    /// Optional. An optional indicator of the attester, only applies to certain
    /// products.
    #[prost(string, tag = "8")]
    pub attester: ::prost::alloc::string::String,
    /// An optional tee attestation report, used to populate hardware rooted
    /// claims.
    #[prost(oneof = "verify_attestation_request::TeeAttestation", tags = "6, 7")]
    pub tee_attestation: ::core::option::Option<
        verify_attestation_request::TeeAttestation,
    >,
}
/// Nested message and enum types in `VerifyAttestationRequest`.
pub mod verify_attestation_request {
    /// An optional tee attestation report, used to populate hardware rooted
    /// claims.
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum TeeAttestation {
        /// Optional. A TDX with CCEL and RTMR Attestation Quote.
        #[prost(message, tag = "6")]
        TdCcel(super::TdxCcelAttestation),
        /// Optional. An SEV-SNP Attestation Report.
        #[prost(message, tag = "7")]
        SevSnpAttestation(super::SevSnpAttestation),
    }
}
/// A TDX Attestation quote.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TdxCcelAttestation {
    /// Optional. The Confidential Computing Event Log (CCEL) ACPI table. Formatted
    /// as described in the ACPI Specification 6.5.
    #[prost(bytes = "vec", tag = "1")]
    pub ccel_acpi_table: ::prost::alloc::vec::Vec<u8>,
    /// Optional. The CCEL event log. Formatted as described in the UEFI 2.10.
    #[prost(bytes = "vec", tag = "2")]
    pub ccel_data: ::prost::alloc::vec::Vec<u8>,
    /// Optional. An Event Log containing additional events measured into the RTMR
    /// that are not already present in the CCEL.
    #[prost(bytes = "vec", tag = "3")]
    pub canonical_event_log: ::prost::alloc::vec::Vec<u8>,
    /// Optional. The TDX attestation quote from the guest. It contains the RTMR
    /// values.
    #[prost(bytes = "vec", tag = "4")]
    pub td_quote: ::prost::alloc::vec::Vec<u8>,
}
/// An SEV-SNP Attestation Report.
/// Contains the attestation report and the certificate bundle that the client
/// collects.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SevSnpAttestation {
    /// Optional. The SEV-SNP Attestation Report
    /// Format is in revision 1.55, §7.3 Attestation, Table 22. ATTESTATION_REPORT
    /// Structure in this document:
    /// <https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/56860.pdf>
    #[prost(bytes = "vec", tag = "1")]
    pub report: ::prost::alloc::vec::Vec<u8>,
    /// Optional. Certificate bundle defined in the GHCB protocol definition
    /// Format is documented in GHCB revision 2.03, section 4.1.8.1 struct
    /// cert_table in this document:
    /// <https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/56421.pdf>
    #[prost(bytes = "vec", tag = "2")]
    pub aux_blob: ::prost::alloc::vec::Vec<u8>,
}
/// A response once an attestation has been successfully verified, containing a
/// signed OIDC token.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct VerifyAttestationResponse {
    /// Output only. Same as claims_token, but as a string.
    #[prost(string, tag = "2")]
    pub oidc_claims_token: ::prost::alloc::string::String,
    /// Output only. A list of messages that carry the partial error details
    /// related to VerifyAttestation.
    #[prost(message, repeated, tag = "3")]
    pub partial_errors: ::prost::alloc::vec::Vec<super::super::super::rpc::Status>,
}
/// Credentials issued by GCP which are linked to the platform attestation. These
/// will be verified server-side as part of attestaion verification.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GcpCredentials {
    /// Same as id_tokens, but as a string.
    #[prost(string, repeated, tag = "2")]
    pub service_account_id_tokens: ::prost::alloc::vec::Vec<
        ::prost::alloc::string::String,
    >,
}
/// Options to modify claims in the token to generate custom-purpose tokens.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TokenOptions {
    /// Optional. Optional string to issue the token with a custom audience claim.
    /// Required if one or more nonces are specified.
    #[prost(string, tag = "1")]
    pub audience: ::prost::alloc::string::String,
    /// Optional. Optional parameter to place one or more nonces in the eat_nonce
    /// claim in the output token. The minimum size for JSON-encoded EATs is 10
    /// bytes and the maximum size is 74 bytes.
    #[prost(string, repeated, tag = "2")]
    pub nonce: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    /// Optional. Optional token type to select what type of token to return.
    #[prost(enumeration = "TokenType", tag = "3")]
    pub token_type: i32,
    /// An optional additional configuration per token type.
    #[prost(oneof = "token_options::TokenTypeOptions", tags = "4")]
    pub token_type_options: ::core::option::Option<token_options::TokenTypeOptions>,
}
/// Nested message and enum types in `TokenOptions`.
pub mod token_options {
    /// Token options that only apply to the AWS Principal Tags token type.
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
    pub struct AwsPrincipalTagsOptions {
        /// Optional. Principal tags to allow in the token.
        #[prost(message, optional, tag = "1")]
        pub allowed_principal_tags: ::core::option::Option<
            aws_principal_tags_options::AllowedPrincipalTags,
        >,
    }
    /// Nested message and enum types in `AwsPrincipalTagsOptions`.
    pub mod aws_principal_tags_options {
        /// Allowed principal tags is used to define what principal tags will be
        /// placed in the token.
        #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
        pub struct AllowedPrincipalTags {
            /// Optional. Container image signatures allowed in the token.
            #[prost(message, optional, tag = "1")]
            pub container_image_signatures: ::core::option::Option<
                allowed_principal_tags::ContainerImageSignatures,
            >,
        }
        /// Nested message and enum types in `AllowedPrincipalTags`.
        pub mod allowed_principal_tags {
            /// Allowed Container Image Signatures. Key IDs are required to allow this
            /// claim to fit within the narrow AWS IAM restrictions.
            #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
            pub struct ContainerImageSignatures {
                /// Optional. List of key ids to filter into the Principal tags. Only
                /// keys that have been validated and added to the token will be filtered
                /// into principal tags. Unrecognized key ids will be ignored.
                #[prost(string, repeated, tag = "1")]
                pub key_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
            }
        }
    }
    /// An optional additional configuration per token type.
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum TokenTypeOptions {
        /// Optional. Options for the Limited AWS token type.
        #[prost(message, tag = "4")]
        AwsPrincipalTagsOptions(AwsPrincipalTagsOptions),
    }
}
/// TPM2 data containing everything necessary to validate any platform state
/// measured into the TPM.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TpmAttestation {
    /// TPM2 PCR Quotes generated by calling TPM2_Quote on each PCR bank.
    #[prost(message, repeated, tag = "1")]
    pub quotes: ::prost::alloc::vec::Vec<tpm_attestation::Quote>,
    /// The binary TCG Event Log containing events measured into the TPM by the
    /// platform firmware and operating system. Formatted as described in the
    /// "TCG PC Client Platform Firmware Profile Specification".
    #[prost(bytes = "vec", tag = "2")]
    pub tcg_event_log: ::prost::alloc::vec::Vec<u8>,
    /// An Event Log containing additional events measured into the TPM that are
    /// not already present in the tcg_event_log. Formatted as described in the
    /// "Canonical Event Log Format" TCG Specification.
    #[prost(bytes = "vec", tag = "3")]
    pub canonical_event_log: ::prost::alloc::vec::Vec<u8>,
    /// DER-encoded X.509 certificate of the Attestation Key (otherwise known as
    /// an AK or a TPM restricted signing key) used to generate the quotes.
    #[prost(bytes = "vec", tag = "4")]
    pub ak_cert: ::prost::alloc::vec::Vec<u8>,
    /// List of DER-encoded X.509 certificates which, together with the ak_cert,
    /// chain back to a trusted Root Certificate.
    #[prost(bytes = "vec", repeated, tag = "5")]
    pub cert_chain: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
}
/// Nested message and enum types in `TpmAttestation`.
pub mod tpm_attestation {
    /// Information about Platform Control Registers (PCRs) including a signature
    /// over their values, which can be used for remote validation.
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct Quote {
        /// The hash algorithm of the PCR bank being quoted, encoded as a TPM_ALG_ID
        #[prost(int32, tag = "1")]
        pub hash_algo: i32,
        /// Raw binary values of each PCRs being quoted.
        #[prost(map = "int32, bytes", tag = "2")]
        pub pcr_values: ::std::collections::HashMap<i32, ::prost::alloc::vec::Vec<u8>>,
        /// TPM2 quote, encoded as a TPMS_ATTEST
        #[prost(bytes = "vec", tag = "3")]
        pub raw_quote: ::prost::alloc::vec::Vec<u8>,
        /// TPM2 signature, encoded as a TPMT_SIGNATURE
        #[prost(bytes = "vec", tag = "4")]
        pub raw_signature: ::prost::alloc::vec::Vec<u8>,
    }
}
/// ConfidentialSpaceInfo contains information related to the Confidential Space
/// TEE.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConfidentialSpaceInfo {
    /// Optional. A list of signed entities containing container image signatures
    /// that can be used for server-side signature verification.
    #[prost(message, repeated, tag = "1")]
    pub signed_entities: ::prost::alloc::vec::Vec<SignedEntity>,
}
/// SignedEntity represents an OCI image object containing everything necessary
/// to verify container image signatures.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SignedEntity {
    /// Optional. A list of container image signatures attached to an OCI image
    /// object.
    #[prost(message, repeated, tag = "1")]
    pub container_image_signatures: ::prost::alloc::vec::Vec<ContainerImageSignature>,
}
/// ContainerImageSignature holds necessary metadata to verify a container image
/// signature.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ContainerImageSignature {
    /// Optional. The binary signature payload following the SimpleSigning format
    /// <https://github.com/sigstore/cosign/blob/main/specs/SIGNATURE_SPEC.md#simple-signing.>
    /// This payload includes the container image digest.
    #[prost(bytes = "vec", tag = "1")]
    pub payload: ::prost::alloc::vec::Vec<u8>,
    /// Optional. A signature over the payload.
    /// The container image digest is incorporated into the signature as follows:
    ///
    /// 1. Generate a SimpleSigning format payload that includes the container
    ///    image digest.
    /// 1. Generate a signature over SHA256 digest of the payload.
    ///    The signature generation process can be represented as follows:
    ///    `Sign(sha256(SimpleSigningPayload(sha256(Image Manifest))))`
    #[prost(bytes = "vec", tag = "2")]
    pub signature: ::prost::alloc::vec::Vec<u8>,
    /// Optional. Reserved for future use.
    #[prost(bytes = "vec", tag = "3")]
    pub public_key: ::prost::alloc::vec::Vec<u8>,
    /// Optional. Reserved for future use.
    #[prost(enumeration = "SigningAlgorithm", tag = "4")]
    pub sig_alg: i32,
}
/// SigningAlgorithm enumerates all the supported signing algorithms.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum SigningAlgorithm {
    /// Unspecified signing algorithm.
    Unspecified = 0,
    /// RSASSA-PSS with a SHA256 digest.
    RsassaPssSha256 = 1,
    /// RSASSA-PKCS1 v1.5 with a SHA256 digest.
    RsassaPkcs1v15Sha256 = 2,
    /// ECDSA on the P-256 Curve with a SHA256 digest.
    EcdsaP256Sha256 = 3,
}
impl SigningAlgorithm {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "SIGNING_ALGORITHM_UNSPECIFIED",
            Self::RsassaPssSha256 => "RSASSA_PSS_SHA256",
            Self::RsassaPkcs1v15Sha256 => "RSASSA_PKCS1V15_SHA256",
            Self::EcdsaP256Sha256 => "ECDSA_P256_SHA256",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "SIGNING_ALGORITHM_UNSPECIFIED" => Some(Self::Unspecified),
            "RSASSA_PSS_SHA256" => Some(Self::RsassaPssSha256),
            "RSASSA_PKCS1V15_SHA256" => Some(Self::RsassaPkcs1v15Sha256),
            "ECDSA_P256_SHA256" => Some(Self::EcdsaP256Sha256),
            _ => None,
        }
    }
}
/// Token type enum contains the different types of token responses Confidential
/// Space supports
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TokenType {
    /// Unspecified token type
    Unspecified = 0,
    /// OpenID Connect (OIDC) token type
    Oidc = 1,
    /// Public Key Infrastructure (PKI) token type
    Pki = 2,
    /// Limited claim token type for AWS integration
    LimitedAws = 3,
    /// Principal-tag-based token for AWS integration
    AwsPrincipaltags = 4,
}
impl TokenType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "TOKEN_TYPE_UNSPECIFIED",
            Self::Oidc => "TOKEN_TYPE_OIDC",
            Self::Pki => "TOKEN_TYPE_PKI",
            Self::LimitedAws => "TOKEN_TYPE_LIMITED_AWS",
            Self::AwsPrincipaltags => "TOKEN_TYPE_AWS_PRINCIPALTAGS",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "TOKEN_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "TOKEN_TYPE_OIDC" => Some(Self::Oidc),
            "TOKEN_TYPE_PKI" => Some(Self::Pki),
            "TOKEN_TYPE_LIMITED_AWS" => Some(Self::LimitedAws),
            "TOKEN_TYPE_AWS_PRINCIPALTAGS" => Some(Self::AwsPrincipaltags),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod confidential_computing_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// Service describing handlers for resources
    #[derive(Debug, Clone)]
    pub struct ConfidentialComputingClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl ConfidentialComputingClient<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> ConfidentialComputingClient<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,
        ) -> ConfidentialComputingClient<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,
        {
            ConfidentialComputingClient::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
        }
        /// Creates a new Challenge in a given project and location.
        pub async fn create_challenge(
            &mut self,
            request: impl tonic::IntoRequest<super::CreateChallengeRequest>,
        ) -> std::result::Result<tonic::Response<super::Challenge>, 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(
                "/google.cloud.confidentialcomputing.v1.ConfidentialComputing/CreateChallenge",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.confidentialcomputing.v1.ConfidentialComputing",
                        "CreateChallenge",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Verifies the provided attestation info, returning a signed OIDC token.
        pub async fn verify_attestation(
            &mut self,
            request: impl tonic::IntoRequest<super::VerifyAttestationRequest>,
        ) -> std::result::Result<
            tonic::Response<super::VerifyAttestationResponse>,
            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(
                "/google.cloud.confidentialcomputing.v1.ConfidentialComputing/VerifyAttestation",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "google.cloud.confidentialcomputing.v1.ConfidentialComputing",
                        "VerifyAttestation",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}
