#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub const MAX_DATA_SIZE: u32 = 65536;
pub const MAX_HARDWARE_DERIVED_KEY_SIZE: u8 = 32;
pub const MAX_HARDWARE_DERIVE_KEY_INFO_SIZE: u8 = 32;
pub const MAX_KEY_NAME_SIZE: u8 = 32;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum AsymmetricKeyAlgorithm {
RsaSsaPssSha2562048 = 1,
RsaSsaPssSha2563072 = 2,
RsaSsaPssSha5124096 = 3,
RsaSsaPkcs1Sha2562048 = 4,
RsaSsaPkcs1Sha2563072 = 5,
RsaSsaPkcs1Sha5124096 = 6,
EcdsaSha256P256 = 7,
EcdsaSha512P384 = 8,
EcdsaSha512P521 = 9,
}
impl AsymmetricKeyAlgorithm {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::RsaSsaPssSha2562048),
2 => Some(Self::RsaSsaPssSha2563072),
3 => Some(Self::RsaSsaPssSha5124096),
4 => Some(Self::RsaSsaPkcs1Sha2562048),
5 => Some(Self::RsaSsaPkcs1Sha2563072),
6 => Some(Self::RsaSsaPkcs1Sha5124096),
7 => Some(Self::EcdsaSha256P256),
8 => Some(Self::EcdsaSha512P384),
9 => Some(Self::EcdsaSha512P521),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Error {
InternalError = 1,
KeyAlreadyExists = 2,
KeyNotFound = 3,
ParseKeyError = 4,
InputTooLarge = 5,
}
impl Error {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InternalError),
2 => Some(Self::KeyAlreadyExists),
3 => Some(Self::KeyNotFound),
4 => Some(Self::ParseKeyError),
5 => Some(Self::InputTooLarge),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum KeyOrigin {
Generated = 1,
Imported = 2,
}
impl KeyOrigin {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Generated),
2 => Some(Self::Imported),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum KeyProvider {
MockProvider = 1,
SoftwareProvider = 2,
SoftwareAsymmetricOnlyProvider = 3,
OpteeProvider = 4,
}
impl KeyProvider {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::MockProvider),
2 => Some(Self::SoftwareProvider),
3 => Some(Self::SoftwareAsymmetricOnlyProvider),
4 => Some(Self::OpteeProvider),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Debug, PartialEq)]
pub struct AsymmetricPrivateKeySignRequest {
pub data: fidl_fuchsia_mem::Buffer,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for AsymmetricPrivateKeySignRequest
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AsymmetricPrivateKeyGetKeyAlgorithmResponse {
pub key_algorithm: AsymmetricKeyAlgorithm,
}
impl fidl::Persistable for AsymmetricPrivateKeyGetKeyAlgorithmResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AsymmetricPrivateKeyGetPublicKeyResponse {
pub public_key: PublicKey,
}
impl fidl::Persistable for AsymmetricPrivateKeyGetPublicKeyResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct AsymmetricPrivateKeySignResponse {
pub signature: Signature,
}
impl fidl::Persistable for AsymmetricPrivateKeySignResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct KeyManagerDeleteKeyRequest {
pub key_name: String,
}
impl fidl::Persistable for KeyManagerDeleteKeyRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct KeyManagerGenerateAsymmetricKeyRequest {
pub key_name: String,
pub key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerGenerateAsymmetricKeyRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest {
pub key_name: String,
pub key_algorithm: AsymmetricKeyAlgorithm,
pub key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct KeyManagerGetAsymmetricPrivateKeyRequest {
pub key_name: String,
pub key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerGetAsymmetricPrivateKeyRequest
{
}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct KeyManagerImportAsymmetricPrivateKeyRequest {
pub data: Vec<u8>,
pub key_name: String,
pub key_algorithm: AsymmetricKeyAlgorithm,
pub key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerImportAsymmetricPrivateKeyRequest
{
}
#[derive(Debug, PartialEq)]
pub struct KeyManagerSealDataRequest {
pub plain_text: fidl_fuchsia_mem::Buffer,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for KeyManagerSealDataRequest {}
#[derive(Debug, PartialEq)]
pub struct KeyManagerUnsealDataRequest {
pub cipher_text: fidl_fuchsia_mem::Buffer,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerUnsealDataRequest
{
}
#[derive(Debug, PartialEq)]
pub struct KeyManagerSealDataResponse {
pub cipher_text: fidl_fuchsia_mem::Buffer,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerSealDataResponse
{
}
#[derive(Debug, PartialEq)]
pub struct KeyManagerUnsealDataResponse {
pub plain_text: fidl_fuchsia_mem::Buffer,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerUnsealDataResponse
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct KeyGetKeyOriginResponse {
pub key_origin: KeyOrigin,
}
impl fidl::Persistable for KeyGetKeyOriginResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct KeyGetKeyProviderResponse {
pub key_provider: KeyProvider,
}
impl fidl::Persistable for KeyGetKeyProviderResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PublicKey {
pub bytes: Vec<u8>,
}
impl fidl::Persistable for PublicKey {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Signature {
pub bytes: Vec<u8>,
}
impl fidl::Persistable for Signature {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StatelessKeyManagerGetHardwareDerivedKeyRequest {
pub key_info: Vec<u8>,
}
impl fidl::Persistable for StatelessKeyManagerGetHardwareDerivedKeyRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StatelessKeyManagerGetHardwareDerivedKeyResponse {
pub derived_key: Vec<u8>,
}
impl fidl::Persistable for StatelessKeyManagerGetHardwareDerivedKeyResponse {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct AsymmetricPrivateKeyMarker;
impl fidl::endpoints::ProtocolMarker for AsymmetricPrivateKeyMarker {
type Proxy = AsymmetricPrivateKeyProxy;
type RequestStream = AsymmetricPrivateKeyRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = AsymmetricPrivateKeySynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) AsymmetricPrivateKey";
}
pub type AsymmetricPrivateKeySignResult = Result<Signature, Error>;
pub type AsymmetricPrivateKeyGetPublicKeyResult = Result<PublicKey, Error>;
pub type AsymmetricPrivateKeyGetKeyAlgorithmResult = Result<AsymmetricKeyAlgorithm, Error>;
pub trait AsymmetricPrivateKeyProxyInterface: Send + Sync {
type GetKeyOriginResponseFut: std::future::Future<Output = Result<KeyGetKeyOriginResult, fidl::Error>>
+ Send;
fn r#get_key_origin(&self) -> Self::GetKeyOriginResponseFut;
type GetKeyProviderResponseFut: std::future::Future<Output = Result<KeyGetKeyProviderResult, fidl::Error>>
+ Send;
fn r#get_key_provider(&self) -> Self::GetKeyProviderResponseFut;
type SignResponseFut: std::future::Future<Output = Result<AsymmetricPrivateKeySignResult, fidl::Error>>
+ Send;
fn r#sign(&self, data: fidl_fuchsia_mem::Buffer) -> Self::SignResponseFut;
type GetPublicKeyResponseFut: std::future::Future<Output = Result<AsymmetricPrivateKeyGetPublicKeyResult, fidl::Error>>
+ Send;
fn r#get_public_key(&self) -> Self::GetPublicKeyResponseFut;
type GetKeyAlgorithmResponseFut: std::future::Future<Output = Result<AsymmetricPrivateKeyGetKeyAlgorithmResult, fidl::Error>>
+ Send;
fn r#get_key_algorithm(&self) -> Self::GetKeyAlgorithmResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct AsymmetricPrivateKeySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for AsymmetricPrivateKeySynchronousProxy {
type Proxy = AsymmetricPrivateKeyProxy;
type Protocol = AsymmetricPrivateKeyMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl AsymmetricPrivateKeySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<AsymmetricPrivateKeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<AsymmetricPrivateKeyEvent, fidl::Error> {
AsymmetricPrivateKeyEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_key_origin(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<KeyGetKeyOriginResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<KeyGetKeyOriginResponse, Error>,
>(
(),
0x3e439554159e7b86,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.key_origin))
}
pub fn r#get_key_provider(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<KeyGetKeyProviderResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<KeyGetKeyProviderResponse, Error>,
>(
(),
0x68e2cd7ec0532e0c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.key_provider))
}
pub fn r#sign(
&self,
mut data: fidl_fuchsia_mem::Buffer,
___deadline: zx::MonotonicInstant,
) -> Result<AsymmetricPrivateKeySignResult, fidl::Error> {
let _response = self.client.send_query::<
AsymmetricPrivateKeySignRequest,
fidl::encoding::ResultType<AsymmetricPrivateKeySignResponse, Error>,
>(
(&mut data,),
0x524ba8b350c2542e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.signature))
}
pub fn r#get_public_key(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<AsymmetricPrivateKeyGetPublicKeyResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
AsymmetricPrivateKeyGetPublicKeyResponse,
Error,
>>(
(),
0x5439aff00ed261f3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.public_key))
}
pub fn r#get_key_algorithm(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<AsymmetricPrivateKeyGetKeyAlgorithmResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
AsymmetricPrivateKeyGetKeyAlgorithmResponse,
Error,
>>(
(),
0xe0ce6b5b815b1ae,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.key_algorithm))
}
}
#[derive(Debug, Clone)]
pub struct AsymmetricPrivateKeyProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for AsymmetricPrivateKeyProxy {
type Protocol = AsymmetricPrivateKeyMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl AsymmetricPrivateKeyProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<AsymmetricPrivateKeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> AsymmetricPrivateKeyEventStream {
AsymmetricPrivateKeyEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_key_origin(
&self,
) -> fidl::client::QueryResponseFut<
KeyGetKeyOriginResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AsymmetricPrivateKeyProxyInterface::r#get_key_origin(self)
}
pub fn r#get_key_provider(
&self,
) -> fidl::client::QueryResponseFut<
KeyGetKeyProviderResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AsymmetricPrivateKeyProxyInterface::r#get_key_provider(self)
}
pub fn r#sign(
&self,
mut data: fidl_fuchsia_mem::Buffer,
) -> fidl::client::QueryResponseFut<
AsymmetricPrivateKeySignResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AsymmetricPrivateKeyProxyInterface::r#sign(self, data)
}
pub fn r#get_public_key(
&self,
) -> fidl::client::QueryResponseFut<
AsymmetricPrivateKeyGetPublicKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AsymmetricPrivateKeyProxyInterface::r#get_public_key(self)
}
pub fn r#get_key_algorithm(
&self,
) -> fidl::client::QueryResponseFut<
AsymmetricPrivateKeyGetKeyAlgorithmResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
AsymmetricPrivateKeyProxyInterface::r#get_key_algorithm(self)
}
}
impl AsymmetricPrivateKeyProxyInterface for AsymmetricPrivateKeyProxy {
type GetKeyOriginResponseFut = fidl::client::QueryResponseFut<
KeyGetKeyOriginResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_key_origin(&self) -> Self::GetKeyOriginResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<KeyGetKeyOriginResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<KeyGetKeyOriginResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3e439554159e7b86,
>(_buf?)?;
Ok(_response.map(|x| x.key_origin))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, KeyGetKeyOriginResult>(
(),
0x3e439554159e7b86,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetKeyProviderResponseFut = fidl::client::QueryResponseFut<
KeyGetKeyProviderResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_key_provider(&self) -> Self::GetKeyProviderResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<KeyGetKeyProviderResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<KeyGetKeyProviderResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x68e2cd7ec0532e0c,
>(_buf?)?;
Ok(_response.map(|x| x.key_provider))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, KeyGetKeyProviderResult>(
(),
0x68e2cd7ec0532e0c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SignResponseFut = fidl::client::QueryResponseFut<
AsymmetricPrivateKeySignResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#sign(&self, mut data: fidl_fuchsia_mem::Buffer) -> Self::SignResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AsymmetricPrivateKeySignResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<AsymmetricPrivateKeySignResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x524ba8b350c2542e,
>(_buf?)?;
Ok(_response.map(|x| x.signature))
}
self.client.send_query_and_decode::<
AsymmetricPrivateKeySignRequest,
AsymmetricPrivateKeySignResult,
>(
(&mut data,),
0x524ba8b350c2542e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetPublicKeyResponseFut = fidl::client::QueryResponseFut<
AsymmetricPrivateKeyGetPublicKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_public_key(&self) -> Self::GetPublicKeyResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AsymmetricPrivateKeyGetPublicKeyResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<AsymmetricPrivateKeyGetPublicKeyResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5439aff00ed261f3,
>(_buf?)?;
Ok(_response.map(|x| x.public_key))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
AsymmetricPrivateKeyGetPublicKeyResult,
>(
(),
0x5439aff00ed261f3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetKeyAlgorithmResponseFut = fidl::client::QueryResponseFut<
AsymmetricPrivateKeyGetKeyAlgorithmResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_key_algorithm(&self) -> Self::GetKeyAlgorithmResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<AsymmetricPrivateKeyGetKeyAlgorithmResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<AsymmetricPrivateKeyGetKeyAlgorithmResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xe0ce6b5b815b1ae,
>(_buf?)?;
Ok(_response.map(|x| x.key_algorithm))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
AsymmetricPrivateKeyGetKeyAlgorithmResult,
>(
(),
0xe0ce6b5b815b1ae,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct AsymmetricPrivateKeyEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for AsymmetricPrivateKeyEventStream {}
impl futures::stream::FusedStream for AsymmetricPrivateKeyEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for AsymmetricPrivateKeyEventStream {
type Item = Result<AsymmetricPrivateKeyEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(AsymmetricPrivateKeyEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum AsymmetricPrivateKeyEvent {}
impl AsymmetricPrivateKeyEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<AsymmetricPrivateKeyEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<AsymmetricPrivateKeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct AsymmetricPrivateKeyRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for AsymmetricPrivateKeyRequestStream {}
impl futures::stream::FusedStream for AsymmetricPrivateKeyRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for AsymmetricPrivateKeyRequestStream {
type Protocol = AsymmetricPrivateKeyMarker;
type ControlHandle = AsymmetricPrivateKeyControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
AsymmetricPrivateKeyControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for AsymmetricPrivateKeyRequestStream {
type Item = Result<AsymmetricPrivateKeyRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled AsymmetricPrivateKeyRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x3e439554159e7b86 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AsymmetricPrivateKeyControlHandle {
inner: this.inner.clone(),
};
Ok(AsymmetricPrivateKeyRequest::GetKeyOrigin {
responder: AsymmetricPrivateKeyGetKeyOriginResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x68e2cd7ec0532e0c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AsymmetricPrivateKeyControlHandle {
inner: this.inner.clone(),
};
Ok(AsymmetricPrivateKeyRequest::GetKeyProvider {
responder: AsymmetricPrivateKeyGetKeyProviderResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x524ba8b350c2542e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(AsymmetricPrivateKeySignRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AsymmetricPrivateKeySignRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AsymmetricPrivateKeyControlHandle {
inner: this.inner.clone(),
};
Ok(AsymmetricPrivateKeyRequest::Sign {data: req.data,
responder: AsymmetricPrivateKeySignResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5439aff00ed261f3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AsymmetricPrivateKeyControlHandle {
inner: this.inner.clone(),
};
Ok(AsymmetricPrivateKeyRequest::GetPublicKey {
responder: AsymmetricPrivateKeyGetPublicKeyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xe0ce6b5b815b1ae => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = AsymmetricPrivateKeyControlHandle {
inner: this.inner.clone(),
};
Ok(AsymmetricPrivateKeyRequest::GetKeyAlgorithm {
responder: AsymmetricPrivateKeyGetKeyAlgorithmResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <AsymmetricPrivateKeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum AsymmetricPrivateKeyRequest {
GetKeyOrigin { responder: AsymmetricPrivateKeyGetKeyOriginResponder },
GetKeyProvider { responder: AsymmetricPrivateKeyGetKeyProviderResponder },
Sign { data: fidl_fuchsia_mem::Buffer, responder: AsymmetricPrivateKeySignResponder },
GetPublicKey { responder: AsymmetricPrivateKeyGetPublicKeyResponder },
GetKeyAlgorithm { responder: AsymmetricPrivateKeyGetKeyAlgorithmResponder },
}
impl AsymmetricPrivateKeyRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_key_origin(self) -> Option<(AsymmetricPrivateKeyGetKeyOriginResponder)> {
if let AsymmetricPrivateKeyRequest::GetKeyOrigin { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_key_provider(self) -> Option<(AsymmetricPrivateKeyGetKeyProviderResponder)> {
if let AsymmetricPrivateKeyRequest::GetKeyProvider { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_sign(
self,
) -> Option<(fidl_fuchsia_mem::Buffer, AsymmetricPrivateKeySignResponder)> {
if let AsymmetricPrivateKeyRequest::Sign { data, responder } = self {
Some((data, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_public_key(self) -> Option<(AsymmetricPrivateKeyGetPublicKeyResponder)> {
if let AsymmetricPrivateKeyRequest::GetPublicKey { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_key_algorithm(self) -> Option<(AsymmetricPrivateKeyGetKeyAlgorithmResponder)> {
if let AsymmetricPrivateKeyRequest::GetKeyAlgorithm { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
AsymmetricPrivateKeyRequest::GetKeyOrigin { .. } => "get_key_origin",
AsymmetricPrivateKeyRequest::GetKeyProvider { .. } => "get_key_provider",
AsymmetricPrivateKeyRequest::Sign { .. } => "sign",
AsymmetricPrivateKeyRequest::GetPublicKey { .. } => "get_public_key",
AsymmetricPrivateKeyRequest::GetKeyAlgorithm { .. } => "get_key_algorithm",
}
}
}
#[derive(Debug, Clone)]
pub struct AsymmetricPrivateKeyControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for AsymmetricPrivateKeyControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl AsymmetricPrivateKeyControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AsymmetricPrivateKeyGetKeyOriginResponder {
control_handle: std::mem::ManuallyDrop<AsymmetricPrivateKeyControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AsymmetricPrivateKeyGetKeyOriginResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AsymmetricPrivateKeyGetKeyOriginResponder {
type ControlHandle = AsymmetricPrivateKeyControlHandle;
fn control_handle(&self) -> &AsymmetricPrivateKeyControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AsymmetricPrivateKeyGetKeyOriginResponder {
pub fn send(self, mut result: Result<KeyOrigin, Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<KeyOrigin, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<KeyOrigin, Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<KeyGetKeyOriginResponse, Error>>(
result.map(|key_origin| (key_origin,)),
self.tx_id,
0x3e439554159e7b86,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AsymmetricPrivateKeyGetKeyProviderResponder {
control_handle: std::mem::ManuallyDrop<AsymmetricPrivateKeyControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AsymmetricPrivateKeyGetKeyProviderResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AsymmetricPrivateKeyGetKeyProviderResponder {
type ControlHandle = AsymmetricPrivateKeyControlHandle;
fn control_handle(&self) -> &AsymmetricPrivateKeyControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AsymmetricPrivateKeyGetKeyProviderResponder {
pub fn send(self, mut result: Result<KeyProvider, Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<KeyProvider, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<KeyProvider, Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<KeyGetKeyProviderResponse, Error>>(
result.map(|key_provider| (key_provider,)),
self.tx_id,
0x68e2cd7ec0532e0c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AsymmetricPrivateKeySignResponder {
control_handle: std::mem::ManuallyDrop<AsymmetricPrivateKeyControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AsymmetricPrivateKeySignResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AsymmetricPrivateKeySignResponder {
type ControlHandle = AsymmetricPrivateKeyControlHandle;
fn control_handle(&self) -> &AsymmetricPrivateKeyControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AsymmetricPrivateKeySignResponder {
pub fn send(self, mut result: Result<&Signature, Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<&Signature, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&Signature, Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<AsymmetricPrivateKeySignResponse, Error>>(
result.map(|signature| (signature,)),
self.tx_id,
0x524ba8b350c2542e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AsymmetricPrivateKeyGetPublicKeyResponder {
control_handle: std::mem::ManuallyDrop<AsymmetricPrivateKeyControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AsymmetricPrivateKeyGetPublicKeyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AsymmetricPrivateKeyGetPublicKeyResponder {
type ControlHandle = AsymmetricPrivateKeyControlHandle;
fn control_handle(&self) -> &AsymmetricPrivateKeyControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AsymmetricPrivateKeyGetPublicKeyResponder {
pub fn send(self, mut result: Result<&PublicKey, Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<&PublicKey, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&PublicKey, Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
AsymmetricPrivateKeyGetPublicKeyResponse,
Error,
>>(
result.map(|public_key| (public_key,)),
self.tx_id,
0x5439aff00ed261f3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct AsymmetricPrivateKeyGetKeyAlgorithmResponder {
control_handle: std::mem::ManuallyDrop<AsymmetricPrivateKeyControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for AsymmetricPrivateKeyGetKeyAlgorithmResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for AsymmetricPrivateKeyGetKeyAlgorithmResponder {
type ControlHandle = AsymmetricPrivateKeyControlHandle;
fn control_handle(&self) -> &AsymmetricPrivateKeyControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl AsymmetricPrivateKeyGetKeyAlgorithmResponder {
pub fn send(
self,
mut result: Result<AsymmetricKeyAlgorithm, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<AsymmetricKeyAlgorithm, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<AsymmetricKeyAlgorithm, Error>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
AsymmetricPrivateKeyGetKeyAlgorithmResponse,
Error,
>>(
result.map(|key_algorithm| (key_algorithm,)),
self.tx_id,
0xe0ce6b5b815b1ae,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct KeyMarker;
impl fidl::endpoints::ProtocolMarker for KeyMarker {
type Proxy = KeyProxy;
type RequestStream = KeyRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = KeySynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) Key";
}
pub type KeyGetKeyOriginResult = Result<KeyOrigin, Error>;
pub type KeyGetKeyProviderResult = Result<KeyProvider, Error>;
pub trait KeyProxyInterface: Send + Sync {
type GetKeyOriginResponseFut: std::future::Future<Output = Result<KeyGetKeyOriginResult, fidl::Error>>
+ Send;
fn r#get_key_origin(&self) -> Self::GetKeyOriginResponseFut;
type GetKeyProviderResponseFut: std::future::Future<Output = Result<KeyGetKeyProviderResult, fidl::Error>>
+ Send;
fn r#get_key_provider(&self) -> Self::GetKeyProviderResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct KeySynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for KeySynchronousProxy {
type Proxy = KeyProxy;
type Protocol = KeyMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl KeySynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <KeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<KeyEvent, fidl::Error> {
KeyEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_key_origin(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<KeyGetKeyOriginResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<KeyGetKeyOriginResponse, Error>,
>(
(),
0x3e439554159e7b86,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.key_origin))
}
pub fn r#get_key_provider(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<KeyGetKeyProviderResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<KeyGetKeyProviderResponse, Error>,
>(
(),
0x68e2cd7ec0532e0c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.key_provider))
}
}
#[derive(Debug, Clone)]
pub struct KeyProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for KeyProxy {
type Protocol = KeyMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl KeyProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <KeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> KeyEventStream {
KeyEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_key_origin(
&self,
) -> fidl::client::QueryResponseFut<
KeyGetKeyOriginResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
KeyProxyInterface::r#get_key_origin(self)
}
pub fn r#get_key_provider(
&self,
) -> fidl::client::QueryResponseFut<
KeyGetKeyProviderResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
KeyProxyInterface::r#get_key_provider(self)
}
}
impl KeyProxyInterface for KeyProxy {
type GetKeyOriginResponseFut = fidl::client::QueryResponseFut<
KeyGetKeyOriginResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_key_origin(&self) -> Self::GetKeyOriginResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<KeyGetKeyOriginResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<KeyGetKeyOriginResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3e439554159e7b86,
>(_buf?)?;
Ok(_response.map(|x| x.key_origin))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, KeyGetKeyOriginResult>(
(),
0x3e439554159e7b86,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetKeyProviderResponseFut = fidl::client::QueryResponseFut<
KeyGetKeyProviderResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_key_provider(&self) -> Self::GetKeyProviderResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<KeyGetKeyProviderResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<KeyGetKeyProviderResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x68e2cd7ec0532e0c,
>(_buf?)?;
Ok(_response.map(|x| x.key_provider))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, KeyGetKeyProviderResult>(
(),
0x68e2cd7ec0532e0c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct KeyEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for KeyEventStream {}
impl futures::stream::FusedStream for KeyEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for KeyEventStream {
type Item = Result<KeyEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(KeyEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum KeyEvent {}
impl KeyEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<KeyEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <KeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct KeyRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for KeyRequestStream {}
impl futures::stream::FusedStream for KeyRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for KeyRequestStream {
type Protocol = KeyMarker;
type ControlHandle = KeyControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
KeyControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for KeyRequestStream {
type Item = Result<KeyRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled KeyRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x3e439554159e7b86 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = KeyControlHandle { inner: this.inner.clone() };
Ok(KeyRequest::GetKeyOrigin {
responder: KeyGetKeyOriginResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x68e2cd7ec0532e0c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = KeyControlHandle { inner: this.inner.clone() };
Ok(KeyRequest::GetKeyProvider {
responder: KeyGetKeyProviderResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <KeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum KeyRequest {
GetKeyOrigin { responder: KeyGetKeyOriginResponder },
GetKeyProvider { responder: KeyGetKeyProviderResponder },
}
impl KeyRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_key_origin(self) -> Option<(KeyGetKeyOriginResponder)> {
if let KeyRequest::GetKeyOrigin { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_key_provider(self) -> Option<(KeyGetKeyProviderResponder)> {
if let KeyRequest::GetKeyProvider { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
KeyRequest::GetKeyOrigin { .. } => "get_key_origin",
KeyRequest::GetKeyProvider { .. } => "get_key_provider",
}
}
}
#[derive(Debug, Clone)]
pub struct KeyControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for KeyControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl KeyControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct KeyGetKeyOriginResponder {
control_handle: std::mem::ManuallyDrop<KeyControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for KeyGetKeyOriginResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for KeyGetKeyOriginResponder {
type ControlHandle = KeyControlHandle;
fn control_handle(&self) -> &KeyControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl KeyGetKeyOriginResponder {
pub fn send(self, mut result: Result<KeyOrigin, Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<KeyOrigin, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<KeyOrigin, Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<KeyGetKeyOriginResponse, Error>>(
result.map(|key_origin| (key_origin,)),
self.tx_id,
0x3e439554159e7b86,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct KeyGetKeyProviderResponder {
control_handle: std::mem::ManuallyDrop<KeyControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for KeyGetKeyProviderResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for KeyGetKeyProviderResponder {
type ControlHandle = KeyControlHandle;
fn control_handle(&self) -> &KeyControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl KeyGetKeyProviderResponder {
pub fn send(self, mut result: Result<KeyProvider, Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<KeyProvider, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<KeyProvider, Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<KeyGetKeyProviderResponse, Error>>(
result.map(|key_provider| (key_provider,)),
self.tx_id,
0x68e2cd7ec0532e0c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct KeyManagerMarker;
impl fidl::endpoints::ProtocolMarker for KeyManagerMarker {
type Proxy = KeyManagerProxy;
type RequestStream = KeyManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = KeyManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.kms.KeyManager";
}
impl fidl::endpoints::DiscoverableProtocolMarker for KeyManagerMarker {}
pub type KeyManagerSealDataResult = Result<fidl_fuchsia_mem::Buffer, Error>;
pub type KeyManagerUnsealDataResult = Result<fidl_fuchsia_mem::Buffer, Error>;
pub type KeyManagerGenerateAsymmetricKeyResult = Result<(), Error>;
pub type KeyManagerGenerateAsymmetricKeyWithAlgorithmResult = Result<(), Error>;
pub type KeyManagerImportAsymmetricPrivateKeyResult = Result<(), Error>;
pub type KeyManagerGetAsymmetricPrivateKeyResult = Result<(), Error>;
pub type KeyManagerDeleteKeyResult = Result<(), Error>;
pub trait KeyManagerProxyInterface: Send + Sync {
type SealDataResponseFut: std::future::Future<Output = Result<KeyManagerSealDataResult, fidl::Error>>
+ Send;
fn r#seal_data(&self, plain_text: fidl_fuchsia_mem::Buffer) -> Self::SealDataResponseFut;
type UnsealDataResponseFut: std::future::Future<Output = Result<KeyManagerUnsealDataResult, fidl::Error>>
+ Send;
fn r#unseal_data(&self, cipher_text: fidl_fuchsia_mem::Buffer) -> Self::UnsealDataResponseFut;
type GenerateAsymmetricKeyResponseFut: std::future::Future<Output = Result<KeyManagerGenerateAsymmetricKeyResult, fidl::Error>>
+ Send;
fn r#generate_asymmetric_key(
&self,
key_name: &str,
key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
) -> Self::GenerateAsymmetricKeyResponseFut;
type GenerateAsymmetricKeyWithAlgorithmResponseFut: std::future::Future<
Output = Result<KeyManagerGenerateAsymmetricKeyWithAlgorithmResult, fidl::Error>,
> + Send;
fn r#generate_asymmetric_key_with_algorithm(
&self,
key_name: &str,
key_algorithm: AsymmetricKeyAlgorithm,
key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
) -> Self::GenerateAsymmetricKeyWithAlgorithmResponseFut;
type ImportAsymmetricPrivateKeyResponseFut: std::future::Future<
Output = Result<KeyManagerImportAsymmetricPrivateKeyResult, fidl::Error>,
> + Send;
fn r#import_asymmetric_private_key(
&self,
data: &[u8],
key_name: &str,
key_algorithm: AsymmetricKeyAlgorithm,
key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
) -> Self::ImportAsymmetricPrivateKeyResponseFut;
type GetAsymmetricPrivateKeyResponseFut: std::future::Future<Output = Result<KeyManagerGetAsymmetricPrivateKeyResult, fidl::Error>>
+ Send;
fn r#get_asymmetric_private_key(
&self,
key_name: &str,
key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
) -> Self::GetAsymmetricPrivateKeyResponseFut;
type DeleteKeyResponseFut: std::future::Future<Output = Result<KeyManagerDeleteKeyResult, fidl::Error>>
+ Send;
fn r#delete_key(&self, key_name: &str) -> Self::DeleteKeyResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct KeyManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for KeyManagerSynchronousProxy {
type Proxy = KeyManagerProxy;
type Protocol = KeyManagerMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl KeyManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <KeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<KeyManagerEvent, fidl::Error> {
KeyManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#seal_data(
&self,
mut plain_text: fidl_fuchsia_mem::Buffer,
___deadline: zx::MonotonicInstant,
) -> Result<KeyManagerSealDataResult, fidl::Error> {
let _response = self.client.send_query::<
KeyManagerSealDataRequest,
fidl::encoding::ResultType<KeyManagerSealDataResponse, Error>,
>(
(&mut plain_text,),
0x3d2fcd85d11c96bb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.cipher_text))
}
pub fn r#unseal_data(
&self,
mut cipher_text: fidl_fuchsia_mem::Buffer,
___deadline: zx::MonotonicInstant,
) -> Result<KeyManagerUnsealDataResult, fidl::Error> {
let _response = self.client.send_query::<
KeyManagerUnsealDataRequest,
fidl::encoding::ResultType<KeyManagerUnsealDataResponse, Error>,
>(
(&mut cipher_text,),
0x72dafc3131c1bca6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.plain_text))
}
pub fn r#generate_asymmetric_key(
&self,
mut key_name: &str,
mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<KeyManagerGenerateAsymmetricKeyResult, fidl::Error> {
let _response = self.client.send_query::<
KeyManagerGenerateAsymmetricKeyRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(key_name, key,),
0x66f1aa7ff5eb183d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#generate_asymmetric_key_with_algorithm(
&self,
mut key_name: &str,
mut key_algorithm: AsymmetricKeyAlgorithm,
mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<KeyManagerGenerateAsymmetricKeyWithAlgorithmResult, fidl::Error> {
let _response = self.client.send_query::<
KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(key_name, key_algorithm, key,),
0x2b9eac3ad0bc8a45,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#import_asymmetric_private_key(
&self,
mut data: &[u8],
mut key_name: &str,
mut key_algorithm: AsymmetricKeyAlgorithm,
mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<KeyManagerImportAsymmetricPrivateKeyResult, fidl::Error> {
let _response = self.client.send_query::<
KeyManagerImportAsymmetricPrivateKeyRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(data, key_name, key_algorithm, key,),
0x14c78f1ebb4eee71,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_asymmetric_private_key(
&self,
mut key_name: &str,
mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
___deadline: zx::MonotonicInstant,
) -> Result<KeyManagerGetAsymmetricPrivateKeyResult, fidl::Error> {
let _response = self.client.send_query::<
KeyManagerGetAsymmetricPrivateKeyRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(key_name, key,),
0x3a257fc6b6ccc5cd,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#delete_key(
&self,
mut key_name: &str,
___deadline: zx::MonotonicInstant,
) -> Result<KeyManagerDeleteKeyResult, fidl::Error> {
let _response = self.client.send_query::<
KeyManagerDeleteKeyRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(key_name,),
0x55521e617d023aad,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct KeyManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for KeyManagerProxy {
type Protocol = KeyManagerMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl KeyManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <KeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> KeyManagerEventStream {
KeyManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#seal_data(
&self,
mut plain_text: fidl_fuchsia_mem::Buffer,
) -> fidl::client::QueryResponseFut<
KeyManagerSealDataResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
KeyManagerProxyInterface::r#seal_data(self, plain_text)
}
pub fn r#unseal_data(
&self,
mut cipher_text: fidl_fuchsia_mem::Buffer,
) -> fidl::client::QueryResponseFut<
KeyManagerUnsealDataResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
KeyManagerProxyInterface::r#unseal_data(self, cipher_text)
}
pub fn r#generate_asymmetric_key(
&self,
mut key_name: &str,
mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
) -> fidl::client::QueryResponseFut<
KeyManagerGenerateAsymmetricKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
KeyManagerProxyInterface::r#generate_asymmetric_key(self, key_name, key)
}
pub fn r#generate_asymmetric_key_with_algorithm(
&self,
mut key_name: &str,
mut key_algorithm: AsymmetricKeyAlgorithm,
mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
) -> fidl::client::QueryResponseFut<
KeyManagerGenerateAsymmetricKeyWithAlgorithmResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
KeyManagerProxyInterface::r#generate_asymmetric_key_with_algorithm(
self,
key_name,
key_algorithm,
key,
)
}
pub fn r#import_asymmetric_private_key(
&self,
mut data: &[u8],
mut key_name: &str,
mut key_algorithm: AsymmetricKeyAlgorithm,
mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
) -> fidl::client::QueryResponseFut<
KeyManagerImportAsymmetricPrivateKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
KeyManagerProxyInterface::r#import_asymmetric_private_key(
self,
data,
key_name,
key_algorithm,
key,
)
}
pub fn r#get_asymmetric_private_key(
&self,
mut key_name: &str,
mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
) -> fidl::client::QueryResponseFut<
KeyManagerGetAsymmetricPrivateKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
KeyManagerProxyInterface::r#get_asymmetric_private_key(self, key_name, key)
}
pub fn r#delete_key(
&self,
mut key_name: &str,
) -> fidl::client::QueryResponseFut<
KeyManagerDeleteKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
KeyManagerProxyInterface::r#delete_key(self, key_name)
}
}
impl KeyManagerProxyInterface for KeyManagerProxy {
type SealDataResponseFut = fidl::client::QueryResponseFut<
KeyManagerSealDataResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#seal_data(&self, mut plain_text: fidl_fuchsia_mem::Buffer) -> Self::SealDataResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<KeyManagerSealDataResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<KeyManagerSealDataResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3d2fcd85d11c96bb,
>(_buf?)?;
Ok(_response.map(|x| x.cipher_text))
}
self.client.send_query_and_decode::<KeyManagerSealDataRequest, KeyManagerSealDataResult>(
(&mut plain_text,),
0x3d2fcd85d11c96bb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type UnsealDataResponseFut = fidl::client::QueryResponseFut<
KeyManagerUnsealDataResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#unseal_data(
&self,
mut cipher_text: fidl_fuchsia_mem::Buffer,
) -> Self::UnsealDataResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<KeyManagerUnsealDataResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<KeyManagerUnsealDataResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x72dafc3131c1bca6,
>(_buf?)?;
Ok(_response.map(|x| x.plain_text))
}
self.client
.send_query_and_decode::<KeyManagerUnsealDataRequest, KeyManagerUnsealDataResult>(
(&mut cipher_text,),
0x72dafc3131c1bca6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GenerateAsymmetricKeyResponseFut = fidl::client::QueryResponseFut<
KeyManagerGenerateAsymmetricKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#generate_asymmetric_key(
&self,
mut key_name: &str,
mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
) -> Self::GenerateAsymmetricKeyResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<KeyManagerGenerateAsymmetricKeyResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x66f1aa7ff5eb183d,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
KeyManagerGenerateAsymmetricKeyRequest,
KeyManagerGenerateAsymmetricKeyResult,
>(
(key_name, key,),
0x66f1aa7ff5eb183d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GenerateAsymmetricKeyWithAlgorithmResponseFut = fidl::client::QueryResponseFut<
KeyManagerGenerateAsymmetricKeyWithAlgorithmResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#generate_asymmetric_key_with_algorithm(
&self,
mut key_name: &str,
mut key_algorithm: AsymmetricKeyAlgorithm,
mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
) -> Self::GenerateAsymmetricKeyWithAlgorithmResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<KeyManagerGenerateAsymmetricKeyWithAlgorithmResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2b9eac3ad0bc8a45,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest,
KeyManagerGenerateAsymmetricKeyWithAlgorithmResult,
>(
(key_name, key_algorithm, key,),
0x2b9eac3ad0bc8a45,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ImportAsymmetricPrivateKeyResponseFut = fidl::client::QueryResponseFut<
KeyManagerImportAsymmetricPrivateKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#import_asymmetric_private_key(
&self,
mut data: &[u8],
mut key_name: &str,
mut key_algorithm: AsymmetricKeyAlgorithm,
mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
) -> Self::ImportAsymmetricPrivateKeyResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<KeyManagerImportAsymmetricPrivateKeyResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x14c78f1ebb4eee71,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
KeyManagerImportAsymmetricPrivateKeyRequest,
KeyManagerImportAsymmetricPrivateKeyResult,
>(
(data, key_name, key_algorithm, key,),
0x14c78f1ebb4eee71,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetAsymmetricPrivateKeyResponseFut = fidl::client::QueryResponseFut<
KeyManagerGetAsymmetricPrivateKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_asymmetric_private_key(
&self,
mut key_name: &str,
mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
) -> Self::GetAsymmetricPrivateKeyResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<KeyManagerGetAsymmetricPrivateKeyResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3a257fc6b6ccc5cd,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
KeyManagerGetAsymmetricPrivateKeyRequest,
KeyManagerGetAsymmetricPrivateKeyResult,
>(
(key_name, key,),
0x3a257fc6b6ccc5cd,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type DeleteKeyResponseFut = fidl::client::QueryResponseFut<
KeyManagerDeleteKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#delete_key(&self, mut key_name: &str) -> Self::DeleteKeyResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<KeyManagerDeleteKeyResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x55521e617d023aad,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<KeyManagerDeleteKeyRequest, KeyManagerDeleteKeyResult>(
(key_name,),
0x55521e617d023aad,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct KeyManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for KeyManagerEventStream {}
impl futures::stream::FusedStream for KeyManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for KeyManagerEventStream {
type Item = Result<KeyManagerEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(KeyManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum KeyManagerEvent {}
impl KeyManagerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<KeyManagerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <KeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct KeyManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for KeyManagerRequestStream {}
impl futures::stream::FusedStream for KeyManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for KeyManagerRequestStream {
type Protocol = KeyManagerMarker;
type ControlHandle = KeyManagerControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
KeyManagerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for KeyManagerRequestStream {
type Item = Result<KeyManagerRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled KeyManagerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x3d2fcd85d11c96bb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
KeyManagerSealDataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerSealDataRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
Ok(KeyManagerRequest::SealData {
plain_text: req.plain_text,
responder: KeyManagerSealDataResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x72dafc3131c1bca6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
KeyManagerUnsealDataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerUnsealDataRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
Ok(KeyManagerRequest::UnsealData {
cipher_text: req.cipher_text,
responder: KeyManagerUnsealDataResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x66f1aa7ff5eb183d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
KeyManagerGenerateAsymmetricKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerGenerateAsymmetricKeyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
Ok(KeyManagerRequest::GenerateAsymmetricKey {
key_name: req.key_name,
key: req.key,
responder: KeyManagerGenerateAsymmetricKeyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2b9eac3ad0bc8a45 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
Ok(KeyManagerRequest::GenerateAsymmetricKeyWithAlgorithm {
key_name: req.key_name,
key_algorithm: req.key_algorithm,
key: req.key,
responder: KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x14c78f1ebb4eee71 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
KeyManagerImportAsymmetricPrivateKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerImportAsymmetricPrivateKeyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
Ok(KeyManagerRequest::ImportAsymmetricPrivateKey {
data: req.data,
key_name: req.key_name,
key_algorithm: req.key_algorithm,
key: req.key,
responder: KeyManagerImportAsymmetricPrivateKeyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3a257fc6b6ccc5cd => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
KeyManagerGetAsymmetricPrivateKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerGetAsymmetricPrivateKeyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
Ok(KeyManagerRequest::GetAsymmetricPrivateKey {
key_name: req.key_name,
key: req.key,
responder: KeyManagerGetAsymmetricPrivateKeyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x55521e617d023aad => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
KeyManagerDeleteKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerDeleteKeyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
Ok(KeyManagerRequest::DeleteKey {
key_name: req.key_name,
responder: KeyManagerDeleteKeyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<KeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum KeyManagerRequest {
SealData { plain_text: fidl_fuchsia_mem::Buffer, responder: KeyManagerSealDataResponder },
UnsealData { cipher_text: fidl_fuchsia_mem::Buffer, responder: KeyManagerUnsealDataResponder },
GenerateAsymmetricKey {
key_name: String,
key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
responder: KeyManagerGenerateAsymmetricKeyResponder,
},
GenerateAsymmetricKeyWithAlgorithm {
key_name: String,
key_algorithm: AsymmetricKeyAlgorithm,
key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
responder: KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder,
},
ImportAsymmetricPrivateKey {
data: Vec<u8>,
key_name: String,
key_algorithm: AsymmetricKeyAlgorithm,
key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
responder: KeyManagerImportAsymmetricPrivateKeyResponder,
},
GetAsymmetricPrivateKey {
key_name: String,
key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
responder: KeyManagerGetAsymmetricPrivateKeyResponder,
},
DeleteKey { key_name: String, responder: KeyManagerDeleteKeyResponder },
}
impl KeyManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_seal_data(self) -> Option<(fidl_fuchsia_mem::Buffer, KeyManagerSealDataResponder)> {
if let KeyManagerRequest::SealData { plain_text, responder } = self {
Some((plain_text, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_unseal_data(
self,
) -> Option<(fidl_fuchsia_mem::Buffer, KeyManagerUnsealDataResponder)> {
if let KeyManagerRequest::UnsealData { cipher_text, responder } = self {
Some((cipher_text, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_generate_asymmetric_key(
self,
) -> Option<(
String,
fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
KeyManagerGenerateAsymmetricKeyResponder,
)> {
if let KeyManagerRequest::GenerateAsymmetricKey { key_name, key, responder } = self {
Some((key_name, key, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_generate_asymmetric_key_with_algorithm(
self,
) -> Option<(
String,
AsymmetricKeyAlgorithm,
fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder,
)> {
if let KeyManagerRequest::GenerateAsymmetricKeyWithAlgorithm {
key_name,
key_algorithm,
key,
responder,
} = self
{
Some((key_name, key_algorithm, key, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_import_asymmetric_private_key(
self,
) -> Option<(
Vec<u8>,
String,
AsymmetricKeyAlgorithm,
fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
KeyManagerImportAsymmetricPrivateKeyResponder,
)> {
if let KeyManagerRequest::ImportAsymmetricPrivateKey {
data,
key_name,
key_algorithm,
key,
responder,
} = self
{
Some((data, key_name, key_algorithm, key, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_asymmetric_private_key(
self,
) -> Option<(
String,
fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
KeyManagerGetAsymmetricPrivateKeyResponder,
)> {
if let KeyManagerRequest::GetAsymmetricPrivateKey { key_name, key, responder } = self {
Some((key_name, key, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_delete_key(self) -> Option<(String, KeyManagerDeleteKeyResponder)> {
if let KeyManagerRequest::DeleteKey { key_name, responder } = self {
Some((key_name, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
KeyManagerRequest::SealData { .. } => "seal_data",
KeyManagerRequest::UnsealData { .. } => "unseal_data",
KeyManagerRequest::GenerateAsymmetricKey { .. } => "generate_asymmetric_key",
KeyManagerRequest::GenerateAsymmetricKeyWithAlgorithm { .. } => {
"generate_asymmetric_key_with_algorithm"
}
KeyManagerRequest::ImportAsymmetricPrivateKey { .. } => "import_asymmetric_private_key",
KeyManagerRequest::GetAsymmetricPrivateKey { .. } => "get_asymmetric_private_key",
KeyManagerRequest::DeleteKey { .. } => "delete_key",
}
}
}
#[derive(Debug, Clone)]
pub struct KeyManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for KeyManagerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl KeyManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct KeyManagerSealDataResponder {
control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for KeyManagerSealDataResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for KeyManagerSealDataResponder {
type ControlHandle = KeyManagerControlHandle;
fn control_handle(&self) -> &KeyManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl KeyManagerSealDataResponder {
pub fn send(
self,
mut result: Result<fidl_fuchsia_mem::Buffer, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl_fuchsia_mem::Buffer, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<fidl_fuchsia_mem::Buffer, Error>,
) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<KeyManagerSealDataResponse, Error>>(
result.as_mut().map_err(|e| *e).map(|cipher_text| (cipher_text,)),
self.tx_id,
0x3d2fcd85d11c96bb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct KeyManagerUnsealDataResponder {
control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for KeyManagerUnsealDataResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for KeyManagerUnsealDataResponder {
type ControlHandle = KeyManagerControlHandle;
fn control_handle(&self) -> &KeyManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl KeyManagerUnsealDataResponder {
pub fn send(
self,
mut result: Result<fidl_fuchsia_mem::Buffer, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl_fuchsia_mem::Buffer, Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<fidl_fuchsia_mem::Buffer, Error>,
) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<KeyManagerUnsealDataResponse, Error>>(
result.as_mut().map_err(|e| *e).map(|plain_text| (plain_text,)),
self.tx_id,
0x72dafc3131c1bca6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct KeyManagerGenerateAsymmetricKeyResponder {
control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for KeyManagerGenerateAsymmetricKeyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for KeyManagerGenerateAsymmetricKeyResponder {
type ControlHandle = KeyManagerControlHandle;
fn control_handle(&self) -> &KeyManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl KeyManagerGenerateAsymmetricKeyResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x66f1aa7ff5eb183d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder {
control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder {
type ControlHandle = KeyManagerControlHandle;
fn control_handle(&self) -> &KeyManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x2b9eac3ad0bc8a45,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct KeyManagerImportAsymmetricPrivateKeyResponder {
control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for KeyManagerImportAsymmetricPrivateKeyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for KeyManagerImportAsymmetricPrivateKeyResponder {
type ControlHandle = KeyManagerControlHandle;
fn control_handle(&self) -> &KeyManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl KeyManagerImportAsymmetricPrivateKeyResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x14c78f1ebb4eee71,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct KeyManagerGetAsymmetricPrivateKeyResponder {
control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for KeyManagerGetAsymmetricPrivateKeyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for KeyManagerGetAsymmetricPrivateKeyResponder {
type ControlHandle = KeyManagerControlHandle;
fn control_handle(&self) -> &KeyManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl KeyManagerGetAsymmetricPrivateKeyResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x3a257fc6b6ccc5cd,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct KeyManagerDeleteKeyResponder {
control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for KeyManagerDeleteKeyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for KeyManagerDeleteKeyResponder {
type ControlHandle = KeyManagerControlHandle;
fn control_handle(&self) -> &KeyManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl KeyManagerDeleteKeyResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x55521e617d023aad,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StatelessKeyManagerMarker;
impl fidl::endpoints::ProtocolMarker for StatelessKeyManagerMarker {
type Proxy = StatelessKeyManagerProxy;
type RequestStream = StatelessKeyManagerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StatelessKeyManagerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.kms.StatelessKeyManager";
}
impl fidl::endpoints::DiscoverableProtocolMarker for StatelessKeyManagerMarker {}
pub type StatelessKeyManagerGetHardwareDerivedKeyResult = Result<Vec<u8>, Error>;
pub trait StatelessKeyManagerProxyInterface: Send + Sync {
type GetHardwareDerivedKeyResponseFut: std::future::Future<
Output = Result<StatelessKeyManagerGetHardwareDerivedKeyResult, fidl::Error>,
> + Send;
fn r#get_hardware_derived_key(&self, key_info: &[u8])
-> Self::GetHardwareDerivedKeyResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StatelessKeyManagerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StatelessKeyManagerSynchronousProxy {
type Proxy = StatelessKeyManagerProxy;
type Protocol = StatelessKeyManagerMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl StatelessKeyManagerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<StatelessKeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<StatelessKeyManagerEvent, fidl::Error> {
StatelessKeyManagerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_hardware_derived_key(
&self,
mut key_info: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<StatelessKeyManagerGetHardwareDerivedKeyResult, fidl::Error> {
let _response = self.client.send_query::<
StatelessKeyManagerGetHardwareDerivedKeyRequest,
fidl::encoding::ResultType<StatelessKeyManagerGetHardwareDerivedKeyResponse, Error>,
>(
(key_info,),
0x685043d9e68d5f86,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.derived_key))
}
}
#[derive(Debug, Clone)]
pub struct StatelessKeyManagerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for StatelessKeyManagerProxy {
type Protocol = StatelessKeyManagerMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl StatelessKeyManagerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<StatelessKeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StatelessKeyManagerEventStream {
StatelessKeyManagerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_hardware_derived_key(
&self,
mut key_info: &[u8],
) -> fidl::client::QueryResponseFut<
StatelessKeyManagerGetHardwareDerivedKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
StatelessKeyManagerProxyInterface::r#get_hardware_derived_key(self, key_info)
}
}
impl StatelessKeyManagerProxyInterface for StatelessKeyManagerProxy {
type GetHardwareDerivedKeyResponseFut = fidl::client::QueryResponseFut<
StatelessKeyManagerGetHardwareDerivedKeyResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_hardware_derived_key(
&self,
mut key_info: &[u8],
) -> Self::GetHardwareDerivedKeyResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<StatelessKeyManagerGetHardwareDerivedKeyResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<StatelessKeyManagerGetHardwareDerivedKeyResponse, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x685043d9e68d5f86,
>(_buf?)?;
Ok(_response.map(|x| x.derived_key))
}
self.client.send_query_and_decode::<
StatelessKeyManagerGetHardwareDerivedKeyRequest,
StatelessKeyManagerGetHardwareDerivedKeyResult,
>(
(key_info,),
0x685043d9e68d5f86,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct StatelessKeyManagerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for StatelessKeyManagerEventStream {}
impl futures::stream::FusedStream for StatelessKeyManagerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StatelessKeyManagerEventStream {
type Item = Result<StatelessKeyManagerEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(StatelessKeyManagerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StatelessKeyManagerEvent {}
impl StatelessKeyManagerEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<StatelessKeyManagerEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name:
<StatelessKeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StatelessKeyManagerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for StatelessKeyManagerRequestStream {}
impl futures::stream::FusedStream for StatelessKeyManagerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StatelessKeyManagerRequestStream {
type Protocol = StatelessKeyManagerMarker;
type ControlHandle = StatelessKeyManagerControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
StatelessKeyManagerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for StatelessKeyManagerRequestStream {
type Item = Result<StatelessKeyManagerRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled StatelessKeyManagerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x685043d9e68d5f86 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(StatelessKeyManagerGetHardwareDerivedKeyRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StatelessKeyManagerGetHardwareDerivedKeyRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = StatelessKeyManagerControlHandle {
inner: this.inner.clone(),
};
Ok(StatelessKeyManagerRequest::GetHardwareDerivedKey {key_info: req.key_info,
responder: StatelessKeyManagerGetHardwareDerivedKeyResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <StatelessKeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum StatelessKeyManagerRequest {
GetHardwareDerivedKey {
key_info: Vec<u8>,
responder: StatelessKeyManagerGetHardwareDerivedKeyResponder,
},
}
impl StatelessKeyManagerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_hardware_derived_key(
self,
) -> Option<(Vec<u8>, StatelessKeyManagerGetHardwareDerivedKeyResponder)> {
if let StatelessKeyManagerRequest::GetHardwareDerivedKey { key_info, responder } = self {
Some((key_info, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StatelessKeyManagerRequest::GetHardwareDerivedKey { .. } => "get_hardware_derived_key",
}
}
}
#[derive(Debug, Clone)]
pub struct StatelessKeyManagerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for StatelessKeyManagerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl StatelessKeyManagerControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StatelessKeyManagerGetHardwareDerivedKeyResponder {
control_handle: std::mem::ManuallyDrop<StatelessKeyManagerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StatelessKeyManagerGetHardwareDerivedKeyResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StatelessKeyManagerGetHardwareDerivedKeyResponder {
type ControlHandle = StatelessKeyManagerControlHandle;
fn control_handle(&self) -> &StatelessKeyManagerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StatelessKeyManagerGetHardwareDerivedKeyResponder {
pub fn send(self, mut result: Result<&[u8], Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<&[u8], Error>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], Error>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
StatelessKeyManagerGetHardwareDerivedKeyResponse,
Error,
>>(
result.map(|derived_key| (derived_key,)),
self.tx_id,
0x685043d9e68d5f86,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for AsymmetricKeyAlgorithm {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for AsymmetricKeyAlgorithm {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for AsymmetricKeyAlgorithm
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AsymmetricKeyAlgorithm
{
#[inline(always)]
fn new_empty() -> Self {
Self::RsaSsaPssSha2562048
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Error {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Error {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
#[inline(always)]
fn new_empty() -> Self {
Self::InternalError
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for KeyOrigin {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for KeyOrigin {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyOrigin {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyOrigin {
#[inline(always)]
fn new_empty() -> Self {
Self::Generated
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for KeyProvider {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for KeyProvider {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyProvider {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyProvider {
#[inline(always)]
fn new_empty() -> Self {
Self::MockProvider
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for AsymmetricPrivateKeySignRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AsymmetricPrivateKeySignRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
AsymmetricPrivateKeySignRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut AsymmetricPrivateKeySignRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AsymmetricPrivateKeySignRequest>(offset);
fidl::encoding::Encode::<
AsymmetricPrivateKeySignRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.data,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
AsymmetricPrivateKeySignRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AsymmetricPrivateKeySignRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for AsymmetricPrivateKeySignRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
data: fidl::new_empty!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.data,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AsymmetricPrivateKeyGetKeyAlgorithmResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AsymmetricPrivateKeyGetKeyAlgorithmResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AsymmetricPrivateKeyGetKeyAlgorithmResponse, D>
for &AsymmetricPrivateKeyGetKeyAlgorithmResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AsymmetricPrivateKeyGetKeyAlgorithmResponse>(offset);
fidl::encoding::Encode::<AsymmetricPrivateKeyGetKeyAlgorithmResponse, D>::encode(
(<AsymmetricKeyAlgorithm as fidl::encoding::ValueTypeMarker>::borrow(
&self.key_algorithm,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<AsymmetricKeyAlgorithm, D>,
> fidl::encoding::Encode<AsymmetricPrivateKeyGetKeyAlgorithmResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AsymmetricPrivateKeyGetKeyAlgorithmResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AsymmetricPrivateKeyGetKeyAlgorithmResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { key_algorithm: fidl::new_empty!(AsymmetricKeyAlgorithm, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
AsymmetricKeyAlgorithm,
D,
&mut self.key_algorithm,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AsymmetricPrivateKeyGetPublicKeyResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AsymmetricPrivateKeyGetPublicKeyResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AsymmetricPrivateKeyGetPublicKeyResponse, D>
for &AsymmetricPrivateKeyGetPublicKeyResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AsymmetricPrivateKeyGetPublicKeyResponse>(offset);
fidl::encoding::Encode::<AsymmetricPrivateKeyGetPublicKeyResponse, D>::encode(
(<PublicKey as fidl::encoding::ValueTypeMarker>::borrow(&self.public_key),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PublicKey, D>>
fidl::encoding::Encode<AsymmetricPrivateKeyGetPublicKeyResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AsymmetricPrivateKeyGetPublicKeyResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AsymmetricPrivateKeyGetPublicKeyResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { public_key: fidl::new_empty!(PublicKey, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(PublicKey, D, &mut self.public_key, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for AsymmetricPrivateKeySignResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for AsymmetricPrivateKeySignResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<AsymmetricPrivateKeySignResponse, D>
for &AsymmetricPrivateKeySignResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AsymmetricPrivateKeySignResponse>(offset);
fidl::encoding::Encode::<AsymmetricPrivateKeySignResponse, D>::encode(
(<Signature as fidl::encoding::ValueTypeMarker>::borrow(&self.signature),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Signature, D>>
fidl::encoding::Encode<AsymmetricPrivateKeySignResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<AsymmetricPrivateKeySignResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for AsymmetricPrivateKeySignResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { signature: fidl::new_empty!(Signature, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(Signature, D, &mut self.signature, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for KeyManagerDeleteKeyRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for KeyManagerDeleteKeyRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<KeyManagerDeleteKeyRequest, D> for &KeyManagerDeleteKeyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerDeleteKeyRequest>(offset);
fidl::encoding::Encode::<KeyManagerDeleteKeyRequest, D>::encode(
(<fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key_name,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<32>, D>,
> fidl::encoding::Encode<KeyManagerDeleteKeyRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerDeleteKeyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for KeyManagerDeleteKeyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { key_name: fidl::new_empty!(fidl::encoding::BoundedString<32>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<32>,
D,
&mut self.key_name,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for KeyManagerGenerateAsymmetricKeyRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for KeyManagerGenerateAsymmetricKeyRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
KeyManagerGenerateAsymmetricKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut KeyManagerGenerateAsymmetricKeyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerGenerateAsymmetricKeyRequest>(offset);
fidl::encoding::Encode::<
KeyManagerGenerateAsymmetricKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key_name,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.key
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
KeyManagerGenerateAsymmetricKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerGenerateAsymmetricKeyRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerGenerateAsymmetricKeyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
key_name: fidl::new_empty!(
fidl::encoding::BoundedString<32>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
key: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.key_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.key,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest>(offset);
fidl::encoding::Encode::<
KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key_name,
),
<AsymmetricKeyAlgorithm as fidl::encoding::ValueTypeMarker>::borrow(
&self.key_algorithm,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.key
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
AsymmetricKeyAlgorithm,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 20, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
key_name: fidl::new_empty!(
fidl::encoding::BoundedString<32>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
key_algorithm: fidl::new_empty!(
AsymmetricKeyAlgorithm,
fidl::encoding::DefaultFuchsiaResourceDialect
),
key: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::BoundedString<32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.key_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
AsymmetricKeyAlgorithm,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.key_algorithm,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.key,
decoder,
offset + 20,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for KeyManagerGetAsymmetricPrivateKeyRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for KeyManagerGetAsymmetricPrivateKeyRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
KeyManagerGetAsymmetricPrivateKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut KeyManagerGetAsymmetricPrivateKeyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerGetAsymmetricPrivateKeyRequest>(offset);
fidl::encoding::Encode::<
KeyManagerGetAsymmetricPrivateKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key_name,
),
<fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.key
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::BoundedString<32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
KeyManagerGetAsymmetricPrivateKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerGetAsymmetricPrivateKeyRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerGetAsymmetricPrivateKeyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
key_name: fidl::new_empty!(
fidl::encoding::BoundedString<32>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
key: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.key_name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.key,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for KeyManagerImportAsymmetricPrivateKeyRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for KeyManagerImportAsymmetricPrivateKeyRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
unsafe impl
fidl::encoding::Encode<
KeyManagerImportAsymmetricPrivateKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut KeyManagerImportAsymmetricPrivateKeyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerImportAsymmetricPrivateKeyRequest>(offset);
fidl::encoding::Encode::<KeyManagerImportAsymmetricPrivateKeyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
<fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.key_name),
<AsymmetricKeyAlgorithm as fidl::encoding::ValueTypeMarker>::borrow(&self.key_algorithm),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.key),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<u8>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::BoundedString<32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T2: fidl::encoding::Encode<
AsymmetricKeyAlgorithm,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T3: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
KeyManagerImportAsymmetricPrivateKeyRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerImportAsymmetricPrivateKeyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 36, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerImportAsymmetricPrivateKeyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
data: fidl::new_empty!(
fidl::encoding::UnboundedVector<u8>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
key_name: fidl::new_empty!(
fidl::encoding::BoundedString<32>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
key_algorithm: fidl::new_empty!(
AsymmetricKeyAlgorithm,
fidl::encoding::DefaultFuchsiaResourceDialect
),
key: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.data,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::BoundedString<32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.key_name,
decoder,
offset + 16,
_depth
)?;
fidl::decode!(
AsymmetricKeyAlgorithm,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.key_algorithm,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.key,
decoder,
offset + 36,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for KeyManagerSealDataRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for KeyManagerSealDataRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
KeyManagerSealDataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut KeyManagerSealDataRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerSealDataRequest>(offset);
fidl::encoding::Encode::<
KeyManagerSealDataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.plain_text,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
KeyManagerSealDataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerSealDataRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerSealDataRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
plain_text: fidl::new_empty!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.plain_text,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for KeyManagerUnsealDataRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for KeyManagerUnsealDataRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
KeyManagerUnsealDataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut KeyManagerUnsealDataRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerUnsealDataRequest>(offset);
fidl::encoding::Encode::<
KeyManagerUnsealDataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.cipher_text,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
KeyManagerUnsealDataRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerUnsealDataRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerUnsealDataRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
cipher_text: fidl::new_empty!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.cipher_text,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for KeyManagerSealDataResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for KeyManagerSealDataResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
KeyManagerSealDataResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut KeyManagerSealDataResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerSealDataResponse>(offset);
fidl::encoding::Encode::<
KeyManagerSealDataResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.cipher_text,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
KeyManagerSealDataResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerSealDataResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerSealDataResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
cipher_text: fidl::new_empty!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.cipher_text,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for KeyManagerUnsealDataResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for KeyManagerUnsealDataResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
KeyManagerUnsealDataResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut KeyManagerUnsealDataResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerUnsealDataResponse>(offset);
fidl::encoding::Encode::<
KeyManagerUnsealDataResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.plain_text,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
KeyManagerUnsealDataResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyManagerUnsealDataResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for KeyManagerUnsealDataResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
plain_text: fidl::new_empty!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_mem::Buffer,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.plain_text,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for KeyGetKeyOriginResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for KeyGetKeyOriginResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<KeyGetKeyOriginResponse, D> for &KeyGetKeyOriginResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyGetKeyOriginResponse>(offset);
fidl::encoding::Encode::<KeyGetKeyOriginResponse, D>::encode(
(<KeyOrigin as fidl::encoding::ValueTypeMarker>::borrow(&self.key_origin),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<KeyOrigin, D>>
fidl::encoding::Encode<KeyGetKeyOriginResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyGetKeyOriginResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for KeyGetKeyOriginResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { key_origin: fidl::new_empty!(KeyOrigin, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(KeyOrigin, D, &mut self.key_origin, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for KeyGetKeyProviderResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for KeyGetKeyProviderResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<KeyGetKeyProviderResponse, D> for &KeyGetKeyProviderResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyGetKeyProviderResponse>(offset);
fidl::encoding::Encode::<KeyGetKeyProviderResponse, D>::encode(
(<KeyProvider as fidl::encoding::ValueTypeMarker>::borrow(&self.key_provider),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<KeyProvider, D>>
fidl::encoding::Encode<KeyGetKeyProviderResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<KeyGetKeyProviderResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for KeyGetKeyProviderResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { key_provider: fidl::new_empty!(KeyProvider, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(KeyProvider, D, &mut self.key_provider, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for PublicKey {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PublicKey {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PublicKey, D>
for &PublicKey
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PublicKey>(offset);
fidl::encoding::Encode::<PublicKey, D>::encode(
(<fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(
&self.bytes,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>, D>,
> fidl::encoding::Encode<PublicKey, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PublicKey>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PublicKey {
#[inline(always)]
fn new_empty() -> Self {
Self { bytes: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<u8, 256>, D, &mut self.bytes, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Signature {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Signature {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Signature, D>
for &Signature
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Signature>(offset);
fidl::encoding::Encode::<Signature, D>::encode(
(<fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
&self.bytes,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
> fidl::encoding::Encode<Signature, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Signature>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Signature {
#[inline(always)]
fn new_empty() -> Self {
Self { bytes: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.bytes, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StatelessKeyManagerGetHardwareDerivedKeyRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StatelessKeyManagerGetHardwareDerivedKeyRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StatelessKeyManagerGetHardwareDerivedKeyRequest, D>
for &StatelessKeyManagerGetHardwareDerivedKeyRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StatelessKeyManagerGetHardwareDerivedKeyRequest>(offset);
fidl::encoding::Encode::<StatelessKeyManagerGetHardwareDerivedKeyRequest, D>::encode(
(<fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
&self.key_info,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
> fidl::encoding::Encode<StatelessKeyManagerGetHardwareDerivedKeyRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StatelessKeyManagerGetHardwareDerivedKeyRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StatelessKeyManagerGetHardwareDerivedKeyRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { key_info: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.key_info, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StatelessKeyManagerGetHardwareDerivedKeyResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StatelessKeyManagerGetHardwareDerivedKeyResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StatelessKeyManagerGetHardwareDerivedKeyResponse, D>
for &StatelessKeyManagerGetHardwareDerivedKeyResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StatelessKeyManagerGetHardwareDerivedKeyResponse>(offset);
fidl::encoding::Encode::<StatelessKeyManagerGetHardwareDerivedKeyResponse, D>::encode(
(<fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
&self.derived_key,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
> fidl::encoding::Encode<StatelessKeyManagerGetHardwareDerivedKeyResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StatelessKeyManagerGetHardwareDerivedKeyResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StatelessKeyManagerGetHardwareDerivedKeyResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { derived_key: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.derived_key, decoder, offset + 0, _depth)?;
Ok(())
}
}
}