1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_kms_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct AsymmetricPrivateKeySignRequest {
16 pub data: fidl_fuchsia_mem::Buffer,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for AsymmetricPrivateKeySignRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct KeyManagerGenerateAsymmetricKeyRequest {
26 pub key_name: String,
27 pub key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for KeyManagerGenerateAsymmetricKeyRequest
32{
33}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest {
37 pub key_name: String,
38 pub key_algorithm: AsymmetricKeyAlgorithm,
39 pub key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43 for KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest
44{
45}
46
47#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
48pub struct KeyManagerGetAsymmetricPrivateKeyRequest {
49 pub key_name: String,
50 pub key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
54 for KeyManagerGetAsymmetricPrivateKeyRequest
55{
56}
57
58#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
59pub struct KeyManagerImportAsymmetricPrivateKeyRequest {
60 pub data: Vec<u8>,
61 pub key_name: String,
62 pub key_algorithm: AsymmetricKeyAlgorithm,
63 pub key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
64}
65
66impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
67 for KeyManagerImportAsymmetricPrivateKeyRequest
68{
69}
70
71#[derive(Debug, PartialEq)]
72pub struct KeyManagerSealDataRequest {
73 pub plain_text: fidl_fuchsia_mem::Buffer,
74}
75
76impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for KeyManagerSealDataRequest {}
77
78#[derive(Debug, PartialEq)]
79pub struct KeyManagerUnsealDataRequest {
80 pub cipher_text: fidl_fuchsia_mem::Buffer,
81}
82
83impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
84 for KeyManagerUnsealDataRequest
85{
86}
87
88#[derive(Debug, PartialEq)]
89pub struct KeyManagerSealDataResponse {
90 pub cipher_text: fidl_fuchsia_mem::Buffer,
91}
92
93impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
94 for KeyManagerSealDataResponse
95{
96}
97
98#[derive(Debug, PartialEq)]
99pub struct KeyManagerUnsealDataResponse {
100 pub plain_text: fidl_fuchsia_mem::Buffer,
101}
102
103impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
104 for KeyManagerUnsealDataResponse
105{
106}
107
108#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
109pub struct AsymmetricPrivateKeyMarker;
110
111impl fidl::endpoints::ProtocolMarker for AsymmetricPrivateKeyMarker {
112 type Proxy = AsymmetricPrivateKeyProxy;
113 type RequestStream = AsymmetricPrivateKeyRequestStream;
114 #[cfg(target_os = "fuchsia")]
115 type SynchronousProxy = AsymmetricPrivateKeySynchronousProxy;
116
117 const DEBUG_NAME: &'static str = "(anonymous) AsymmetricPrivateKey";
118}
119pub type AsymmetricPrivateKeySignResult = Result<Signature, Error>;
120pub type AsymmetricPrivateKeyGetPublicKeyResult = Result<PublicKey, Error>;
121pub type AsymmetricPrivateKeyGetKeyAlgorithmResult = Result<AsymmetricKeyAlgorithm, Error>;
122
123pub trait AsymmetricPrivateKeyProxyInterface: Send + Sync {
124 type GetKeyOriginResponseFut: std::future::Future<Output = Result<KeyGetKeyOriginResult, fidl::Error>>
125 + Send;
126 fn r#get_key_origin(&self) -> Self::GetKeyOriginResponseFut;
127 type GetKeyProviderResponseFut: std::future::Future<Output = Result<KeyGetKeyProviderResult, fidl::Error>>
128 + Send;
129 fn r#get_key_provider(&self) -> Self::GetKeyProviderResponseFut;
130 type SignResponseFut: std::future::Future<Output = Result<AsymmetricPrivateKeySignResult, fidl::Error>>
131 + Send;
132 fn r#sign(&self, data: fidl_fuchsia_mem::Buffer) -> Self::SignResponseFut;
133 type GetPublicKeyResponseFut: std::future::Future<Output = Result<AsymmetricPrivateKeyGetPublicKeyResult, fidl::Error>>
134 + Send;
135 fn r#get_public_key(&self) -> Self::GetPublicKeyResponseFut;
136 type GetKeyAlgorithmResponseFut: std::future::Future<Output = Result<AsymmetricPrivateKeyGetKeyAlgorithmResult, fidl::Error>>
137 + Send;
138 fn r#get_key_algorithm(&self) -> Self::GetKeyAlgorithmResponseFut;
139}
140#[derive(Debug)]
141#[cfg(target_os = "fuchsia")]
142pub struct AsymmetricPrivateKeySynchronousProxy {
143 client: fidl::client::sync::Client,
144}
145
146#[cfg(target_os = "fuchsia")]
147impl fidl::endpoints::SynchronousProxy for AsymmetricPrivateKeySynchronousProxy {
148 type Proxy = AsymmetricPrivateKeyProxy;
149 type Protocol = AsymmetricPrivateKeyMarker;
150
151 fn from_channel(inner: fidl::Channel) -> Self {
152 Self::new(inner)
153 }
154
155 fn into_channel(self) -> fidl::Channel {
156 self.client.into_channel()
157 }
158
159 fn as_channel(&self) -> &fidl::Channel {
160 self.client.as_channel()
161 }
162}
163
164#[cfg(target_os = "fuchsia")]
165impl AsymmetricPrivateKeySynchronousProxy {
166 pub fn new(channel: fidl::Channel) -> Self {
167 let protocol_name =
168 <AsymmetricPrivateKeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
169 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
170 }
171
172 pub fn into_channel(self) -> fidl::Channel {
173 self.client.into_channel()
174 }
175
176 pub fn wait_for_event(
179 &self,
180 deadline: zx::MonotonicInstant,
181 ) -> Result<AsymmetricPrivateKeyEvent, fidl::Error> {
182 AsymmetricPrivateKeyEvent::decode(self.client.wait_for_event(deadline)?)
183 }
184
185 pub fn r#get_key_origin(
187 &self,
188 ___deadline: zx::MonotonicInstant,
189 ) -> Result<KeyGetKeyOriginResult, fidl::Error> {
190 let _response = self.client.send_query::<
191 fidl::encoding::EmptyPayload,
192 fidl::encoding::ResultType<KeyGetKeyOriginResponse, Error>,
193 >(
194 (),
195 0x3e439554159e7b86,
196 fidl::encoding::DynamicFlags::empty(),
197 ___deadline,
198 )?;
199 Ok(_response.map(|x| x.key_origin))
200 }
201
202 pub fn r#get_key_provider(
204 &self,
205 ___deadline: zx::MonotonicInstant,
206 ) -> Result<KeyGetKeyProviderResult, fidl::Error> {
207 let _response = self.client.send_query::<
208 fidl::encoding::EmptyPayload,
209 fidl::encoding::ResultType<KeyGetKeyProviderResponse, Error>,
210 >(
211 (),
212 0x68e2cd7ec0532e0c,
213 fidl::encoding::DynamicFlags::empty(),
214 ___deadline,
215 )?;
216 Ok(_response.map(|x| x.key_provider))
217 }
218
219 pub fn r#sign(
221 &self,
222 mut data: fidl_fuchsia_mem::Buffer,
223 ___deadline: zx::MonotonicInstant,
224 ) -> Result<AsymmetricPrivateKeySignResult, fidl::Error> {
225 let _response = self.client.send_query::<
226 AsymmetricPrivateKeySignRequest,
227 fidl::encoding::ResultType<AsymmetricPrivateKeySignResponse, Error>,
228 >(
229 (&mut data,),
230 0x524ba8b350c2542e,
231 fidl::encoding::DynamicFlags::empty(),
232 ___deadline,
233 )?;
234 Ok(_response.map(|x| x.signature))
235 }
236
237 pub fn r#get_public_key(
239 &self,
240 ___deadline: zx::MonotonicInstant,
241 ) -> Result<AsymmetricPrivateKeyGetPublicKeyResult, fidl::Error> {
242 let _response =
243 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
244 AsymmetricPrivateKeyGetPublicKeyResponse,
245 Error,
246 >>(
247 (),
248 0x5439aff00ed261f3,
249 fidl::encoding::DynamicFlags::empty(),
250 ___deadline,
251 )?;
252 Ok(_response.map(|x| x.public_key))
253 }
254
255 pub fn r#get_key_algorithm(
257 &self,
258 ___deadline: zx::MonotonicInstant,
259 ) -> Result<AsymmetricPrivateKeyGetKeyAlgorithmResult, fidl::Error> {
260 let _response =
261 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
262 AsymmetricPrivateKeyGetKeyAlgorithmResponse,
263 Error,
264 >>(
265 (),
266 0xe0ce6b5b815b1ae,
267 fidl::encoding::DynamicFlags::empty(),
268 ___deadline,
269 )?;
270 Ok(_response.map(|x| x.key_algorithm))
271 }
272}
273
274#[cfg(target_os = "fuchsia")]
275impl From<AsymmetricPrivateKeySynchronousProxy> for zx::Handle {
276 fn from(value: AsymmetricPrivateKeySynchronousProxy) -> Self {
277 value.into_channel().into()
278 }
279}
280
281#[cfg(target_os = "fuchsia")]
282impl From<fidl::Channel> for AsymmetricPrivateKeySynchronousProxy {
283 fn from(value: fidl::Channel) -> Self {
284 Self::new(value)
285 }
286}
287
288#[derive(Debug, Clone)]
289pub struct AsymmetricPrivateKeyProxy {
290 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
291}
292
293impl fidl::endpoints::Proxy for AsymmetricPrivateKeyProxy {
294 type Protocol = AsymmetricPrivateKeyMarker;
295
296 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
297 Self::new(inner)
298 }
299
300 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
301 self.client.into_channel().map_err(|client| Self { client })
302 }
303
304 fn as_channel(&self) -> &::fidl::AsyncChannel {
305 self.client.as_channel()
306 }
307}
308
309impl AsymmetricPrivateKeyProxy {
310 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
312 let protocol_name =
313 <AsymmetricPrivateKeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
314 Self { client: fidl::client::Client::new(channel, protocol_name) }
315 }
316
317 pub fn take_event_stream(&self) -> AsymmetricPrivateKeyEventStream {
323 AsymmetricPrivateKeyEventStream { event_receiver: self.client.take_event_receiver() }
324 }
325
326 pub fn r#get_key_origin(
328 &self,
329 ) -> fidl::client::QueryResponseFut<
330 KeyGetKeyOriginResult,
331 fidl::encoding::DefaultFuchsiaResourceDialect,
332 > {
333 AsymmetricPrivateKeyProxyInterface::r#get_key_origin(self)
334 }
335
336 pub fn r#get_key_provider(
338 &self,
339 ) -> fidl::client::QueryResponseFut<
340 KeyGetKeyProviderResult,
341 fidl::encoding::DefaultFuchsiaResourceDialect,
342 > {
343 AsymmetricPrivateKeyProxyInterface::r#get_key_provider(self)
344 }
345
346 pub fn r#sign(
348 &self,
349 mut data: fidl_fuchsia_mem::Buffer,
350 ) -> fidl::client::QueryResponseFut<
351 AsymmetricPrivateKeySignResult,
352 fidl::encoding::DefaultFuchsiaResourceDialect,
353 > {
354 AsymmetricPrivateKeyProxyInterface::r#sign(self, data)
355 }
356
357 pub fn r#get_public_key(
359 &self,
360 ) -> fidl::client::QueryResponseFut<
361 AsymmetricPrivateKeyGetPublicKeyResult,
362 fidl::encoding::DefaultFuchsiaResourceDialect,
363 > {
364 AsymmetricPrivateKeyProxyInterface::r#get_public_key(self)
365 }
366
367 pub fn r#get_key_algorithm(
369 &self,
370 ) -> fidl::client::QueryResponseFut<
371 AsymmetricPrivateKeyGetKeyAlgorithmResult,
372 fidl::encoding::DefaultFuchsiaResourceDialect,
373 > {
374 AsymmetricPrivateKeyProxyInterface::r#get_key_algorithm(self)
375 }
376}
377
378impl AsymmetricPrivateKeyProxyInterface for AsymmetricPrivateKeyProxy {
379 type GetKeyOriginResponseFut = fidl::client::QueryResponseFut<
380 KeyGetKeyOriginResult,
381 fidl::encoding::DefaultFuchsiaResourceDialect,
382 >;
383 fn r#get_key_origin(&self) -> Self::GetKeyOriginResponseFut {
384 fn _decode(
385 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
386 ) -> Result<KeyGetKeyOriginResult, fidl::Error> {
387 let _response = fidl::client::decode_transaction_body::<
388 fidl::encoding::ResultType<KeyGetKeyOriginResponse, Error>,
389 fidl::encoding::DefaultFuchsiaResourceDialect,
390 0x3e439554159e7b86,
391 >(_buf?)?;
392 Ok(_response.map(|x| x.key_origin))
393 }
394 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, KeyGetKeyOriginResult>(
395 (),
396 0x3e439554159e7b86,
397 fidl::encoding::DynamicFlags::empty(),
398 _decode,
399 )
400 }
401
402 type GetKeyProviderResponseFut = fidl::client::QueryResponseFut<
403 KeyGetKeyProviderResult,
404 fidl::encoding::DefaultFuchsiaResourceDialect,
405 >;
406 fn r#get_key_provider(&self) -> Self::GetKeyProviderResponseFut {
407 fn _decode(
408 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
409 ) -> Result<KeyGetKeyProviderResult, fidl::Error> {
410 let _response = fidl::client::decode_transaction_body::<
411 fidl::encoding::ResultType<KeyGetKeyProviderResponse, Error>,
412 fidl::encoding::DefaultFuchsiaResourceDialect,
413 0x68e2cd7ec0532e0c,
414 >(_buf?)?;
415 Ok(_response.map(|x| x.key_provider))
416 }
417 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, KeyGetKeyProviderResult>(
418 (),
419 0x68e2cd7ec0532e0c,
420 fidl::encoding::DynamicFlags::empty(),
421 _decode,
422 )
423 }
424
425 type SignResponseFut = fidl::client::QueryResponseFut<
426 AsymmetricPrivateKeySignResult,
427 fidl::encoding::DefaultFuchsiaResourceDialect,
428 >;
429 fn r#sign(&self, mut data: fidl_fuchsia_mem::Buffer) -> Self::SignResponseFut {
430 fn _decode(
431 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
432 ) -> Result<AsymmetricPrivateKeySignResult, fidl::Error> {
433 let _response = fidl::client::decode_transaction_body::<
434 fidl::encoding::ResultType<AsymmetricPrivateKeySignResponse, Error>,
435 fidl::encoding::DefaultFuchsiaResourceDialect,
436 0x524ba8b350c2542e,
437 >(_buf?)?;
438 Ok(_response.map(|x| x.signature))
439 }
440 self.client.send_query_and_decode::<
441 AsymmetricPrivateKeySignRequest,
442 AsymmetricPrivateKeySignResult,
443 >(
444 (&mut data,),
445 0x524ba8b350c2542e,
446 fidl::encoding::DynamicFlags::empty(),
447 _decode,
448 )
449 }
450
451 type GetPublicKeyResponseFut = fidl::client::QueryResponseFut<
452 AsymmetricPrivateKeyGetPublicKeyResult,
453 fidl::encoding::DefaultFuchsiaResourceDialect,
454 >;
455 fn r#get_public_key(&self) -> Self::GetPublicKeyResponseFut {
456 fn _decode(
457 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
458 ) -> Result<AsymmetricPrivateKeyGetPublicKeyResult, fidl::Error> {
459 let _response = fidl::client::decode_transaction_body::<
460 fidl::encoding::ResultType<AsymmetricPrivateKeyGetPublicKeyResponse, Error>,
461 fidl::encoding::DefaultFuchsiaResourceDialect,
462 0x5439aff00ed261f3,
463 >(_buf?)?;
464 Ok(_response.map(|x| x.public_key))
465 }
466 self.client.send_query_and_decode::<
467 fidl::encoding::EmptyPayload,
468 AsymmetricPrivateKeyGetPublicKeyResult,
469 >(
470 (),
471 0x5439aff00ed261f3,
472 fidl::encoding::DynamicFlags::empty(),
473 _decode,
474 )
475 }
476
477 type GetKeyAlgorithmResponseFut = fidl::client::QueryResponseFut<
478 AsymmetricPrivateKeyGetKeyAlgorithmResult,
479 fidl::encoding::DefaultFuchsiaResourceDialect,
480 >;
481 fn r#get_key_algorithm(&self) -> Self::GetKeyAlgorithmResponseFut {
482 fn _decode(
483 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
484 ) -> Result<AsymmetricPrivateKeyGetKeyAlgorithmResult, fidl::Error> {
485 let _response = fidl::client::decode_transaction_body::<
486 fidl::encoding::ResultType<AsymmetricPrivateKeyGetKeyAlgorithmResponse, Error>,
487 fidl::encoding::DefaultFuchsiaResourceDialect,
488 0xe0ce6b5b815b1ae,
489 >(_buf?)?;
490 Ok(_response.map(|x| x.key_algorithm))
491 }
492 self.client.send_query_and_decode::<
493 fidl::encoding::EmptyPayload,
494 AsymmetricPrivateKeyGetKeyAlgorithmResult,
495 >(
496 (),
497 0xe0ce6b5b815b1ae,
498 fidl::encoding::DynamicFlags::empty(),
499 _decode,
500 )
501 }
502}
503
504pub struct AsymmetricPrivateKeyEventStream {
505 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
506}
507
508impl std::marker::Unpin for AsymmetricPrivateKeyEventStream {}
509
510impl futures::stream::FusedStream for AsymmetricPrivateKeyEventStream {
511 fn is_terminated(&self) -> bool {
512 self.event_receiver.is_terminated()
513 }
514}
515
516impl futures::Stream for AsymmetricPrivateKeyEventStream {
517 type Item = Result<AsymmetricPrivateKeyEvent, fidl::Error>;
518
519 fn poll_next(
520 mut self: std::pin::Pin<&mut Self>,
521 cx: &mut std::task::Context<'_>,
522 ) -> std::task::Poll<Option<Self::Item>> {
523 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
524 &mut self.event_receiver,
525 cx
526 )?) {
527 Some(buf) => std::task::Poll::Ready(Some(AsymmetricPrivateKeyEvent::decode(buf))),
528 None => std::task::Poll::Ready(None),
529 }
530 }
531}
532
533#[derive(Debug)]
534pub enum AsymmetricPrivateKeyEvent {}
535
536impl AsymmetricPrivateKeyEvent {
537 fn decode(
539 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
540 ) -> Result<AsymmetricPrivateKeyEvent, fidl::Error> {
541 let (bytes, _handles) = buf.split_mut();
542 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
543 debug_assert_eq!(tx_header.tx_id, 0);
544 match tx_header.ordinal {
545 _ => Err(fidl::Error::UnknownOrdinal {
546 ordinal: tx_header.ordinal,
547 protocol_name:
548 <AsymmetricPrivateKeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
549 }),
550 }
551 }
552}
553
554pub struct AsymmetricPrivateKeyRequestStream {
556 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
557 is_terminated: bool,
558}
559
560impl std::marker::Unpin for AsymmetricPrivateKeyRequestStream {}
561
562impl futures::stream::FusedStream for AsymmetricPrivateKeyRequestStream {
563 fn is_terminated(&self) -> bool {
564 self.is_terminated
565 }
566}
567
568impl fidl::endpoints::RequestStream for AsymmetricPrivateKeyRequestStream {
569 type Protocol = AsymmetricPrivateKeyMarker;
570 type ControlHandle = AsymmetricPrivateKeyControlHandle;
571
572 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
573 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
574 }
575
576 fn control_handle(&self) -> Self::ControlHandle {
577 AsymmetricPrivateKeyControlHandle { inner: self.inner.clone() }
578 }
579
580 fn into_inner(
581 self,
582 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
583 {
584 (self.inner, self.is_terminated)
585 }
586
587 fn from_inner(
588 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
589 is_terminated: bool,
590 ) -> Self {
591 Self { inner, is_terminated }
592 }
593}
594
595impl futures::Stream for AsymmetricPrivateKeyRequestStream {
596 type Item = Result<AsymmetricPrivateKeyRequest, fidl::Error>;
597
598 fn poll_next(
599 mut self: std::pin::Pin<&mut Self>,
600 cx: &mut std::task::Context<'_>,
601 ) -> std::task::Poll<Option<Self::Item>> {
602 let this = &mut *self;
603 if this.inner.check_shutdown(cx) {
604 this.is_terminated = true;
605 return std::task::Poll::Ready(None);
606 }
607 if this.is_terminated {
608 panic!("polled AsymmetricPrivateKeyRequestStream after completion");
609 }
610 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
611 |bytes, handles| {
612 match this.inner.channel().read_etc(cx, bytes, handles) {
613 std::task::Poll::Ready(Ok(())) => {}
614 std::task::Poll::Pending => return std::task::Poll::Pending,
615 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
616 this.is_terminated = true;
617 return std::task::Poll::Ready(None);
618 }
619 std::task::Poll::Ready(Err(e)) => {
620 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
621 e.into(),
622 ))))
623 }
624 }
625
626 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
628
629 std::task::Poll::Ready(Some(match header.ordinal {
630 0x3e439554159e7b86 => {
631 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
632 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
633 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
634 let control_handle = AsymmetricPrivateKeyControlHandle {
635 inner: this.inner.clone(),
636 };
637 Ok(AsymmetricPrivateKeyRequest::GetKeyOrigin {
638 responder: AsymmetricPrivateKeyGetKeyOriginResponder {
639 control_handle: std::mem::ManuallyDrop::new(control_handle),
640 tx_id: header.tx_id,
641 },
642 })
643 }
644 0x68e2cd7ec0532e0c => {
645 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
646 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
647 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
648 let control_handle = AsymmetricPrivateKeyControlHandle {
649 inner: this.inner.clone(),
650 };
651 Ok(AsymmetricPrivateKeyRequest::GetKeyProvider {
652 responder: AsymmetricPrivateKeyGetKeyProviderResponder {
653 control_handle: std::mem::ManuallyDrop::new(control_handle),
654 tx_id: header.tx_id,
655 },
656 })
657 }
658 0x524ba8b350c2542e => {
659 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
660 let mut req = fidl::new_empty!(AsymmetricPrivateKeySignRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
661 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AsymmetricPrivateKeySignRequest>(&header, _body_bytes, handles, &mut req)?;
662 let control_handle = AsymmetricPrivateKeyControlHandle {
663 inner: this.inner.clone(),
664 };
665 Ok(AsymmetricPrivateKeyRequest::Sign {data: req.data,
666
667 responder: AsymmetricPrivateKeySignResponder {
668 control_handle: std::mem::ManuallyDrop::new(control_handle),
669 tx_id: header.tx_id,
670 },
671 })
672 }
673 0x5439aff00ed261f3 => {
674 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
675 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
676 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
677 let control_handle = AsymmetricPrivateKeyControlHandle {
678 inner: this.inner.clone(),
679 };
680 Ok(AsymmetricPrivateKeyRequest::GetPublicKey {
681 responder: AsymmetricPrivateKeyGetPublicKeyResponder {
682 control_handle: std::mem::ManuallyDrop::new(control_handle),
683 tx_id: header.tx_id,
684 },
685 })
686 }
687 0xe0ce6b5b815b1ae => {
688 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
689 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
690 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
691 let control_handle = AsymmetricPrivateKeyControlHandle {
692 inner: this.inner.clone(),
693 };
694 Ok(AsymmetricPrivateKeyRequest::GetKeyAlgorithm {
695 responder: AsymmetricPrivateKeyGetKeyAlgorithmResponder {
696 control_handle: std::mem::ManuallyDrop::new(control_handle),
697 tx_id: header.tx_id,
698 },
699 })
700 }
701 _ => Err(fidl::Error::UnknownOrdinal {
702 ordinal: header.ordinal,
703 protocol_name: <AsymmetricPrivateKeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
704 }),
705 }))
706 },
707 )
708 }
709}
710
711#[derive(Debug)]
712pub enum AsymmetricPrivateKeyRequest {
713 GetKeyOrigin { responder: AsymmetricPrivateKeyGetKeyOriginResponder },
715 GetKeyProvider { responder: AsymmetricPrivateKeyGetKeyProviderResponder },
717 Sign { data: fidl_fuchsia_mem::Buffer, responder: AsymmetricPrivateKeySignResponder },
719 GetPublicKey { responder: AsymmetricPrivateKeyGetPublicKeyResponder },
721 GetKeyAlgorithm { responder: AsymmetricPrivateKeyGetKeyAlgorithmResponder },
723}
724
725impl AsymmetricPrivateKeyRequest {
726 #[allow(irrefutable_let_patterns)]
727 pub fn into_get_key_origin(self) -> Option<(AsymmetricPrivateKeyGetKeyOriginResponder)> {
728 if let AsymmetricPrivateKeyRequest::GetKeyOrigin { responder } = self {
729 Some((responder))
730 } else {
731 None
732 }
733 }
734
735 #[allow(irrefutable_let_patterns)]
736 pub fn into_get_key_provider(self) -> Option<(AsymmetricPrivateKeyGetKeyProviderResponder)> {
737 if let AsymmetricPrivateKeyRequest::GetKeyProvider { responder } = self {
738 Some((responder))
739 } else {
740 None
741 }
742 }
743
744 #[allow(irrefutable_let_patterns)]
745 pub fn into_sign(
746 self,
747 ) -> Option<(fidl_fuchsia_mem::Buffer, AsymmetricPrivateKeySignResponder)> {
748 if let AsymmetricPrivateKeyRequest::Sign { data, responder } = self {
749 Some((data, responder))
750 } else {
751 None
752 }
753 }
754
755 #[allow(irrefutable_let_patterns)]
756 pub fn into_get_public_key(self) -> Option<(AsymmetricPrivateKeyGetPublicKeyResponder)> {
757 if let AsymmetricPrivateKeyRequest::GetPublicKey { responder } = self {
758 Some((responder))
759 } else {
760 None
761 }
762 }
763
764 #[allow(irrefutable_let_patterns)]
765 pub fn into_get_key_algorithm(self) -> Option<(AsymmetricPrivateKeyGetKeyAlgorithmResponder)> {
766 if let AsymmetricPrivateKeyRequest::GetKeyAlgorithm { responder } = self {
767 Some((responder))
768 } else {
769 None
770 }
771 }
772
773 pub fn method_name(&self) -> &'static str {
775 match *self {
776 AsymmetricPrivateKeyRequest::GetKeyOrigin { .. } => "get_key_origin",
777 AsymmetricPrivateKeyRequest::GetKeyProvider { .. } => "get_key_provider",
778 AsymmetricPrivateKeyRequest::Sign { .. } => "sign",
779 AsymmetricPrivateKeyRequest::GetPublicKey { .. } => "get_public_key",
780 AsymmetricPrivateKeyRequest::GetKeyAlgorithm { .. } => "get_key_algorithm",
781 }
782 }
783}
784
785#[derive(Debug, Clone)]
786pub struct AsymmetricPrivateKeyControlHandle {
787 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
788}
789
790impl fidl::endpoints::ControlHandle for AsymmetricPrivateKeyControlHandle {
791 fn shutdown(&self) {
792 self.inner.shutdown()
793 }
794 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
795 self.inner.shutdown_with_epitaph(status)
796 }
797
798 fn is_closed(&self) -> bool {
799 self.inner.channel().is_closed()
800 }
801 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
802 self.inner.channel().on_closed()
803 }
804
805 #[cfg(target_os = "fuchsia")]
806 fn signal_peer(
807 &self,
808 clear_mask: zx::Signals,
809 set_mask: zx::Signals,
810 ) -> Result<(), zx_status::Status> {
811 use fidl::Peered;
812 self.inner.channel().signal_peer(clear_mask, set_mask)
813 }
814}
815
816impl AsymmetricPrivateKeyControlHandle {}
817
818#[must_use = "FIDL methods require a response to be sent"]
819#[derive(Debug)]
820pub struct AsymmetricPrivateKeyGetKeyOriginResponder {
821 control_handle: std::mem::ManuallyDrop<AsymmetricPrivateKeyControlHandle>,
822 tx_id: u32,
823}
824
825impl std::ops::Drop for AsymmetricPrivateKeyGetKeyOriginResponder {
829 fn drop(&mut self) {
830 self.control_handle.shutdown();
831 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
833 }
834}
835
836impl fidl::endpoints::Responder for AsymmetricPrivateKeyGetKeyOriginResponder {
837 type ControlHandle = AsymmetricPrivateKeyControlHandle;
838
839 fn control_handle(&self) -> &AsymmetricPrivateKeyControlHandle {
840 &self.control_handle
841 }
842
843 fn drop_without_shutdown(mut self) {
844 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
846 std::mem::forget(self);
848 }
849}
850
851impl AsymmetricPrivateKeyGetKeyOriginResponder {
852 pub fn send(self, mut result: Result<KeyOrigin, Error>) -> Result<(), fidl::Error> {
856 let _result = self.send_raw(result);
857 if _result.is_err() {
858 self.control_handle.shutdown();
859 }
860 self.drop_without_shutdown();
861 _result
862 }
863
864 pub fn send_no_shutdown_on_err(
866 self,
867 mut result: Result<KeyOrigin, Error>,
868 ) -> Result<(), fidl::Error> {
869 let _result = self.send_raw(result);
870 self.drop_without_shutdown();
871 _result
872 }
873
874 fn send_raw(&self, mut result: Result<KeyOrigin, Error>) -> Result<(), fidl::Error> {
875 self.control_handle
876 .inner
877 .send::<fidl::encoding::ResultType<KeyGetKeyOriginResponse, Error>>(
878 result.map(|key_origin| (key_origin,)),
879 self.tx_id,
880 0x3e439554159e7b86,
881 fidl::encoding::DynamicFlags::empty(),
882 )
883 }
884}
885
886#[must_use = "FIDL methods require a response to be sent"]
887#[derive(Debug)]
888pub struct AsymmetricPrivateKeyGetKeyProviderResponder {
889 control_handle: std::mem::ManuallyDrop<AsymmetricPrivateKeyControlHandle>,
890 tx_id: u32,
891}
892
893impl std::ops::Drop for AsymmetricPrivateKeyGetKeyProviderResponder {
897 fn drop(&mut self) {
898 self.control_handle.shutdown();
899 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
901 }
902}
903
904impl fidl::endpoints::Responder for AsymmetricPrivateKeyGetKeyProviderResponder {
905 type ControlHandle = AsymmetricPrivateKeyControlHandle;
906
907 fn control_handle(&self) -> &AsymmetricPrivateKeyControlHandle {
908 &self.control_handle
909 }
910
911 fn drop_without_shutdown(mut self) {
912 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
914 std::mem::forget(self);
916 }
917}
918
919impl AsymmetricPrivateKeyGetKeyProviderResponder {
920 pub fn send(self, mut result: Result<KeyProvider, Error>) -> Result<(), fidl::Error> {
924 let _result = self.send_raw(result);
925 if _result.is_err() {
926 self.control_handle.shutdown();
927 }
928 self.drop_without_shutdown();
929 _result
930 }
931
932 pub fn send_no_shutdown_on_err(
934 self,
935 mut result: Result<KeyProvider, Error>,
936 ) -> Result<(), fidl::Error> {
937 let _result = self.send_raw(result);
938 self.drop_without_shutdown();
939 _result
940 }
941
942 fn send_raw(&self, mut result: Result<KeyProvider, Error>) -> Result<(), fidl::Error> {
943 self.control_handle
944 .inner
945 .send::<fidl::encoding::ResultType<KeyGetKeyProviderResponse, Error>>(
946 result.map(|key_provider| (key_provider,)),
947 self.tx_id,
948 0x68e2cd7ec0532e0c,
949 fidl::encoding::DynamicFlags::empty(),
950 )
951 }
952}
953
954#[must_use = "FIDL methods require a response to be sent"]
955#[derive(Debug)]
956pub struct AsymmetricPrivateKeySignResponder {
957 control_handle: std::mem::ManuallyDrop<AsymmetricPrivateKeyControlHandle>,
958 tx_id: u32,
959}
960
961impl std::ops::Drop for AsymmetricPrivateKeySignResponder {
965 fn drop(&mut self) {
966 self.control_handle.shutdown();
967 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
969 }
970}
971
972impl fidl::endpoints::Responder for AsymmetricPrivateKeySignResponder {
973 type ControlHandle = AsymmetricPrivateKeyControlHandle;
974
975 fn control_handle(&self) -> &AsymmetricPrivateKeyControlHandle {
976 &self.control_handle
977 }
978
979 fn drop_without_shutdown(mut self) {
980 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
982 std::mem::forget(self);
984 }
985}
986
987impl AsymmetricPrivateKeySignResponder {
988 pub fn send(self, mut result: Result<&Signature, Error>) -> Result<(), fidl::Error> {
992 let _result = self.send_raw(result);
993 if _result.is_err() {
994 self.control_handle.shutdown();
995 }
996 self.drop_without_shutdown();
997 _result
998 }
999
1000 pub fn send_no_shutdown_on_err(
1002 self,
1003 mut result: Result<&Signature, Error>,
1004 ) -> Result<(), fidl::Error> {
1005 let _result = self.send_raw(result);
1006 self.drop_without_shutdown();
1007 _result
1008 }
1009
1010 fn send_raw(&self, mut result: Result<&Signature, Error>) -> Result<(), fidl::Error> {
1011 self.control_handle
1012 .inner
1013 .send::<fidl::encoding::ResultType<AsymmetricPrivateKeySignResponse, Error>>(
1014 result.map(|signature| (signature,)),
1015 self.tx_id,
1016 0x524ba8b350c2542e,
1017 fidl::encoding::DynamicFlags::empty(),
1018 )
1019 }
1020}
1021
1022#[must_use = "FIDL methods require a response to be sent"]
1023#[derive(Debug)]
1024pub struct AsymmetricPrivateKeyGetPublicKeyResponder {
1025 control_handle: std::mem::ManuallyDrop<AsymmetricPrivateKeyControlHandle>,
1026 tx_id: u32,
1027}
1028
1029impl std::ops::Drop for AsymmetricPrivateKeyGetPublicKeyResponder {
1033 fn drop(&mut self) {
1034 self.control_handle.shutdown();
1035 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1037 }
1038}
1039
1040impl fidl::endpoints::Responder for AsymmetricPrivateKeyGetPublicKeyResponder {
1041 type ControlHandle = AsymmetricPrivateKeyControlHandle;
1042
1043 fn control_handle(&self) -> &AsymmetricPrivateKeyControlHandle {
1044 &self.control_handle
1045 }
1046
1047 fn drop_without_shutdown(mut self) {
1048 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1050 std::mem::forget(self);
1052 }
1053}
1054
1055impl AsymmetricPrivateKeyGetPublicKeyResponder {
1056 pub fn send(self, mut result: Result<&PublicKey, Error>) -> Result<(), fidl::Error> {
1060 let _result = self.send_raw(result);
1061 if _result.is_err() {
1062 self.control_handle.shutdown();
1063 }
1064 self.drop_without_shutdown();
1065 _result
1066 }
1067
1068 pub fn send_no_shutdown_on_err(
1070 self,
1071 mut result: Result<&PublicKey, Error>,
1072 ) -> Result<(), fidl::Error> {
1073 let _result = self.send_raw(result);
1074 self.drop_without_shutdown();
1075 _result
1076 }
1077
1078 fn send_raw(&self, mut result: Result<&PublicKey, Error>) -> Result<(), fidl::Error> {
1079 self.control_handle.inner.send::<fidl::encoding::ResultType<
1080 AsymmetricPrivateKeyGetPublicKeyResponse,
1081 Error,
1082 >>(
1083 result.map(|public_key| (public_key,)),
1084 self.tx_id,
1085 0x5439aff00ed261f3,
1086 fidl::encoding::DynamicFlags::empty(),
1087 )
1088 }
1089}
1090
1091#[must_use = "FIDL methods require a response to be sent"]
1092#[derive(Debug)]
1093pub struct AsymmetricPrivateKeyGetKeyAlgorithmResponder {
1094 control_handle: std::mem::ManuallyDrop<AsymmetricPrivateKeyControlHandle>,
1095 tx_id: u32,
1096}
1097
1098impl std::ops::Drop for AsymmetricPrivateKeyGetKeyAlgorithmResponder {
1102 fn drop(&mut self) {
1103 self.control_handle.shutdown();
1104 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1106 }
1107}
1108
1109impl fidl::endpoints::Responder for AsymmetricPrivateKeyGetKeyAlgorithmResponder {
1110 type ControlHandle = AsymmetricPrivateKeyControlHandle;
1111
1112 fn control_handle(&self) -> &AsymmetricPrivateKeyControlHandle {
1113 &self.control_handle
1114 }
1115
1116 fn drop_without_shutdown(mut self) {
1117 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1119 std::mem::forget(self);
1121 }
1122}
1123
1124impl AsymmetricPrivateKeyGetKeyAlgorithmResponder {
1125 pub fn send(
1129 self,
1130 mut result: Result<AsymmetricKeyAlgorithm, Error>,
1131 ) -> Result<(), fidl::Error> {
1132 let _result = self.send_raw(result);
1133 if _result.is_err() {
1134 self.control_handle.shutdown();
1135 }
1136 self.drop_without_shutdown();
1137 _result
1138 }
1139
1140 pub fn send_no_shutdown_on_err(
1142 self,
1143 mut result: Result<AsymmetricKeyAlgorithm, Error>,
1144 ) -> Result<(), fidl::Error> {
1145 let _result = self.send_raw(result);
1146 self.drop_without_shutdown();
1147 _result
1148 }
1149
1150 fn send_raw(
1151 &self,
1152 mut result: Result<AsymmetricKeyAlgorithm, Error>,
1153 ) -> Result<(), fidl::Error> {
1154 self.control_handle.inner.send::<fidl::encoding::ResultType<
1155 AsymmetricPrivateKeyGetKeyAlgorithmResponse,
1156 Error,
1157 >>(
1158 result.map(|key_algorithm| (key_algorithm,)),
1159 self.tx_id,
1160 0xe0ce6b5b815b1ae,
1161 fidl::encoding::DynamicFlags::empty(),
1162 )
1163 }
1164}
1165
1166#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1167pub struct KeyMarker;
1168
1169impl fidl::endpoints::ProtocolMarker for KeyMarker {
1170 type Proxy = KeyProxy;
1171 type RequestStream = KeyRequestStream;
1172 #[cfg(target_os = "fuchsia")]
1173 type SynchronousProxy = KeySynchronousProxy;
1174
1175 const DEBUG_NAME: &'static str = "(anonymous) Key";
1176}
1177pub type KeyGetKeyOriginResult = Result<KeyOrigin, Error>;
1178pub type KeyGetKeyProviderResult = Result<KeyProvider, Error>;
1179
1180pub trait KeyProxyInterface: Send + Sync {
1181 type GetKeyOriginResponseFut: std::future::Future<Output = Result<KeyGetKeyOriginResult, fidl::Error>>
1182 + Send;
1183 fn r#get_key_origin(&self) -> Self::GetKeyOriginResponseFut;
1184 type GetKeyProviderResponseFut: std::future::Future<Output = Result<KeyGetKeyProviderResult, fidl::Error>>
1185 + Send;
1186 fn r#get_key_provider(&self) -> Self::GetKeyProviderResponseFut;
1187}
1188#[derive(Debug)]
1189#[cfg(target_os = "fuchsia")]
1190pub struct KeySynchronousProxy {
1191 client: fidl::client::sync::Client,
1192}
1193
1194#[cfg(target_os = "fuchsia")]
1195impl fidl::endpoints::SynchronousProxy for KeySynchronousProxy {
1196 type Proxy = KeyProxy;
1197 type Protocol = KeyMarker;
1198
1199 fn from_channel(inner: fidl::Channel) -> Self {
1200 Self::new(inner)
1201 }
1202
1203 fn into_channel(self) -> fidl::Channel {
1204 self.client.into_channel()
1205 }
1206
1207 fn as_channel(&self) -> &fidl::Channel {
1208 self.client.as_channel()
1209 }
1210}
1211
1212#[cfg(target_os = "fuchsia")]
1213impl KeySynchronousProxy {
1214 pub fn new(channel: fidl::Channel) -> Self {
1215 let protocol_name = <KeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1216 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1217 }
1218
1219 pub fn into_channel(self) -> fidl::Channel {
1220 self.client.into_channel()
1221 }
1222
1223 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<KeyEvent, fidl::Error> {
1226 KeyEvent::decode(self.client.wait_for_event(deadline)?)
1227 }
1228
1229 pub fn r#get_key_origin(
1231 &self,
1232 ___deadline: zx::MonotonicInstant,
1233 ) -> Result<KeyGetKeyOriginResult, fidl::Error> {
1234 let _response = self.client.send_query::<
1235 fidl::encoding::EmptyPayload,
1236 fidl::encoding::ResultType<KeyGetKeyOriginResponse, Error>,
1237 >(
1238 (),
1239 0x3e439554159e7b86,
1240 fidl::encoding::DynamicFlags::empty(),
1241 ___deadline,
1242 )?;
1243 Ok(_response.map(|x| x.key_origin))
1244 }
1245
1246 pub fn r#get_key_provider(
1248 &self,
1249 ___deadline: zx::MonotonicInstant,
1250 ) -> Result<KeyGetKeyProviderResult, fidl::Error> {
1251 let _response = self.client.send_query::<
1252 fidl::encoding::EmptyPayload,
1253 fidl::encoding::ResultType<KeyGetKeyProviderResponse, Error>,
1254 >(
1255 (),
1256 0x68e2cd7ec0532e0c,
1257 fidl::encoding::DynamicFlags::empty(),
1258 ___deadline,
1259 )?;
1260 Ok(_response.map(|x| x.key_provider))
1261 }
1262}
1263
1264#[cfg(target_os = "fuchsia")]
1265impl From<KeySynchronousProxy> for zx::Handle {
1266 fn from(value: KeySynchronousProxy) -> Self {
1267 value.into_channel().into()
1268 }
1269}
1270
1271#[cfg(target_os = "fuchsia")]
1272impl From<fidl::Channel> for KeySynchronousProxy {
1273 fn from(value: fidl::Channel) -> Self {
1274 Self::new(value)
1275 }
1276}
1277
1278#[derive(Debug, Clone)]
1279pub struct KeyProxy {
1280 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1281}
1282
1283impl fidl::endpoints::Proxy for KeyProxy {
1284 type Protocol = KeyMarker;
1285
1286 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1287 Self::new(inner)
1288 }
1289
1290 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1291 self.client.into_channel().map_err(|client| Self { client })
1292 }
1293
1294 fn as_channel(&self) -> &::fidl::AsyncChannel {
1295 self.client.as_channel()
1296 }
1297}
1298
1299impl KeyProxy {
1300 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1302 let protocol_name = <KeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1303 Self { client: fidl::client::Client::new(channel, protocol_name) }
1304 }
1305
1306 pub fn take_event_stream(&self) -> KeyEventStream {
1312 KeyEventStream { event_receiver: self.client.take_event_receiver() }
1313 }
1314
1315 pub fn r#get_key_origin(
1317 &self,
1318 ) -> fidl::client::QueryResponseFut<
1319 KeyGetKeyOriginResult,
1320 fidl::encoding::DefaultFuchsiaResourceDialect,
1321 > {
1322 KeyProxyInterface::r#get_key_origin(self)
1323 }
1324
1325 pub fn r#get_key_provider(
1327 &self,
1328 ) -> fidl::client::QueryResponseFut<
1329 KeyGetKeyProviderResult,
1330 fidl::encoding::DefaultFuchsiaResourceDialect,
1331 > {
1332 KeyProxyInterface::r#get_key_provider(self)
1333 }
1334}
1335
1336impl KeyProxyInterface for KeyProxy {
1337 type GetKeyOriginResponseFut = fidl::client::QueryResponseFut<
1338 KeyGetKeyOriginResult,
1339 fidl::encoding::DefaultFuchsiaResourceDialect,
1340 >;
1341 fn r#get_key_origin(&self) -> Self::GetKeyOriginResponseFut {
1342 fn _decode(
1343 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1344 ) -> Result<KeyGetKeyOriginResult, fidl::Error> {
1345 let _response = fidl::client::decode_transaction_body::<
1346 fidl::encoding::ResultType<KeyGetKeyOriginResponse, Error>,
1347 fidl::encoding::DefaultFuchsiaResourceDialect,
1348 0x3e439554159e7b86,
1349 >(_buf?)?;
1350 Ok(_response.map(|x| x.key_origin))
1351 }
1352 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, KeyGetKeyOriginResult>(
1353 (),
1354 0x3e439554159e7b86,
1355 fidl::encoding::DynamicFlags::empty(),
1356 _decode,
1357 )
1358 }
1359
1360 type GetKeyProviderResponseFut = fidl::client::QueryResponseFut<
1361 KeyGetKeyProviderResult,
1362 fidl::encoding::DefaultFuchsiaResourceDialect,
1363 >;
1364 fn r#get_key_provider(&self) -> Self::GetKeyProviderResponseFut {
1365 fn _decode(
1366 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1367 ) -> Result<KeyGetKeyProviderResult, fidl::Error> {
1368 let _response = fidl::client::decode_transaction_body::<
1369 fidl::encoding::ResultType<KeyGetKeyProviderResponse, Error>,
1370 fidl::encoding::DefaultFuchsiaResourceDialect,
1371 0x68e2cd7ec0532e0c,
1372 >(_buf?)?;
1373 Ok(_response.map(|x| x.key_provider))
1374 }
1375 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, KeyGetKeyProviderResult>(
1376 (),
1377 0x68e2cd7ec0532e0c,
1378 fidl::encoding::DynamicFlags::empty(),
1379 _decode,
1380 )
1381 }
1382}
1383
1384pub struct KeyEventStream {
1385 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1386}
1387
1388impl std::marker::Unpin for KeyEventStream {}
1389
1390impl futures::stream::FusedStream for KeyEventStream {
1391 fn is_terminated(&self) -> bool {
1392 self.event_receiver.is_terminated()
1393 }
1394}
1395
1396impl futures::Stream for KeyEventStream {
1397 type Item = Result<KeyEvent, fidl::Error>;
1398
1399 fn poll_next(
1400 mut self: std::pin::Pin<&mut Self>,
1401 cx: &mut std::task::Context<'_>,
1402 ) -> std::task::Poll<Option<Self::Item>> {
1403 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1404 &mut self.event_receiver,
1405 cx
1406 )?) {
1407 Some(buf) => std::task::Poll::Ready(Some(KeyEvent::decode(buf))),
1408 None => std::task::Poll::Ready(None),
1409 }
1410 }
1411}
1412
1413#[derive(Debug)]
1414pub enum KeyEvent {}
1415
1416impl KeyEvent {
1417 fn decode(
1419 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1420 ) -> Result<KeyEvent, fidl::Error> {
1421 let (bytes, _handles) = buf.split_mut();
1422 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1423 debug_assert_eq!(tx_header.tx_id, 0);
1424 match tx_header.ordinal {
1425 _ => Err(fidl::Error::UnknownOrdinal {
1426 ordinal: tx_header.ordinal,
1427 protocol_name: <KeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1428 }),
1429 }
1430 }
1431}
1432
1433pub struct KeyRequestStream {
1435 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1436 is_terminated: bool,
1437}
1438
1439impl std::marker::Unpin for KeyRequestStream {}
1440
1441impl futures::stream::FusedStream for KeyRequestStream {
1442 fn is_terminated(&self) -> bool {
1443 self.is_terminated
1444 }
1445}
1446
1447impl fidl::endpoints::RequestStream for KeyRequestStream {
1448 type Protocol = KeyMarker;
1449 type ControlHandle = KeyControlHandle;
1450
1451 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1452 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1453 }
1454
1455 fn control_handle(&self) -> Self::ControlHandle {
1456 KeyControlHandle { inner: self.inner.clone() }
1457 }
1458
1459 fn into_inner(
1460 self,
1461 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1462 {
1463 (self.inner, self.is_terminated)
1464 }
1465
1466 fn from_inner(
1467 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1468 is_terminated: bool,
1469 ) -> Self {
1470 Self { inner, is_terminated }
1471 }
1472}
1473
1474impl futures::Stream for KeyRequestStream {
1475 type Item = Result<KeyRequest, fidl::Error>;
1476
1477 fn poll_next(
1478 mut self: std::pin::Pin<&mut Self>,
1479 cx: &mut std::task::Context<'_>,
1480 ) -> std::task::Poll<Option<Self::Item>> {
1481 let this = &mut *self;
1482 if this.inner.check_shutdown(cx) {
1483 this.is_terminated = true;
1484 return std::task::Poll::Ready(None);
1485 }
1486 if this.is_terminated {
1487 panic!("polled KeyRequestStream after completion");
1488 }
1489 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1490 |bytes, handles| {
1491 match this.inner.channel().read_etc(cx, bytes, handles) {
1492 std::task::Poll::Ready(Ok(())) => {}
1493 std::task::Poll::Pending => return std::task::Poll::Pending,
1494 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1495 this.is_terminated = true;
1496 return std::task::Poll::Ready(None);
1497 }
1498 std::task::Poll::Ready(Err(e)) => {
1499 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1500 e.into(),
1501 ))))
1502 }
1503 }
1504
1505 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1507
1508 std::task::Poll::Ready(Some(match header.ordinal {
1509 0x3e439554159e7b86 => {
1510 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1511 let mut req = fidl::new_empty!(
1512 fidl::encoding::EmptyPayload,
1513 fidl::encoding::DefaultFuchsiaResourceDialect
1514 );
1515 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1516 let control_handle = KeyControlHandle { inner: this.inner.clone() };
1517 Ok(KeyRequest::GetKeyOrigin {
1518 responder: KeyGetKeyOriginResponder {
1519 control_handle: std::mem::ManuallyDrop::new(control_handle),
1520 tx_id: header.tx_id,
1521 },
1522 })
1523 }
1524 0x68e2cd7ec0532e0c => {
1525 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1526 let mut req = fidl::new_empty!(
1527 fidl::encoding::EmptyPayload,
1528 fidl::encoding::DefaultFuchsiaResourceDialect
1529 );
1530 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1531 let control_handle = KeyControlHandle { inner: this.inner.clone() };
1532 Ok(KeyRequest::GetKeyProvider {
1533 responder: KeyGetKeyProviderResponder {
1534 control_handle: std::mem::ManuallyDrop::new(control_handle),
1535 tx_id: header.tx_id,
1536 },
1537 })
1538 }
1539 _ => Err(fidl::Error::UnknownOrdinal {
1540 ordinal: header.ordinal,
1541 protocol_name: <KeyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1542 }),
1543 }))
1544 },
1545 )
1546 }
1547}
1548
1549#[derive(Debug)]
1550pub enum KeyRequest {
1551 GetKeyOrigin { responder: KeyGetKeyOriginResponder },
1553 GetKeyProvider { responder: KeyGetKeyProviderResponder },
1555}
1556
1557impl KeyRequest {
1558 #[allow(irrefutable_let_patterns)]
1559 pub fn into_get_key_origin(self) -> Option<(KeyGetKeyOriginResponder)> {
1560 if let KeyRequest::GetKeyOrigin { responder } = self {
1561 Some((responder))
1562 } else {
1563 None
1564 }
1565 }
1566
1567 #[allow(irrefutable_let_patterns)]
1568 pub fn into_get_key_provider(self) -> Option<(KeyGetKeyProviderResponder)> {
1569 if let KeyRequest::GetKeyProvider { responder } = self {
1570 Some((responder))
1571 } else {
1572 None
1573 }
1574 }
1575
1576 pub fn method_name(&self) -> &'static str {
1578 match *self {
1579 KeyRequest::GetKeyOrigin { .. } => "get_key_origin",
1580 KeyRequest::GetKeyProvider { .. } => "get_key_provider",
1581 }
1582 }
1583}
1584
1585#[derive(Debug, Clone)]
1586pub struct KeyControlHandle {
1587 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1588}
1589
1590impl fidl::endpoints::ControlHandle for KeyControlHandle {
1591 fn shutdown(&self) {
1592 self.inner.shutdown()
1593 }
1594 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1595 self.inner.shutdown_with_epitaph(status)
1596 }
1597
1598 fn is_closed(&self) -> bool {
1599 self.inner.channel().is_closed()
1600 }
1601 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1602 self.inner.channel().on_closed()
1603 }
1604
1605 #[cfg(target_os = "fuchsia")]
1606 fn signal_peer(
1607 &self,
1608 clear_mask: zx::Signals,
1609 set_mask: zx::Signals,
1610 ) -> Result<(), zx_status::Status> {
1611 use fidl::Peered;
1612 self.inner.channel().signal_peer(clear_mask, set_mask)
1613 }
1614}
1615
1616impl KeyControlHandle {}
1617
1618#[must_use = "FIDL methods require a response to be sent"]
1619#[derive(Debug)]
1620pub struct KeyGetKeyOriginResponder {
1621 control_handle: std::mem::ManuallyDrop<KeyControlHandle>,
1622 tx_id: u32,
1623}
1624
1625impl std::ops::Drop for KeyGetKeyOriginResponder {
1629 fn drop(&mut self) {
1630 self.control_handle.shutdown();
1631 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1633 }
1634}
1635
1636impl fidl::endpoints::Responder for KeyGetKeyOriginResponder {
1637 type ControlHandle = KeyControlHandle;
1638
1639 fn control_handle(&self) -> &KeyControlHandle {
1640 &self.control_handle
1641 }
1642
1643 fn drop_without_shutdown(mut self) {
1644 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1646 std::mem::forget(self);
1648 }
1649}
1650
1651impl KeyGetKeyOriginResponder {
1652 pub fn send(self, mut result: Result<KeyOrigin, Error>) -> Result<(), fidl::Error> {
1656 let _result = self.send_raw(result);
1657 if _result.is_err() {
1658 self.control_handle.shutdown();
1659 }
1660 self.drop_without_shutdown();
1661 _result
1662 }
1663
1664 pub fn send_no_shutdown_on_err(
1666 self,
1667 mut result: Result<KeyOrigin, Error>,
1668 ) -> Result<(), fidl::Error> {
1669 let _result = self.send_raw(result);
1670 self.drop_without_shutdown();
1671 _result
1672 }
1673
1674 fn send_raw(&self, mut result: Result<KeyOrigin, Error>) -> Result<(), fidl::Error> {
1675 self.control_handle
1676 .inner
1677 .send::<fidl::encoding::ResultType<KeyGetKeyOriginResponse, Error>>(
1678 result.map(|key_origin| (key_origin,)),
1679 self.tx_id,
1680 0x3e439554159e7b86,
1681 fidl::encoding::DynamicFlags::empty(),
1682 )
1683 }
1684}
1685
1686#[must_use = "FIDL methods require a response to be sent"]
1687#[derive(Debug)]
1688pub struct KeyGetKeyProviderResponder {
1689 control_handle: std::mem::ManuallyDrop<KeyControlHandle>,
1690 tx_id: u32,
1691}
1692
1693impl std::ops::Drop for KeyGetKeyProviderResponder {
1697 fn drop(&mut self) {
1698 self.control_handle.shutdown();
1699 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1701 }
1702}
1703
1704impl fidl::endpoints::Responder for KeyGetKeyProviderResponder {
1705 type ControlHandle = KeyControlHandle;
1706
1707 fn control_handle(&self) -> &KeyControlHandle {
1708 &self.control_handle
1709 }
1710
1711 fn drop_without_shutdown(mut self) {
1712 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1714 std::mem::forget(self);
1716 }
1717}
1718
1719impl KeyGetKeyProviderResponder {
1720 pub fn send(self, mut result: Result<KeyProvider, Error>) -> Result<(), fidl::Error> {
1724 let _result = self.send_raw(result);
1725 if _result.is_err() {
1726 self.control_handle.shutdown();
1727 }
1728 self.drop_without_shutdown();
1729 _result
1730 }
1731
1732 pub fn send_no_shutdown_on_err(
1734 self,
1735 mut result: Result<KeyProvider, Error>,
1736 ) -> Result<(), fidl::Error> {
1737 let _result = self.send_raw(result);
1738 self.drop_without_shutdown();
1739 _result
1740 }
1741
1742 fn send_raw(&self, mut result: Result<KeyProvider, Error>) -> Result<(), fidl::Error> {
1743 self.control_handle
1744 .inner
1745 .send::<fidl::encoding::ResultType<KeyGetKeyProviderResponse, Error>>(
1746 result.map(|key_provider| (key_provider,)),
1747 self.tx_id,
1748 0x68e2cd7ec0532e0c,
1749 fidl::encoding::DynamicFlags::empty(),
1750 )
1751 }
1752}
1753
1754#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1755pub struct KeyManagerMarker;
1756
1757impl fidl::endpoints::ProtocolMarker for KeyManagerMarker {
1758 type Proxy = KeyManagerProxy;
1759 type RequestStream = KeyManagerRequestStream;
1760 #[cfg(target_os = "fuchsia")]
1761 type SynchronousProxy = KeyManagerSynchronousProxy;
1762
1763 const DEBUG_NAME: &'static str = "fuchsia.kms.KeyManager";
1764}
1765impl fidl::endpoints::DiscoverableProtocolMarker for KeyManagerMarker {}
1766pub type KeyManagerSealDataResult = Result<fidl_fuchsia_mem::Buffer, Error>;
1767pub type KeyManagerUnsealDataResult = Result<fidl_fuchsia_mem::Buffer, Error>;
1768pub type KeyManagerGenerateAsymmetricKeyResult = Result<(), Error>;
1769pub type KeyManagerGenerateAsymmetricKeyWithAlgorithmResult = Result<(), Error>;
1770pub type KeyManagerImportAsymmetricPrivateKeyResult = Result<(), Error>;
1771pub type KeyManagerGetAsymmetricPrivateKeyResult = Result<(), Error>;
1772pub type KeyManagerDeleteKeyResult = Result<(), Error>;
1773
1774pub trait KeyManagerProxyInterface: Send + Sync {
1775 type SealDataResponseFut: std::future::Future<Output = Result<KeyManagerSealDataResult, fidl::Error>>
1776 + Send;
1777 fn r#seal_data(&self, plain_text: fidl_fuchsia_mem::Buffer) -> Self::SealDataResponseFut;
1778 type UnsealDataResponseFut: std::future::Future<Output = Result<KeyManagerUnsealDataResult, fidl::Error>>
1779 + Send;
1780 fn r#unseal_data(&self, cipher_text: fidl_fuchsia_mem::Buffer) -> Self::UnsealDataResponseFut;
1781 type GenerateAsymmetricKeyResponseFut: std::future::Future<Output = Result<KeyManagerGenerateAsymmetricKeyResult, fidl::Error>>
1782 + Send;
1783 fn r#generate_asymmetric_key(
1784 &self,
1785 key_name: &str,
1786 key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
1787 ) -> Self::GenerateAsymmetricKeyResponseFut;
1788 type GenerateAsymmetricKeyWithAlgorithmResponseFut: std::future::Future<
1789 Output = Result<KeyManagerGenerateAsymmetricKeyWithAlgorithmResult, fidl::Error>,
1790 > + Send;
1791 fn r#generate_asymmetric_key_with_algorithm(
1792 &self,
1793 key_name: &str,
1794 key_algorithm: AsymmetricKeyAlgorithm,
1795 key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
1796 ) -> Self::GenerateAsymmetricKeyWithAlgorithmResponseFut;
1797 type ImportAsymmetricPrivateKeyResponseFut: std::future::Future<
1798 Output = Result<KeyManagerImportAsymmetricPrivateKeyResult, fidl::Error>,
1799 > + Send;
1800 fn r#import_asymmetric_private_key(
1801 &self,
1802 data: &[u8],
1803 key_name: &str,
1804 key_algorithm: AsymmetricKeyAlgorithm,
1805 key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
1806 ) -> Self::ImportAsymmetricPrivateKeyResponseFut;
1807 type GetAsymmetricPrivateKeyResponseFut: std::future::Future<Output = Result<KeyManagerGetAsymmetricPrivateKeyResult, fidl::Error>>
1808 + Send;
1809 fn r#get_asymmetric_private_key(
1810 &self,
1811 key_name: &str,
1812 key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
1813 ) -> Self::GetAsymmetricPrivateKeyResponseFut;
1814 type DeleteKeyResponseFut: std::future::Future<Output = Result<KeyManagerDeleteKeyResult, fidl::Error>>
1815 + Send;
1816 fn r#delete_key(&self, key_name: &str) -> Self::DeleteKeyResponseFut;
1817}
1818#[derive(Debug)]
1819#[cfg(target_os = "fuchsia")]
1820pub struct KeyManagerSynchronousProxy {
1821 client: fidl::client::sync::Client,
1822}
1823
1824#[cfg(target_os = "fuchsia")]
1825impl fidl::endpoints::SynchronousProxy for KeyManagerSynchronousProxy {
1826 type Proxy = KeyManagerProxy;
1827 type Protocol = KeyManagerMarker;
1828
1829 fn from_channel(inner: fidl::Channel) -> Self {
1830 Self::new(inner)
1831 }
1832
1833 fn into_channel(self) -> fidl::Channel {
1834 self.client.into_channel()
1835 }
1836
1837 fn as_channel(&self) -> &fidl::Channel {
1838 self.client.as_channel()
1839 }
1840}
1841
1842#[cfg(target_os = "fuchsia")]
1843impl KeyManagerSynchronousProxy {
1844 pub fn new(channel: fidl::Channel) -> Self {
1845 let protocol_name = <KeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1846 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1847 }
1848
1849 pub fn into_channel(self) -> fidl::Channel {
1850 self.client.into_channel()
1851 }
1852
1853 pub fn wait_for_event(
1856 &self,
1857 deadline: zx::MonotonicInstant,
1858 ) -> Result<KeyManagerEvent, fidl::Error> {
1859 KeyManagerEvent::decode(self.client.wait_for_event(deadline)?)
1860 }
1861
1862 pub fn r#seal_data(
1867 &self,
1868 mut plain_text: fidl_fuchsia_mem::Buffer,
1869 ___deadline: zx::MonotonicInstant,
1870 ) -> Result<KeyManagerSealDataResult, fidl::Error> {
1871 let _response = self.client.send_query::<
1872 KeyManagerSealDataRequest,
1873 fidl::encoding::ResultType<KeyManagerSealDataResponse, Error>,
1874 >(
1875 (&mut plain_text,),
1876 0x3d2fcd85d11c96bb,
1877 fidl::encoding::DynamicFlags::empty(),
1878 ___deadline,
1879 )?;
1880 Ok(_response.map(|x| x.cipher_text))
1881 }
1882
1883 pub fn r#unseal_data(
1887 &self,
1888 mut cipher_text: fidl_fuchsia_mem::Buffer,
1889 ___deadline: zx::MonotonicInstant,
1890 ) -> Result<KeyManagerUnsealDataResult, fidl::Error> {
1891 let _response = self.client.send_query::<
1892 KeyManagerUnsealDataRequest,
1893 fidl::encoding::ResultType<KeyManagerUnsealDataResponse, Error>,
1894 >(
1895 (&mut cipher_text,),
1896 0x72dafc3131c1bca6,
1897 fidl::encoding::DynamicFlags::empty(),
1898 ___deadline,
1899 )?;
1900 Ok(_response.map(|x| x.plain_text))
1901 }
1902
1903 pub fn r#generate_asymmetric_key(
1910 &self,
1911 mut key_name: &str,
1912 mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
1913 ___deadline: zx::MonotonicInstant,
1914 ) -> Result<KeyManagerGenerateAsymmetricKeyResult, fidl::Error> {
1915 let _response = self.client.send_query::<
1916 KeyManagerGenerateAsymmetricKeyRequest,
1917 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1918 >(
1919 (key_name, key,),
1920 0x66f1aa7ff5eb183d,
1921 fidl::encoding::DynamicFlags::empty(),
1922 ___deadline,
1923 )?;
1924 Ok(_response.map(|x| x))
1925 }
1926
1927 pub fn r#generate_asymmetric_key_with_algorithm(
1933 &self,
1934 mut key_name: &str,
1935 mut key_algorithm: AsymmetricKeyAlgorithm,
1936 mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
1937 ___deadline: zx::MonotonicInstant,
1938 ) -> Result<KeyManagerGenerateAsymmetricKeyWithAlgorithmResult, fidl::Error> {
1939 let _response = self.client.send_query::<
1940 KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest,
1941 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1942 >(
1943 (key_name, key_algorithm, key,),
1944 0x2b9eac3ad0bc8a45,
1945 fidl::encoding::DynamicFlags::empty(),
1946 ___deadline,
1947 )?;
1948 Ok(_response.map(|x| x))
1949 }
1950
1951 pub fn r#import_asymmetric_private_key(
1958 &self,
1959 mut data: &[u8],
1960 mut key_name: &str,
1961 mut key_algorithm: AsymmetricKeyAlgorithm,
1962 mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
1963 ___deadline: zx::MonotonicInstant,
1964 ) -> Result<KeyManagerImportAsymmetricPrivateKeyResult, fidl::Error> {
1965 let _response = self.client.send_query::<
1966 KeyManagerImportAsymmetricPrivateKeyRequest,
1967 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1968 >(
1969 (data, key_name, key_algorithm, key,),
1970 0x14c78f1ebb4eee71,
1971 fidl::encoding::DynamicFlags::empty(),
1972 ___deadline,
1973 )?;
1974 Ok(_response.map(|x| x))
1975 }
1976
1977 pub fn r#get_asymmetric_private_key(
1982 &self,
1983 mut key_name: &str,
1984 mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
1985 ___deadline: zx::MonotonicInstant,
1986 ) -> Result<KeyManagerGetAsymmetricPrivateKeyResult, fidl::Error> {
1987 let _response = self.client.send_query::<
1988 KeyManagerGetAsymmetricPrivateKeyRequest,
1989 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1990 >(
1991 (key_name, key,),
1992 0x3a257fc6b6ccc5cd,
1993 fidl::encoding::DynamicFlags::empty(),
1994 ___deadline,
1995 )?;
1996 Ok(_response.map(|x| x))
1997 }
1998
1999 pub fn r#delete_key(
2005 &self,
2006 mut key_name: &str,
2007 ___deadline: zx::MonotonicInstant,
2008 ) -> Result<KeyManagerDeleteKeyResult, fidl::Error> {
2009 let _response = self.client.send_query::<
2010 KeyManagerDeleteKeyRequest,
2011 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2012 >(
2013 (key_name,),
2014 0x55521e617d023aad,
2015 fidl::encoding::DynamicFlags::empty(),
2016 ___deadline,
2017 )?;
2018 Ok(_response.map(|x| x))
2019 }
2020}
2021
2022#[cfg(target_os = "fuchsia")]
2023impl From<KeyManagerSynchronousProxy> for zx::Handle {
2024 fn from(value: KeyManagerSynchronousProxy) -> Self {
2025 value.into_channel().into()
2026 }
2027}
2028
2029#[cfg(target_os = "fuchsia")]
2030impl From<fidl::Channel> for KeyManagerSynchronousProxy {
2031 fn from(value: fidl::Channel) -> Self {
2032 Self::new(value)
2033 }
2034}
2035
2036#[derive(Debug, Clone)]
2037pub struct KeyManagerProxy {
2038 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2039}
2040
2041impl fidl::endpoints::Proxy for KeyManagerProxy {
2042 type Protocol = KeyManagerMarker;
2043
2044 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2045 Self::new(inner)
2046 }
2047
2048 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2049 self.client.into_channel().map_err(|client| Self { client })
2050 }
2051
2052 fn as_channel(&self) -> &::fidl::AsyncChannel {
2053 self.client.as_channel()
2054 }
2055}
2056
2057impl KeyManagerProxy {
2058 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2060 let protocol_name = <KeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2061 Self { client: fidl::client::Client::new(channel, protocol_name) }
2062 }
2063
2064 pub fn take_event_stream(&self) -> KeyManagerEventStream {
2070 KeyManagerEventStream { event_receiver: self.client.take_event_receiver() }
2071 }
2072
2073 pub fn r#seal_data(
2078 &self,
2079 mut plain_text: fidl_fuchsia_mem::Buffer,
2080 ) -> fidl::client::QueryResponseFut<
2081 KeyManagerSealDataResult,
2082 fidl::encoding::DefaultFuchsiaResourceDialect,
2083 > {
2084 KeyManagerProxyInterface::r#seal_data(self, plain_text)
2085 }
2086
2087 pub fn r#unseal_data(
2091 &self,
2092 mut cipher_text: fidl_fuchsia_mem::Buffer,
2093 ) -> fidl::client::QueryResponseFut<
2094 KeyManagerUnsealDataResult,
2095 fidl::encoding::DefaultFuchsiaResourceDialect,
2096 > {
2097 KeyManagerProxyInterface::r#unseal_data(self, cipher_text)
2098 }
2099
2100 pub fn r#generate_asymmetric_key(
2107 &self,
2108 mut key_name: &str,
2109 mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2110 ) -> fidl::client::QueryResponseFut<
2111 KeyManagerGenerateAsymmetricKeyResult,
2112 fidl::encoding::DefaultFuchsiaResourceDialect,
2113 > {
2114 KeyManagerProxyInterface::r#generate_asymmetric_key(self, key_name, key)
2115 }
2116
2117 pub fn r#generate_asymmetric_key_with_algorithm(
2123 &self,
2124 mut key_name: &str,
2125 mut key_algorithm: AsymmetricKeyAlgorithm,
2126 mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2127 ) -> fidl::client::QueryResponseFut<
2128 KeyManagerGenerateAsymmetricKeyWithAlgorithmResult,
2129 fidl::encoding::DefaultFuchsiaResourceDialect,
2130 > {
2131 KeyManagerProxyInterface::r#generate_asymmetric_key_with_algorithm(
2132 self,
2133 key_name,
2134 key_algorithm,
2135 key,
2136 )
2137 }
2138
2139 pub fn r#import_asymmetric_private_key(
2146 &self,
2147 mut data: &[u8],
2148 mut key_name: &str,
2149 mut key_algorithm: AsymmetricKeyAlgorithm,
2150 mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2151 ) -> fidl::client::QueryResponseFut<
2152 KeyManagerImportAsymmetricPrivateKeyResult,
2153 fidl::encoding::DefaultFuchsiaResourceDialect,
2154 > {
2155 KeyManagerProxyInterface::r#import_asymmetric_private_key(
2156 self,
2157 data,
2158 key_name,
2159 key_algorithm,
2160 key,
2161 )
2162 }
2163
2164 pub fn r#get_asymmetric_private_key(
2169 &self,
2170 mut key_name: &str,
2171 mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2172 ) -> fidl::client::QueryResponseFut<
2173 KeyManagerGetAsymmetricPrivateKeyResult,
2174 fidl::encoding::DefaultFuchsiaResourceDialect,
2175 > {
2176 KeyManagerProxyInterface::r#get_asymmetric_private_key(self, key_name, key)
2177 }
2178
2179 pub fn r#delete_key(
2185 &self,
2186 mut key_name: &str,
2187 ) -> fidl::client::QueryResponseFut<
2188 KeyManagerDeleteKeyResult,
2189 fidl::encoding::DefaultFuchsiaResourceDialect,
2190 > {
2191 KeyManagerProxyInterface::r#delete_key(self, key_name)
2192 }
2193}
2194
2195impl KeyManagerProxyInterface for KeyManagerProxy {
2196 type SealDataResponseFut = fidl::client::QueryResponseFut<
2197 KeyManagerSealDataResult,
2198 fidl::encoding::DefaultFuchsiaResourceDialect,
2199 >;
2200 fn r#seal_data(&self, mut plain_text: fidl_fuchsia_mem::Buffer) -> Self::SealDataResponseFut {
2201 fn _decode(
2202 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2203 ) -> Result<KeyManagerSealDataResult, fidl::Error> {
2204 let _response = fidl::client::decode_transaction_body::<
2205 fidl::encoding::ResultType<KeyManagerSealDataResponse, Error>,
2206 fidl::encoding::DefaultFuchsiaResourceDialect,
2207 0x3d2fcd85d11c96bb,
2208 >(_buf?)?;
2209 Ok(_response.map(|x| x.cipher_text))
2210 }
2211 self.client.send_query_and_decode::<KeyManagerSealDataRequest, KeyManagerSealDataResult>(
2212 (&mut plain_text,),
2213 0x3d2fcd85d11c96bb,
2214 fidl::encoding::DynamicFlags::empty(),
2215 _decode,
2216 )
2217 }
2218
2219 type UnsealDataResponseFut = fidl::client::QueryResponseFut<
2220 KeyManagerUnsealDataResult,
2221 fidl::encoding::DefaultFuchsiaResourceDialect,
2222 >;
2223 fn r#unseal_data(
2224 &self,
2225 mut cipher_text: fidl_fuchsia_mem::Buffer,
2226 ) -> Self::UnsealDataResponseFut {
2227 fn _decode(
2228 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2229 ) -> Result<KeyManagerUnsealDataResult, fidl::Error> {
2230 let _response = fidl::client::decode_transaction_body::<
2231 fidl::encoding::ResultType<KeyManagerUnsealDataResponse, Error>,
2232 fidl::encoding::DefaultFuchsiaResourceDialect,
2233 0x72dafc3131c1bca6,
2234 >(_buf?)?;
2235 Ok(_response.map(|x| x.plain_text))
2236 }
2237 self.client
2238 .send_query_and_decode::<KeyManagerUnsealDataRequest, KeyManagerUnsealDataResult>(
2239 (&mut cipher_text,),
2240 0x72dafc3131c1bca6,
2241 fidl::encoding::DynamicFlags::empty(),
2242 _decode,
2243 )
2244 }
2245
2246 type GenerateAsymmetricKeyResponseFut = fidl::client::QueryResponseFut<
2247 KeyManagerGenerateAsymmetricKeyResult,
2248 fidl::encoding::DefaultFuchsiaResourceDialect,
2249 >;
2250 fn r#generate_asymmetric_key(
2251 &self,
2252 mut key_name: &str,
2253 mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2254 ) -> Self::GenerateAsymmetricKeyResponseFut {
2255 fn _decode(
2256 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2257 ) -> Result<KeyManagerGenerateAsymmetricKeyResult, fidl::Error> {
2258 let _response = fidl::client::decode_transaction_body::<
2259 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2260 fidl::encoding::DefaultFuchsiaResourceDialect,
2261 0x66f1aa7ff5eb183d,
2262 >(_buf?)?;
2263 Ok(_response.map(|x| x))
2264 }
2265 self.client.send_query_and_decode::<
2266 KeyManagerGenerateAsymmetricKeyRequest,
2267 KeyManagerGenerateAsymmetricKeyResult,
2268 >(
2269 (key_name, key,),
2270 0x66f1aa7ff5eb183d,
2271 fidl::encoding::DynamicFlags::empty(),
2272 _decode,
2273 )
2274 }
2275
2276 type GenerateAsymmetricKeyWithAlgorithmResponseFut = fidl::client::QueryResponseFut<
2277 KeyManagerGenerateAsymmetricKeyWithAlgorithmResult,
2278 fidl::encoding::DefaultFuchsiaResourceDialect,
2279 >;
2280 fn r#generate_asymmetric_key_with_algorithm(
2281 &self,
2282 mut key_name: &str,
2283 mut key_algorithm: AsymmetricKeyAlgorithm,
2284 mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2285 ) -> Self::GenerateAsymmetricKeyWithAlgorithmResponseFut {
2286 fn _decode(
2287 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2288 ) -> Result<KeyManagerGenerateAsymmetricKeyWithAlgorithmResult, fidl::Error> {
2289 let _response = fidl::client::decode_transaction_body::<
2290 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2291 fidl::encoding::DefaultFuchsiaResourceDialect,
2292 0x2b9eac3ad0bc8a45,
2293 >(_buf?)?;
2294 Ok(_response.map(|x| x))
2295 }
2296 self.client.send_query_and_decode::<
2297 KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest,
2298 KeyManagerGenerateAsymmetricKeyWithAlgorithmResult,
2299 >(
2300 (key_name, key_algorithm, key,),
2301 0x2b9eac3ad0bc8a45,
2302 fidl::encoding::DynamicFlags::empty(),
2303 _decode,
2304 )
2305 }
2306
2307 type ImportAsymmetricPrivateKeyResponseFut = fidl::client::QueryResponseFut<
2308 KeyManagerImportAsymmetricPrivateKeyResult,
2309 fidl::encoding::DefaultFuchsiaResourceDialect,
2310 >;
2311 fn r#import_asymmetric_private_key(
2312 &self,
2313 mut data: &[u8],
2314 mut key_name: &str,
2315 mut key_algorithm: AsymmetricKeyAlgorithm,
2316 mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2317 ) -> Self::ImportAsymmetricPrivateKeyResponseFut {
2318 fn _decode(
2319 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2320 ) -> Result<KeyManagerImportAsymmetricPrivateKeyResult, fidl::Error> {
2321 let _response = fidl::client::decode_transaction_body::<
2322 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2323 fidl::encoding::DefaultFuchsiaResourceDialect,
2324 0x14c78f1ebb4eee71,
2325 >(_buf?)?;
2326 Ok(_response.map(|x| x))
2327 }
2328 self.client.send_query_and_decode::<
2329 KeyManagerImportAsymmetricPrivateKeyRequest,
2330 KeyManagerImportAsymmetricPrivateKeyResult,
2331 >(
2332 (data, key_name, key_algorithm, key,),
2333 0x14c78f1ebb4eee71,
2334 fidl::encoding::DynamicFlags::empty(),
2335 _decode,
2336 )
2337 }
2338
2339 type GetAsymmetricPrivateKeyResponseFut = fidl::client::QueryResponseFut<
2340 KeyManagerGetAsymmetricPrivateKeyResult,
2341 fidl::encoding::DefaultFuchsiaResourceDialect,
2342 >;
2343 fn r#get_asymmetric_private_key(
2344 &self,
2345 mut key_name: &str,
2346 mut key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2347 ) -> Self::GetAsymmetricPrivateKeyResponseFut {
2348 fn _decode(
2349 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2350 ) -> Result<KeyManagerGetAsymmetricPrivateKeyResult, fidl::Error> {
2351 let _response = fidl::client::decode_transaction_body::<
2352 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2353 fidl::encoding::DefaultFuchsiaResourceDialect,
2354 0x3a257fc6b6ccc5cd,
2355 >(_buf?)?;
2356 Ok(_response.map(|x| x))
2357 }
2358 self.client.send_query_and_decode::<
2359 KeyManagerGetAsymmetricPrivateKeyRequest,
2360 KeyManagerGetAsymmetricPrivateKeyResult,
2361 >(
2362 (key_name, key,),
2363 0x3a257fc6b6ccc5cd,
2364 fidl::encoding::DynamicFlags::empty(),
2365 _decode,
2366 )
2367 }
2368
2369 type DeleteKeyResponseFut = fidl::client::QueryResponseFut<
2370 KeyManagerDeleteKeyResult,
2371 fidl::encoding::DefaultFuchsiaResourceDialect,
2372 >;
2373 fn r#delete_key(&self, mut key_name: &str) -> Self::DeleteKeyResponseFut {
2374 fn _decode(
2375 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2376 ) -> Result<KeyManagerDeleteKeyResult, fidl::Error> {
2377 let _response = fidl::client::decode_transaction_body::<
2378 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2379 fidl::encoding::DefaultFuchsiaResourceDialect,
2380 0x55521e617d023aad,
2381 >(_buf?)?;
2382 Ok(_response.map(|x| x))
2383 }
2384 self.client.send_query_and_decode::<KeyManagerDeleteKeyRequest, KeyManagerDeleteKeyResult>(
2385 (key_name,),
2386 0x55521e617d023aad,
2387 fidl::encoding::DynamicFlags::empty(),
2388 _decode,
2389 )
2390 }
2391}
2392
2393pub struct KeyManagerEventStream {
2394 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2395}
2396
2397impl std::marker::Unpin for KeyManagerEventStream {}
2398
2399impl futures::stream::FusedStream for KeyManagerEventStream {
2400 fn is_terminated(&self) -> bool {
2401 self.event_receiver.is_terminated()
2402 }
2403}
2404
2405impl futures::Stream for KeyManagerEventStream {
2406 type Item = Result<KeyManagerEvent, fidl::Error>;
2407
2408 fn poll_next(
2409 mut self: std::pin::Pin<&mut Self>,
2410 cx: &mut std::task::Context<'_>,
2411 ) -> std::task::Poll<Option<Self::Item>> {
2412 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2413 &mut self.event_receiver,
2414 cx
2415 )?) {
2416 Some(buf) => std::task::Poll::Ready(Some(KeyManagerEvent::decode(buf))),
2417 None => std::task::Poll::Ready(None),
2418 }
2419 }
2420}
2421
2422#[derive(Debug)]
2423pub enum KeyManagerEvent {}
2424
2425impl KeyManagerEvent {
2426 fn decode(
2428 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2429 ) -> Result<KeyManagerEvent, fidl::Error> {
2430 let (bytes, _handles) = buf.split_mut();
2431 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2432 debug_assert_eq!(tx_header.tx_id, 0);
2433 match tx_header.ordinal {
2434 _ => Err(fidl::Error::UnknownOrdinal {
2435 ordinal: tx_header.ordinal,
2436 protocol_name: <KeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2437 }),
2438 }
2439 }
2440}
2441
2442pub struct KeyManagerRequestStream {
2444 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2445 is_terminated: bool,
2446}
2447
2448impl std::marker::Unpin for KeyManagerRequestStream {}
2449
2450impl futures::stream::FusedStream for KeyManagerRequestStream {
2451 fn is_terminated(&self) -> bool {
2452 self.is_terminated
2453 }
2454}
2455
2456impl fidl::endpoints::RequestStream for KeyManagerRequestStream {
2457 type Protocol = KeyManagerMarker;
2458 type ControlHandle = KeyManagerControlHandle;
2459
2460 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2461 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2462 }
2463
2464 fn control_handle(&self) -> Self::ControlHandle {
2465 KeyManagerControlHandle { inner: self.inner.clone() }
2466 }
2467
2468 fn into_inner(
2469 self,
2470 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2471 {
2472 (self.inner, self.is_terminated)
2473 }
2474
2475 fn from_inner(
2476 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2477 is_terminated: bool,
2478 ) -> Self {
2479 Self { inner, is_terminated }
2480 }
2481}
2482
2483impl futures::Stream for KeyManagerRequestStream {
2484 type Item = Result<KeyManagerRequest, fidl::Error>;
2485
2486 fn poll_next(
2487 mut self: std::pin::Pin<&mut Self>,
2488 cx: &mut std::task::Context<'_>,
2489 ) -> std::task::Poll<Option<Self::Item>> {
2490 let this = &mut *self;
2491 if this.inner.check_shutdown(cx) {
2492 this.is_terminated = true;
2493 return std::task::Poll::Ready(None);
2494 }
2495 if this.is_terminated {
2496 panic!("polled KeyManagerRequestStream after completion");
2497 }
2498 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2499 |bytes, handles| {
2500 match this.inner.channel().read_etc(cx, bytes, handles) {
2501 std::task::Poll::Ready(Ok(())) => {}
2502 std::task::Poll::Pending => return std::task::Poll::Pending,
2503 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2504 this.is_terminated = true;
2505 return std::task::Poll::Ready(None);
2506 }
2507 std::task::Poll::Ready(Err(e)) => {
2508 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2509 e.into(),
2510 ))))
2511 }
2512 }
2513
2514 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2516
2517 std::task::Poll::Ready(Some(match header.ordinal {
2518 0x3d2fcd85d11c96bb => {
2519 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2520 let mut req = fidl::new_empty!(
2521 KeyManagerSealDataRequest,
2522 fidl::encoding::DefaultFuchsiaResourceDialect
2523 );
2524 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerSealDataRequest>(&header, _body_bytes, handles, &mut req)?;
2525 let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
2526 Ok(KeyManagerRequest::SealData {
2527 plain_text: req.plain_text,
2528
2529 responder: KeyManagerSealDataResponder {
2530 control_handle: std::mem::ManuallyDrop::new(control_handle),
2531 tx_id: header.tx_id,
2532 },
2533 })
2534 }
2535 0x72dafc3131c1bca6 => {
2536 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2537 let mut req = fidl::new_empty!(
2538 KeyManagerUnsealDataRequest,
2539 fidl::encoding::DefaultFuchsiaResourceDialect
2540 );
2541 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerUnsealDataRequest>(&header, _body_bytes, handles, &mut req)?;
2542 let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
2543 Ok(KeyManagerRequest::UnsealData {
2544 cipher_text: req.cipher_text,
2545
2546 responder: KeyManagerUnsealDataResponder {
2547 control_handle: std::mem::ManuallyDrop::new(control_handle),
2548 tx_id: header.tx_id,
2549 },
2550 })
2551 }
2552 0x66f1aa7ff5eb183d => {
2553 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2554 let mut req = fidl::new_empty!(
2555 KeyManagerGenerateAsymmetricKeyRequest,
2556 fidl::encoding::DefaultFuchsiaResourceDialect
2557 );
2558 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerGenerateAsymmetricKeyRequest>(&header, _body_bytes, handles, &mut req)?;
2559 let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
2560 Ok(KeyManagerRequest::GenerateAsymmetricKey {
2561 key_name: req.key_name,
2562 key: req.key,
2563
2564 responder: KeyManagerGenerateAsymmetricKeyResponder {
2565 control_handle: std::mem::ManuallyDrop::new(control_handle),
2566 tx_id: header.tx_id,
2567 },
2568 })
2569 }
2570 0x2b9eac3ad0bc8a45 => {
2571 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2572 let mut req = fidl::new_empty!(
2573 KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest,
2574 fidl::encoding::DefaultFuchsiaResourceDialect
2575 );
2576 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest>(&header, _body_bytes, handles, &mut req)?;
2577 let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
2578 Ok(KeyManagerRequest::GenerateAsymmetricKeyWithAlgorithm {
2579 key_name: req.key_name,
2580 key_algorithm: req.key_algorithm,
2581 key: req.key,
2582
2583 responder: KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder {
2584 control_handle: std::mem::ManuallyDrop::new(control_handle),
2585 tx_id: header.tx_id,
2586 },
2587 })
2588 }
2589 0x14c78f1ebb4eee71 => {
2590 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2591 let mut req = fidl::new_empty!(
2592 KeyManagerImportAsymmetricPrivateKeyRequest,
2593 fidl::encoding::DefaultFuchsiaResourceDialect
2594 );
2595 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerImportAsymmetricPrivateKeyRequest>(&header, _body_bytes, handles, &mut req)?;
2596 let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
2597 Ok(KeyManagerRequest::ImportAsymmetricPrivateKey {
2598 data: req.data,
2599 key_name: req.key_name,
2600 key_algorithm: req.key_algorithm,
2601 key: req.key,
2602
2603 responder: KeyManagerImportAsymmetricPrivateKeyResponder {
2604 control_handle: std::mem::ManuallyDrop::new(control_handle),
2605 tx_id: header.tx_id,
2606 },
2607 })
2608 }
2609 0x3a257fc6b6ccc5cd => {
2610 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2611 let mut req = fidl::new_empty!(
2612 KeyManagerGetAsymmetricPrivateKeyRequest,
2613 fidl::encoding::DefaultFuchsiaResourceDialect
2614 );
2615 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerGetAsymmetricPrivateKeyRequest>(&header, _body_bytes, handles, &mut req)?;
2616 let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
2617 Ok(KeyManagerRequest::GetAsymmetricPrivateKey {
2618 key_name: req.key_name,
2619 key: req.key,
2620
2621 responder: KeyManagerGetAsymmetricPrivateKeyResponder {
2622 control_handle: std::mem::ManuallyDrop::new(control_handle),
2623 tx_id: header.tx_id,
2624 },
2625 })
2626 }
2627 0x55521e617d023aad => {
2628 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2629 let mut req = fidl::new_empty!(
2630 KeyManagerDeleteKeyRequest,
2631 fidl::encoding::DefaultFuchsiaResourceDialect
2632 );
2633 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyManagerDeleteKeyRequest>(&header, _body_bytes, handles, &mut req)?;
2634 let control_handle = KeyManagerControlHandle { inner: this.inner.clone() };
2635 Ok(KeyManagerRequest::DeleteKey {
2636 key_name: req.key_name,
2637
2638 responder: KeyManagerDeleteKeyResponder {
2639 control_handle: std::mem::ManuallyDrop::new(control_handle),
2640 tx_id: header.tx_id,
2641 },
2642 })
2643 }
2644 _ => Err(fidl::Error::UnknownOrdinal {
2645 ordinal: header.ordinal,
2646 protocol_name:
2647 <KeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2648 }),
2649 }))
2650 },
2651 )
2652 }
2653}
2654
2655#[derive(Debug)]
2656pub enum KeyManagerRequest {
2657 SealData { plain_text: fidl_fuchsia_mem::Buffer, responder: KeyManagerSealDataResponder },
2662 UnsealData { cipher_text: fidl_fuchsia_mem::Buffer, responder: KeyManagerUnsealDataResponder },
2666 GenerateAsymmetricKey {
2673 key_name: String,
2674 key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2675 responder: KeyManagerGenerateAsymmetricKeyResponder,
2676 },
2677 GenerateAsymmetricKeyWithAlgorithm {
2683 key_name: String,
2684 key_algorithm: AsymmetricKeyAlgorithm,
2685 key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2686 responder: KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder,
2687 },
2688 ImportAsymmetricPrivateKey {
2695 data: Vec<u8>,
2696 key_name: String,
2697 key_algorithm: AsymmetricKeyAlgorithm,
2698 key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2699 responder: KeyManagerImportAsymmetricPrivateKeyResponder,
2700 },
2701 GetAsymmetricPrivateKey {
2706 key_name: String,
2707 key: fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2708 responder: KeyManagerGetAsymmetricPrivateKeyResponder,
2709 },
2710 DeleteKey { key_name: String, responder: KeyManagerDeleteKeyResponder },
2716}
2717
2718impl KeyManagerRequest {
2719 #[allow(irrefutable_let_patterns)]
2720 pub fn into_seal_data(self) -> Option<(fidl_fuchsia_mem::Buffer, KeyManagerSealDataResponder)> {
2721 if let KeyManagerRequest::SealData { plain_text, responder } = self {
2722 Some((plain_text, responder))
2723 } else {
2724 None
2725 }
2726 }
2727
2728 #[allow(irrefutable_let_patterns)]
2729 pub fn into_unseal_data(
2730 self,
2731 ) -> Option<(fidl_fuchsia_mem::Buffer, KeyManagerUnsealDataResponder)> {
2732 if let KeyManagerRequest::UnsealData { cipher_text, responder } = self {
2733 Some((cipher_text, responder))
2734 } else {
2735 None
2736 }
2737 }
2738
2739 #[allow(irrefutable_let_patterns)]
2740 pub fn into_generate_asymmetric_key(
2741 self,
2742 ) -> Option<(
2743 String,
2744 fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2745 KeyManagerGenerateAsymmetricKeyResponder,
2746 )> {
2747 if let KeyManagerRequest::GenerateAsymmetricKey { key_name, key, responder } = self {
2748 Some((key_name, key, responder))
2749 } else {
2750 None
2751 }
2752 }
2753
2754 #[allow(irrefutable_let_patterns)]
2755 pub fn into_generate_asymmetric_key_with_algorithm(
2756 self,
2757 ) -> Option<(
2758 String,
2759 AsymmetricKeyAlgorithm,
2760 fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2761 KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder,
2762 )> {
2763 if let KeyManagerRequest::GenerateAsymmetricKeyWithAlgorithm {
2764 key_name,
2765 key_algorithm,
2766 key,
2767 responder,
2768 } = self
2769 {
2770 Some((key_name, key_algorithm, key, responder))
2771 } else {
2772 None
2773 }
2774 }
2775
2776 #[allow(irrefutable_let_patterns)]
2777 pub fn into_import_asymmetric_private_key(
2778 self,
2779 ) -> Option<(
2780 Vec<u8>,
2781 String,
2782 AsymmetricKeyAlgorithm,
2783 fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2784 KeyManagerImportAsymmetricPrivateKeyResponder,
2785 )> {
2786 if let KeyManagerRequest::ImportAsymmetricPrivateKey {
2787 data,
2788 key_name,
2789 key_algorithm,
2790 key,
2791 responder,
2792 } = self
2793 {
2794 Some((data, key_name, key_algorithm, key, responder))
2795 } else {
2796 None
2797 }
2798 }
2799
2800 #[allow(irrefutable_let_patterns)]
2801 pub fn into_get_asymmetric_private_key(
2802 self,
2803 ) -> Option<(
2804 String,
2805 fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
2806 KeyManagerGetAsymmetricPrivateKeyResponder,
2807 )> {
2808 if let KeyManagerRequest::GetAsymmetricPrivateKey { key_name, key, responder } = self {
2809 Some((key_name, key, responder))
2810 } else {
2811 None
2812 }
2813 }
2814
2815 #[allow(irrefutable_let_patterns)]
2816 pub fn into_delete_key(self) -> Option<(String, KeyManagerDeleteKeyResponder)> {
2817 if let KeyManagerRequest::DeleteKey { key_name, responder } = self {
2818 Some((key_name, responder))
2819 } else {
2820 None
2821 }
2822 }
2823
2824 pub fn method_name(&self) -> &'static str {
2826 match *self {
2827 KeyManagerRequest::SealData { .. } => "seal_data",
2828 KeyManagerRequest::UnsealData { .. } => "unseal_data",
2829 KeyManagerRequest::GenerateAsymmetricKey { .. } => "generate_asymmetric_key",
2830 KeyManagerRequest::GenerateAsymmetricKeyWithAlgorithm { .. } => {
2831 "generate_asymmetric_key_with_algorithm"
2832 }
2833 KeyManagerRequest::ImportAsymmetricPrivateKey { .. } => "import_asymmetric_private_key",
2834 KeyManagerRequest::GetAsymmetricPrivateKey { .. } => "get_asymmetric_private_key",
2835 KeyManagerRequest::DeleteKey { .. } => "delete_key",
2836 }
2837 }
2838}
2839
2840#[derive(Debug, Clone)]
2841pub struct KeyManagerControlHandle {
2842 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2843}
2844
2845impl fidl::endpoints::ControlHandle for KeyManagerControlHandle {
2846 fn shutdown(&self) {
2847 self.inner.shutdown()
2848 }
2849 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2850 self.inner.shutdown_with_epitaph(status)
2851 }
2852
2853 fn is_closed(&self) -> bool {
2854 self.inner.channel().is_closed()
2855 }
2856 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2857 self.inner.channel().on_closed()
2858 }
2859
2860 #[cfg(target_os = "fuchsia")]
2861 fn signal_peer(
2862 &self,
2863 clear_mask: zx::Signals,
2864 set_mask: zx::Signals,
2865 ) -> Result<(), zx_status::Status> {
2866 use fidl::Peered;
2867 self.inner.channel().signal_peer(clear_mask, set_mask)
2868 }
2869}
2870
2871impl KeyManagerControlHandle {}
2872
2873#[must_use = "FIDL methods require a response to be sent"]
2874#[derive(Debug)]
2875pub struct KeyManagerSealDataResponder {
2876 control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
2877 tx_id: u32,
2878}
2879
2880impl std::ops::Drop for KeyManagerSealDataResponder {
2884 fn drop(&mut self) {
2885 self.control_handle.shutdown();
2886 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2888 }
2889}
2890
2891impl fidl::endpoints::Responder for KeyManagerSealDataResponder {
2892 type ControlHandle = KeyManagerControlHandle;
2893
2894 fn control_handle(&self) -> &KeyManagerControlHandle {
2895 &self.control_handle
2896 }
2897
2898 fn drop_without_shutdown(mut self) {
2899 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2901 std::mem::forget(self);
2903 }
2904}
2905
2906impl KeyManagerSealDataResponder {
2907 pub fn send(
2911 self,
2912 mut result: Result<fidl_fuchsia_mem::Buffer, Error>,
2913 ) -> Result<(), fidl::Error> {
2914 let _result = self.send_raw(result);
2915 if _result.is_err() {
2916 self.control_handle.shutdown();
2917 }
2918 self.drop_without_shutdown();
2919 _result
2920 }
2921
2922 pub fn send_no_shutdown_on_err(
2924 self,
2925 mut result: Result<fidl_fuchsia_mem::Buffer, Error>,
2926 ) -> Result<(), fidl::Error> {
2927 let _result = self.send_raw(result);
2928 self.drop_without_shutdown();
2929 _result
2930 }
2931
2932 fn send_raw(
2933 &self,
2934 mut result: Result<fidl_fuchsia_mem::Buffer, Error>,
2935 ) -> Result<(), fidl::Error> {
2936 self.control_handle
2937 .inner
2938 .send::<fidl::encoding::ResultType<KeyManagerSealDataResponse, Error>>(
2939 result.as_mut().map_err(|e| *e).map(|cipher_text| (cipher_text,)),
2940 self.tx_id,
2941 0x3d2fcd85d11c96bb,
2942 fidl::encoding::DynamicFlags::empty(),
2943 )
2944 }
2945}
2946
2947#[must_use = "FIDL methods require a response to be sent"]
2948#[derive(Debug)]
2949pub struct KeyManagerUnsealDataResponder {
2950 control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
2951 tx_id: u32,
2952}
2953
2954impl std::ops::Drop for KeyManagerUnsealDataResponder {
2958 fn drop(&mut self) {
2959 self.control_handle.shutdown();
2960 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2962 }
2963}
2964
2965impl fidl::endpoints::Responder for KeyManagerUnsealDataResponder {
2966 type ControlHandle = KeyManagerControlHandle;
2967
2968 fn control_handle(&self) -> &KeyManagerControlHandle {
2969 &self.control_handle
2970 }
2971
2972 fn drop_without_shutdown(mut self) {
2973 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2975 std::mem::forget(self);
2977 }
2978}
2979
2980impl KeyManagerUnsealDataResponder {
2981 pub fn send(
2985 self,
2986 mut result: Result<fidl_fuchsia_mem::Buffer, Error>,
2987 ) -> Result<(), fidl::Error> {
2988 let _result = self.send_raw(result);
2989 if _result.is_err() {
2990 self.control_handle.shutdown();
2991 }
2992 self.drop_without_shutdown();
2993 _result
2994 }
2995
2996 pub fn send_no_shutdown_on_err(
2998 self,
2999 mut result: Result<fidl_fuchsia_mem::Buffer, Error>,
3000 ) -> Result<(), fidl::Error> {
3001 let _result = self.send_raw(result);
3002 self.drop_without_shutdown();
3003 _result
3004 }
3005
3006 fn send_raw(
3007 &self,
3008 mut result: Result<fidl_fuchsia_mem::Buffer, Error>,
3009 ) -> Result<(), fidl::Error> {
3010 self.control_handle
3011 .inner
3012 .send::<fidl::encoding::ResultType<KeyManagerUnsealDataResponse, Error>>(
3013 result.as_mut().map_err(|e| *e).map(|plain_text| (plain_text,)),
3014 self.tx_id,
3015 0x72dafc3131c1bca6,
3016 fidl::encoding::DynamicFlags::empty(),
3017 )
3018 }
3019}
3020
3021#[must_use = "FIDL methods require a response to be sent"]
3022#[derive(Debug)]
3023pub struct KeyManagerGenerateAsymmetricKeyResponder {
3024 control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
3025 tx_id: u32,
3026}
3027
3028impl std::ops::Drop for KeyManagerGenerateAsymmetricKeyResponder {
3032 fn drop(&mut self) {
3033 self.control_handle.shutdown();
3034 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3036 }
3037}
3038
3039impl fidl::endpoints::Responder for KeyManagerGenerateAsymmetricKeyResponder {
3040 type ControlHandle = KeyManagerControlHandle;
3041
3042 fn control_handle(&self) -> &KeyManagerControlHandle {
3043 &self.control_handle
3044 }
3045
3046 fn drop_without_shutdown(mut self) {
3047 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3049 std::mem::forget(self);
3051 }
3052}
3053
3054impl KeyManagerGenerateAsymmetricKeyResponder {
3055 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3059 let _result = self.send_raw(result);
3060 if _result.is_err() {
3061 self.control_handle.shutdown();
3062 }
3063 self.drop_without_shutdown();
3064 _result
3065 }
3066
3067 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3069 let _result = self.send_raw(result);
3070 self.drop_without_shutdown();
3071 _result
3072 }
3073
3074 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3075 self.control_handle
3076 .inner
3077 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
3078 result,
3079 self.tx_id,
3080 0x66f1aa7ff5eb183d,
3081 fidl::encoding::DynamicFlags::empty(),
3082 )
3083 }
3084}
3085
3086#[must_use = "FIDL methods require a response to be sent"]
3087#[derive(Debug)]
3088pub struct KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder {
3089 control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
3090 tx_id: u32,
3091}
3092
3093impl std::ops::Drop for KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder {
3097 fn drop(&mut self) {
3098 self.control_handle.shutdown();
3099 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3101 }
3102}
3103
3104impl fidl::endpoints::Responder for KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder {
3105 type ControlHandle = KeyManagerControlHandle;
3106
3107 fn control_handle(&self) -> &KeyManagerControlHandle {
3108 &self.control_handle
3109 }
3110
3111 fn drop_without_shutdown(mut self) {
3112 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3114 std::mem::forget(self);
3116 }
3117}
3118
3119impl KeyManagerGenerateAsymmetricKeyWithAlgorithmResponder {
3120 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3124 let _result = self.send_raw(result);
3125 if _result.is_err() {
3126 self.control_handle.shutdown();
3127 }
3128 self.drop_without_shutdown();
3129 _result
3130 }
3131
3132 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3134 let _result = self.send_raw(result);
3135 self.drop_without_shutdown();
3136 _result
3137 }
3138
3139 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3140 self.control_handle
3141 .inner
3142 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
3143 result,
3144 self.tx_id,
3145 0x2b9eac3ad0bc8a45,
3146 fidl::encoding::DynamicFlags::empty(),
3147 )
3148 }
3149}
3150
3151#[must_use = "FIDL methods require a response to be sent"]
3152#[derive(Debug)]
3153pub struct KeyManagerImportAsymmetricPrivateKeyResponder {
3154 control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
3155 tx_id: u32,
3156}
3157
3158impl std::ops::Drop for KeyManagerImportAsymmetricPrivateKeyResponder {
3162 fn drop(&mut self) {
3163 self.control_handle.shutdown();
3164 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3166 }
3167}
3168
3169impl fidl::endpoints::Responder for KeyManagerImportAsymmetricPrivateKeyResponder {
3170 type ControlHandle = KeyManagerControlHandle;
3171
3172 fn control_handle(&self) -> &KeyManagerControlHandle {
3173 &self.control_handle
3174 }
3175
3176 fn drop_without_shutdown(mut self) {
3177 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3179 std::mem::forget(self);
3181 }
3182}
3183
3184impl KeyManagerImportAsymmetricPrivateKeyResponder {
3185 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3189 let _result = self.send_raw(result);
3190 if _result.is_err() {
3191 self.control_handle.shutdown();
3192 }
3193 self.drop_without_shutdown();
3194 _result
3195 }
3196
3197 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3199 let _result = self.send_raw(result);
3200 self.drop_without_shutdown();
3201 _result
3202 }
3203
3204 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3205 self.control_handle
3206 .inner
3207 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
3208 result,
3209 self.tx_id,
3210 0x14c78f1ebb4eee71,
3211 fidl::encoding::DynamicFlags::empty(),
3212 )
3213 }
3214}
3215
3216#[must_use = "FIDL methods require a response to be sent"]
3217#[derive(Debug)]
3218pub struct KeyManagerGetAsymmetricPrivateKeyResponder {
3219 control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
3220 tx_id: u32,
3221}
3222
3223impl std::ops::Drop for KeyManagerGetAsymmetricPrivateKeyResponder {
3227 fn drop(&mut self) {
3228 self.control_handle.shutdown();
3229 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3231 }
3232}
3233
3234impl fidl::endpoints::Responder for KeyManagerGetAsymmetricPrivateKeyResponder {
3235 type ControlHandle = KeyManagerControlHandle;
3236
3237 fn control_handle(&self) -> &KeyManagerControlHandle {
3238 &self.control_handle
3239 }
3240
3241 fn drop_without_shutdown(mut self) {
3242 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3244 std::mem::forget(self);
3246 }
3247}
3248
3249impl KeyManagerGetAsymmetricPrivateKeyResponder {
3250 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3254 let _result = self.send_raw(result);
3255 if _result.is_err() {
3256 self.control_handle.shutdown();
3257 }
3258 self.drop_without_shutdown();
3259 _result
3260 }
3261
3262 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3264 let _result = self.send_raw(result);
3265 self.drop_without_shutdown();
3266 _result
3267 }
3268
3269 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3270 self.control_handle
3271 .inner
3272 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
3273 result,
3274 self.tx_id,
3275 0x3a257fc6b6ccc5cd,
3276 fidl::encoding::DynamicFlags::empty(),
3277 )
3278 }
3279}
3280
3281#[must_use = "FIDL methods require a response to be sent"]
3282#[derive(Debug)]
3283pub struct KeyManagerDeleteKeyResponder {
3284 control_handle: std::mem::ManuallyDrop<KeyManagerControlHandle>,
3285 tx_id: u32,
3286}
3287
3288impl std::ops::Drop for KeyManagerDeleteKeyResponder {
3292 fn drop(&mut self) {
3293 self.control_handle.shutdown();
3294 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3296 }
3297}
3298
3299impl fidl::endpoints::Responder for KeyManagerDeleteKeyResponder {
3300 type ControlHandle = KeyManagerControlHandle;
3301
3302 fn control_handle(&self) -> &KeyManagerControlHandle {
3303 &self.control_handle
3304 }
3305
3306 fn drop_without_shutdown(mut self) {
3307 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3309 std::mem::forget(self);
3311 }
3312}
3313
3314impl KeyManagerDeleteKeyResponder {
3315 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3319 let _result = self.send_raw(result);
3320 if _result.is_err() {
3321 self.control_handle.shutdown();
3322 }
3323 self.drop_without_shutdown();
3324 _result
3325 }
3326
3327 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3329 let _result = self.send_raw(result);
3330 self.drop_without_shutdown();
3331 _result
3332 }
3333
3334 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3335 self.control_handle
3336 .inner
3337 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
3338 result,
3339 self.tx_id,
3340 0x55521e617d023aad,
3341 fidl::encoding::DynamicFlags::empty(),
3342 )
3343 }
3344}
3345
3346#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3347pub struct StatelessKeyManagerMarker;
3348
3349impl fidl::endpoints::ProtocolMarker for StatelessKeyManagerMarker {
3350 type Proxy = StatelessKeyManagerProxy;
3351 type RequestStream = StatelessKeyManagerRequestStream;
3352 #[cfg(target_os = "fuchsia")]
3353 type SynchronousProxy = StatelessKeyManagerSynchronousProxy;
3354
3355 const DEBUG_NAME: &'static str = "fuchsia.kms.StatelessKeyManager";
3356}
3357impl fidl::endpoints::DiscoverableProtocolMarker for StatelessKeyManagerMarker {}
3358pub type StatelessKeyManagerGetHardwareDerivedKeyResult = Result<Vec<u8>, Error>;
3359
3360pub trait StatelessKeyManagerProxyInterface: Send + Sync {
3361 type GetHardwareDerivedKeyResponseFut: std::future::Future<
3362 Output = Result<StatelessKeyManagerGetHardwareDerivedKeyResult, fidl::Error>,
3363 > + Send;
3364 fn r#get_hardware_derived_key(&self, key_info: &[u8])
3365 -> Self::GetHardwareDerivedKeyResponseFut;
3366}
3367#[derive(Debug)]
3368#[cfg(target_os = "fuchsia")]
3369pub struct StatelessKeyManagerSynchronousProxy {
3370 client: fidl::client::sync::Client,
3371}
3372
3373#[cfg(target_os = "fuchsia")]
3374impl fidl::endpoints::SynchronousProxy for StatelessKeyManagerSynchronousProxy {
3375 type Proxy = StatelessKeyManagerProxy;
3376 type Protocol = StatelessKeyManagerMarker;
3377
3378 fn from_channel(inner: fidl::Channel) -> Self {
3379 Self::new(inner)
3380 }
3381
3382 fn into_channel(self) -> fidl::Channel {
3383 self.client.into_channel()
3384 }
3385
3386 fn as_channel(&self) -> &fidl::Channel {
3387 self.client.as_channel()
3388 }
3389}
3390
3391#[cfg(target_os = "fuchsia")]
3392impl StatelessKeyManagerSynchronousProxy {
3393 pub fn new(channel: fidl::Channel) -> Self {
3394 let protocol_name =
3395 <StatelessKeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3396 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3397 }
3398
3399 pub fn into_channel(self) -> fidl::Channel {
3400 self.client.into_channel()
3401 }
3402
3403 pub fn wait_for_event(
3406 &self,
3407 deadline: zx::MonotonicInstant,
3408 ) -> Result<StatelessKeyManagerEvent, fidl::Error> {
3409 StatelessKeyManagerEvent::decode(self.client.wait_for_event(deadline)?)
3410 }
3411
3412 pub fn r#get_hardware_derived_key(
3419 &self,
3420 mut key_info: &[u8],
3421 ___deadline: zx::MonotonicInstant,
3422 ) -> Result<StatelessKeyManagerGetHardwareDerivedKeyResult, fidl::Error> {
3423 let _response = self.client.send_query::<
3424 StatelessKeyManagerGetHardwareDerivedKeyRequest,
3425 fidl::encoding::ResultType<StatelessKeyManagerGetHardwareDerivedKeyResponse, Error>,
3426 >(
3427 (key_info,),
3428 0x685043d9e68d5f86,
3429 fidl::encoding::DynamicFlags::empty(),
3430 ___deadline,
3431 )?;
3432 Ok(_response.map(|x| x.derived_key))
3433 }
3434}
3435
3436#[cfg(target_os = "fuchsia")]
3437impl From<StatelessKeyManagerSynchronousProxy> for zx::Handle {
3438 fn from(value: StatelessKeyManagerSynchronousProxy) -> Self {
3439 value.into_channel().into()
3440 }
3441}
3442
3443#[cfg(target_os = "fuchsia")]
3444impl From<fidl::Channel> for StatelessKeyManagerSynchronousProxy {
3445 fn from(value: fidl::Channel) -> Self {
3446 Self::new(value)
3447 }
3448}
3449
3450#[derive(Debug, Clone)]
3451pub struct StatelessKeyManagerProxy {
3452 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3453}
3454
3455impl fidl::endpoints::Proxy for StatelessKeyManagerProxy {
3456 type Protocol = StatelessKeyManagerMarker;
3457
3458 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3459 Self::new(inner)
3460 }
3461
3462 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3463 self.client.into_channel().map_err(|client| Self { client })
3464 }
3465
3466 fn as_channel(&self) -> &::fidl::AsyncChannel {
3467 self.client.as_channel()
3468 }
3469}
3470
3471impl StatelessKeyManagerProxy {
3472 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3474 let protocol_name =
3475 <StatelessKeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3476 Self { client: fidl::client::Client::new(channel, protocol_name) }
3477 }
3478
3479 pub fn take_event_stream(&self) -> StatelessKeyManagerEventStream {
3485 StatelessKeyManagerEventStream { event_receiver: self.client.take_event_receiver() }
3486 }
3487
3488 pub fn r#get_hardware_derived_key(
3495 &self,
3496 mut key_info: &[u8],
3497 ) -> fidl::client::QueryResponseFut<
3498 StatelessKeyManagerGetHardwareDerivedKeyResult,
3499 fidl::encoding::DefaultFuchsiaResourceDialect,
3500 > {
3501 StatelessKeyManagerProxyInterface::r#get_hardware_derived_key(self, key_info)
3502 }
3503}
3504
3505impl StatelessKeyManagerProxyInterface for StatelessKeyManagerProxy {
3506 type GetHardwareDerivedKeyResponseFut = fidl::client::QueryResponseFut<
3507 StatelessKeyManagerGetHardwareDerivedKeyResult,
3508 fidl::encoding::DefaultFuchsiaResourceDialect,
3509 >;
3510 fn r#get_hardware_derived_key(
3511 &self,
3512 mut key_info: &[u8],
3513 ) -> Self::GetHardwareDerivedKeyResponseFut {
3514 fn _decode(
3515 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3516 ) -> Result<StatelessKeyManagerGetHardwareDerivedKeyResult, fidl::Error> {
3517 let _response = fidl::client::decode_transaction_body::<
3518 fidl::encoding::ResultType<StatelessKeyManagerGetHardwareDerivedKeyResponse, Error>,
3519 fidl::encoding::DefaultFuchsiaResourceDialect,
3520 0x685043d9e68d5f86,
3521 >(_buf?)?;
3522 Ok(_response.map(|x| x.derived_key))
3523 }
3524 self.client.send_query_and_decode::<
3525 StatelessKeyManagerGetHardwareDerivedKeyRequest,
3526 StatelessKeyManagerGetHardwareDerivedKeyResult,
3527 >(
3528 (key_info,),
3529 0x685043d9e68d5f86,
3530 fidl::encoding::DynamicFlags::empty(),
3531 _decode,
3532 )
3533 }
3534}
3535
3536pub struct StatelessKeyManagerEventStream {
3537 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3538}
3539
3540impl std::marker::Unpin for StatelessKeyManagerEventStream {}
3541
3542impl futures::stream::FusedStream for StatelessKeyManagerEventStream {
3543 fn is_terminated(&self) -> bool {
3544 self.event_receiver.is_terminated()
3545 }
3546}
3547
3548impl futures::Stream for StatelessKeyManagerEventStream {
3549 type Item = Result<StatelessKeyManagerEvent, fidl::Error>;
3550
3551 fn poll_next(
3552 mut self: std::pin::Pin<&mut Self>,
3553 cx: &mut std::task::Context<'_>,
3554 ) -> std::task::Poll<Option<Self::Item>> {
3555 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3556 &mut self.event_receiver,
3557 cx
3558 )?) {
3559 Some(buf) => std::task::Poll::Ready(Some(StatelessKeyManagerEvent::decode(buf))),
3560 None => std::task::Poll::Ready(None),
3561 }
3562 }
3563}
3564
3565#[derive(Debug)]
3566pub enum StatelessKeyManagerEvent {}
3567
3568impl StatelessKeyManagerEvent {
3569 fn decode(
3571 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3572 ) -> Result<StatelessKeyManagerEvent, fidl::Error> {
3573 let (bytes, _handles) = buf.split_mut();
3574 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3575 debug_assert_eq!(tx_header.tx_id, 0);
3576 match tx_header.ordinal {
3577 _ => Err(fidl::Error::UnknownOrdinal {
3578 ordinal: tx_header.ordinal,
3579 protocol_name:
3580 <StatelessKeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3581 }),
3582 }
3583 }
3584}
3585
3586pub struct StatelessKeyManagerRequestStream {
3588 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3589 is_terminated: bool,
3590}
3591
3592impl std::marker::Unpin for StatelessKeyManagerRequestStream {}
3593
3594impl futures::stream::FusedStream for StatelessKeyManagerRequestStream {
3595 fn is_terminated(&self) -> bool {
3596 self.is_terminated
3597 }
3598}
3599
3600impl fidl::endpoints::RequestStream for StatelessKeyManagerRequestStream {
3601 type Protocol = StatelessKeyManagerMarker;
3602 type ControlHandle = StatelessKeyManagerControlHandle;
3603
3604 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3605 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3606 }
3607
3608 fn control_handle(&self) -> Self::ControlHandle {
3609 StatelessKeyManagerControlHandle { inner: self.inner.clone() }
3610 }
3611
3612 fn into_inner(
3613 self,
3614 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3615 {
3616 (self.inner, self.is_terminated)
3617 }
3618
3619 fn from_inner(
3620 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3621 is_terminated: bool,
3622 ) -> Self {
3623 Self { inner, is_terminated }
3624 }
3625}
3626
3627impl futures::Stream for StatelessKeyManagerRequestStream {
3628 type Item = Result<StatelessKeyManagerRequest, fidl::Error>;
3629
3630 fn poll_next(
3631 mut self: std::pin::Pin<&mut Self>,
3632 cx: &mut std::task::Context<'_>,
3633 ) -> std::task::Poll<Option<Self::Item>> {
3634 let this = &mut *self;
3635 if this.inner.check_shutdown(cx) {
3636 this.is_terminated = true;
3637 return std::task::Poll::Ready(None);
3638 }
3639 if this.is_terminated {
3640 panic!("polled StatelessKeyManagerRequestStream after completion");
3641 }
3642 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3643 |bytes, handles| {
3644 match this.inner.channel().read_etc(cx, bytes, handles) {
3645 std::task::Poll::Ready(Ok(())) => {}
3646 std::task::Poll::Pending => return std::task::Poll::Pending,
3647 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3648 this.is_terminated = true;
3649 return std::task::Poll::Ready(None);
3650 }
3651 std::task::Poll::Ready(Err(e)) => {
3652 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3653 e.into(),
3654 ))))
3655 }
3656 }
3657
3658 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3660
3661 std::task::Poll::Ready(Some(match header.ordinal {
3662 0x685043d9e68d5f86 => {
3663 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3664 let mut req = fidl::new_empty!(StatelessKeyManagerGetHardwareDerivedKeyRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3665 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StatelessKeyManagerGetHardwareDerivedKeyRequest>(&header, _body_bytes, handles, &mut req)?;
3666 let control_handle = StatelessKeyManagerControlHandle {
3667 inner: this.inner.clone(),
3668 };
3669 Ok(StatelessKeyManagerRequest::GetHardwareDerivedKey {key_info: req.key_info,
3670
3671 responder: StatelessKeyManagerGetHardwareDerivedKeyResponder {
3672 control_handle: std::mem::ManuallyDrop::new(control_handle),
3673 tx_id: header.tx_id,
3674 },
3675 })
3676 }
3677 _ => Err(fidl::Error::UnknownOrdinal {
3678 ordinal: header.ordinal,
3679 protocol_name: <StatelessKeyManagerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3680 }),
3681 }))
3682 },
3683 )
3684 }
3685}
3686
3687#[derive(Debug)]
3688pub enum StatelessKeyManagerRequest {
3689 GetHardwareDerivedKey {
3696 key_info: Vec<u8>,
3697 responder: StatelessKeyManagerGetHardwareDerivedKeyResponder,
3698 },
3699}
3700
3701impl StatelessKeyManagerRequest {
3702 #[allow(irrefutable_let_patterns)]
3703 pub fn into_get_hardware_derived_key(
3704 self,
3705 ) -> Option<(Vec<u8>, StatelessKeyManagerGetHardwareDerivedKeyResponder)> {
3706 if let StatelessKeyManagerRequest::GetHardwareDerivedKey { key_info, responder } = self {
3707 Some((key_info, responder))
3708 } else {
3709 None
3710 }
3711 }
3712
3713 pub fn method_name(&self) -> &'static str {
3715 match *self {
3716 StatelessKeyManagerRequest::GetHardwareDerivedKey { .. } => "get_hardware_derived_key",
3717 }
3718 }
3719}
3720
3721#[derive(Debug, Clone)]
3722pub struct StatelessKeyManagerControlHandle {
3723 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3724}
3725
3726impl fidl::endpoints::ControlHandle for StatelessKeyManagerControlHandle {
3727 fn shutdown(&self) {
3728 self.inner.shutdown()
3729 }
3730 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3731 self.inner.shutdown_with_epitaph(status)
3732 }
3733
3734 fn is_closed(&self) -> bool {
3735 self.inner.channel().is_closed()
3736 }
3737 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3738 self.inner.channel().on_closed()
3739 }
3740
3741 #[cfg(target_os = "fuchsia")]
3742 fn signal_peer(
3743 &self,
3744 clear_mask: zx::Signals,
3745 set_mask: zx::Signals,
3746 ) -> Result<(), zx_status::Status> {
3747 use fidl::Peered;
3748 self.inner.channel().signal_peer(clear_mask, set_mask)
3749 }
3750}
3751
3752impl StatelessKeyManagerControlHandle {}
3753
3754#[must_use = "FIDL methods require a response to be sent"]
3755#[derive(Debug)]
3756pub struct StatelessKeyManagerGetHardwareDerivedKeyResponder {
3757 control_handle: std::mem::ManuallyDrop<StatelessKeyManagerControlHandle>,
3758 tx_id: u32,
3759}
3760
3761impl std::ops::Drop for StatelessKeyManagerGetHardwareDerivedKeyResponder {
3765 fn drop(&mut self) {
3766 self.control_handle.shutdown();
3767 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3769 }
3770}
3771
3772impl fidl::endpoints::Responder for StatelessKeyManagerGetHardwareDerivedKeyResponder {
3773 type ControlHandle = StatelessKeyManagerControlHandle;
3774
3775 fn control_handle(&self) -> &StatelessKeyManagerControlHandle {
3776 &self.control_handle
3777 }
3778
3779 fn drop_without_shutdown(mut self) {
3780 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3782 std::mem::forget(self);
3784 }
3785}
3786
3787impl StatelessKeyManagerGetHardwareDerivedKeyResponder {
3788 pub fn send(self, mut result: Result<&[u8], Error>) -> Result<(), fidl::Error> {
3792 let _result = self.send_raw(result);
3793 if _result.is_err() {
3794 self.control_handle.shutdown();
3795 }
3796 self.drop_without_shutdown();
3797 _result
3798 }
3799
3800 pub fn send_no_shutdown_on_err(
3802 self,
3803 mut result: Result<&[u8], Error>,
3804 ) -> Result<(), fidl::Error> {
3805 let _result = self.send_raw(result);
3806 self.drop_without_shutdown();
3807 _result
3808 }
3809
3810 fn send_raw(&self, mut result: Result<&[u8], Error>) -> Result<(), fidl::Error> {
3811 self.control_handle.inner.send::<fidl::encoding::ResultType<
3812 StatelessKeyManagerGetHardwareDerivedKeyResponse,
3813 Error,
3814 >>(
3815 result.map(|derived_key| (derived_key,)),
3816 self.tx_id,
3817 0x685043d9e68d5f86,
3818 fidl::encoding::DynamicFlags::empty(),
3819 )
3820 }
3821}
3822
3823mod internal {
3824 use super::*;
3825
3826 impl fidl::encoding::ResourceTypeMarker for AsymmetricPrivateKeySignRequest {
3827 type Borrowed<'a> = &'a mut Self;
3828 fn take_or_borrow<'a>(
3829 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3830 ) -> Self::Borrowed<'a> {
3831 value
3832 }
3833 }
3834
3835 unsafe impl fidl::encoding::TypeMarker for AsymmetricPrivateKeySignRequest {
3836 type Owned = Self;
3837
3838 #[inline(always)]
3839 fn inline_align(_context: fidl::encoding::Context) -> usize {
3840 8
3841 }
3842
3843 #[inline(always)]
3844 fn inline_size(_context: fidl::encoding::Context) -> usize {
3845 16
3846 }
3847 }
3848
3849 unsafe impl
3850 fidl::encoding::Encode<
3851 AsymmetricPrivateKeySignRequest,
3852 fidl::encoding::DefaultFuchsiaResourceDialect,
3853 > for &mut AsymmetricPrivateKeySignRequest
3854 {
3855 #[inline]
3856 unsafe fn encode(
3857 self,
3858 encoder: &mut fidl::encoding::Encoder<
3859 '_,
3860 fidl::encoding::DefaultFuchsiaResourceDialect,
3861 >,
3862 offset: usize,
3863 _depth: fidl::encoding::Depth,
3864 ) -> fidl::Result<()> {
3865 encoder.debug_check_bounds::<AsymmetricPrivateKeySignRequest>(offset);
3866 fidl::encoding::Encode::<
3868 AsymmetricPrivateKeySignRequest,
3869 fidl::encoding::DefaultFuchsiaResourceDialect,
3870 >::encode(
3871 (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3872 &mut self.data,
3873 ),),
3874 encoder,
3875 offset,
3876 _depth,
3877 )
3878 }
3879 }
3880 unsafe impl<
3881 T0: fidl::encoding::Encode<
3882 fidl_fuchsia_mem::Buffer,
3883 fidl::encoding::DefaultFuchsiaResourceDialect,
3884 >,
3885 >
3886 fidl::encoding::Encode<
3887 AsymmetricPrivateKeySignRequest,
3888 fidl::encoding::DefaultFuchsiaResourceDialect,
3889 > for (T0,)
3890 {
3891 #[inline]
3892 unsafe fn encode(
3893 self,
3894 encoder: &mut fidl::encoding::Encoder<
3895 '_,
3896 fidl::encoding::DefaultFuchsiaResourceDialect,
3897 >,
3898 offset: usize,
3899 depth: fidl::encoding::Depth,
3900 ) -> fidl::Result<()> {
3901 encoder.debug_check_bounds::<AsymmetricPrivateKeySignRequest>(offset);
3902 self.0.encode(encoder, offset + 0, depth)?;
3906 Ok(())
3907 }
3908 }
3909
3910 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3911 for AsymmetricPrivateKeySignRequest
3912 {
3913 #[inline(always)]
3914 fn new_empty() -> Self {
3915 Self {
3916 data: fidl::new_empty!(
3917 fidl_fuchsia_mem::Buffer,
3918 fidl::encoding::DefaultFuchsiaResourceDialect
3919 ),
3920 }
3921 }
3922
3923 #[inline]
3924 unsafe fn decode(
3925 &mut self,
3926 decoder: &mut fidl::encoding::Decoder<
3927 '_,
3928 fidl::encoding::DefaultFuchsiaResourceDialect,
3929 >,
3930 offset: usize,
3931 _depth: fidl::encoding::Depth,
3932 ) -> fidl::Result<()> {
3933 decoder.debug_check_bounds::<Self>(offset);
3934 fidl::decode!(
3936 fidl_fuchsia_mem::Buffer,
3937 fidl::encoding::DefaultFuchsiaResourceDialect,
3938 &mut self.data,
3939 decoder,
3940 offset + 0,
3941 _depth
3942 )?;
3943 Ok(())
3944 }
3945 }
3946
3947 impl fidl::encoding::ResourceTypeMarker for KeyManagerGenerateAsymmetricKeyRequest {
3948 type Borrowed<'a> = &'a mut Self;
3949 fn take_or_borrow<'a>(
3950 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3951 ) -> Self::Borrowed<'a> {
3952 value
3953 }
3954 }
3955
3956 unsafe impl fidl::encoding::TypeMarker for KeyManagerGenerateAsymmetricKeyRequest {
3957 type Owned = Self;
3958
3959 #[inline(always)]
3960 fn inline_align(_context: fidl::encoding::Context) -> usize {
3961 8
3962 }
3963
3964 #[inline(always)]
3965 fn inline_size(_context: fidl::encoding::Context) -> usize {
3966 24
3967 }
3968 }
3969
3970 unsafe impl
3971 fidl::encoding::Encode<
3972 KeyManagerGenerateAsymmetricKeyRequest,
3973 fidl::encoding::DefaultFuchsiaResourceDialect,
3974 > for &mut KeyManagerGenerateAsymmetricKeyRequest
3975 {
3976 #[inline]
3977 unsafe fn encode(
3978 self,
3979 encoder: &mut fidl::encoding::Encoder<
3980 '_,
3981 fidl::encoding::DefaultFuchsiaResourceDialect,
3982 >,
3983 offset: usize,
3984 _depth: fidl::encoding::Depth,
3985 ) -> fidl::Result<()> {
3986 encoder.debug_check_bounds::<KeyManagerGenerateAsymmetricKeyRequest>(offset);
3987 fidl::encoding::Encode::<
3989 KeyManagerGenerateAsymmetricKeyRequest,
3990 fidl::encoding::DefaultFuchsiaResourceDialect,
3991 >::encode(
3992 (
3993 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
3994 &self.key_name,
3995 ),
3996 <fidl::encoding::Endpoint<
3997 fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
3998 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3999 &mut self.key
4000 ),
4001 ),
4002 encoder,
4003 offset,
4004 _depth,
4005 )
4006 }
4007 }
4008 unsafe impl<
4009 T0: fidl::encoding::Encode<
4010 fidl::encoding::BoundedString<32>,
4011 fidl::encoding::DefaultFuchsiaResourceDialect,
4012 >,
4013 T1: fidl::encoding::Encode<
4014 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
4015 fidl::encoding::DefaultFuchsiaResourceDialect,
4016 >,
4017 >
4018 fidl::encoding::Encode<
4019 KeyManagerGenerateAsymmetricKeyRequest,
4020 fidl::encoding::DefaultFuchsiaResourceDialect,
4021 > for (T0, T1)
4022 {
4023 #[inline]
4024 unsafe fn encode(
4025 self,
4026 encoder: &mut fidl::encoding::Encoder<
4027 '_,
4028 fidl::encoding::DefaultFuchsiaResourceDialect,
4029 >,
4030 offset: usize,
4031 depth: fidl::encoding::Depth,
4032 ) -> fidl::Result<()> {
4033 encoder.debug_check_bounds::<KeyManagerGenerateAsymmetricKeyRequest>(offset);
4034 unsafe {
4037 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4038 (ptr as *mut u64).write_unaligned(0);
4039 }
4040 self.0.encode(encoder, offset + 0, depth)?;
4042 self.1.encode(encoder, offset + 16, depth)?;
4043 Ok(())
4044 }
4045 }
4046
4047 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4048 for KeyManagerGenerateAsymmetricKeyRequest
4049 {
4050 #[inline(always)]
4051 fn new_empty() -> Self {
4052 Self {
4053 key_name: fidl::new_empty!(
4054 fidl::encoding::BoundedString<32>,
4055 fidl::encoding::DefaultFuchsiaResourceDialect
4056 ),
4057 key: fidl::new_empty!(
4058 fidl::encoding::Endpoint<
4059 fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
4060 >,
4061 fidl::encoding::DefaultFuchsiaResourceDialect
4062 ),
4063 }
4064 }
4065
4066 #[inline]
4067 unsafe fn decode(
4068 &mut self,
4069 decoder: &mut fidl::encoding::Decoder<
4070 '_,
4071 fidl::encoding::DefaultFuchsiaResourceDialect,
4072 >,
4073 offset: usize,
4074 _depth: fidl::encoding::Depth,
4075 ) -> fidl::Result<()> {
4076 decoder.debug_check_bounds::<Self>(offset);
4077 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4079 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4080 let mask = 0xffffffff00000000u64;
4081 let maskedval = padval & mask;
4082 if maskedval != 0 {
4083 return Err(fidl::Error::NonZeroPadding {
4084 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4085 });
4086 }
4087 fidl::decode!(
4088 fidl::encoding::BoundedString<32>,
4089 fidl::encoding::DefaultFuchsiaResourceDialect,
4090 &mut self.key_name,
4091 decoder,
4092 offset + 0,
4093 _depth
4094 )?;
4095 fidl::decode!(
4096 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
4097 fidl::encoding::DefaultFuchsiaResourceDialect,
4098 &mut self.key,
4099 decoder,
4100 offset + 16,
4101 _depth
4102 )?;
4103 Ok(())
4104 }
4105 }
4106
4107 impl fidl::encoding::ResourceTypeMarker for KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest {
4108 type Borrowed<'a> = &'a mut Self;
4109 fn take_or_borrow<'a>(
4110 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4111 ) -> Self::Borrowed<'a> {
4112 value
4113 }
4114 }
4115
4116 unsafe impl fidl::encoding::TypeMarker for KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest {
4117 type Owned = Self;
4118
4119 #[inline(always)]
4120 fn inline_align(_context: fidl::encoding::Context) -> usize {
4121 8
4122 }
4123
4124 #[inline(always)]
4125 fn inline_size(_context: fidl::encoding::Context) -> usize {
4126 24
4127 }
4128 }
4129
4130 unsafe impl
4131 fidl::encoding::Encode<
4132 KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest,
4133 fidl::encoding::DefaultFuchsiaResourceDialect,
4134 > for &mut KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest
4135 {
4136 #[inline]
4137 unsafe fn encode(
4138 self,
4139 encoder: &mut fidl::encoding::Encoder<
4140 '_,
4141 fidl::encoding::DefaultFuchsiaResourceDialect,
4142 >,
4143 offset: usize,
4144 _depth: fidl::encoding::Depth,
4145 ) -> fidl::Result<()> {
4146 encoder
4147 .debug_check_bounds::<KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest>(offset);
4148 fidl::encoding::Encode::<
4150 KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest,
4151 fidl::encoding::DefaultFuchsiaResourceDialect,
4152 >::encode(
4153 (
4154 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
4155 &self.key_name,
4156 ),
4157 <AsymmetricKeyAlgorithm as fidl::encoding::ValueTypeMarker>::borrow(
4158 &self.key_algorithm,
4159 ),
4160 <fidl::encoding::Endpoint<
4161 fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
4162 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4163 &mut self.key
4164 ),
4165 ),
4166 encoder,
4167 offset,
4168 _depth,
4169 )
4170 }
4171 }
4172 unsafe impl<
4173 T0: fidl::encoding::Encode<
4174 fidl::encoding::BoundedString<32>,
4175 fidl::encoding::DefaultFuchsiaResourceDialect,
4176 >,
4177 T1: fidl::encoding::Encode<
4178 AsymmetricKeyAlgorithm,
4179 fidl::encoding::DefaultFuchsiaResourceDialect,
4180 >,
4181 T2: fidl::encoding::Encode<
4182 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
4183 fidl::encoding::DefaultFuchsiaResourceDialect,
4184 >,
4185 >
4186 fidl::encoding::Encode<
4187 KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest,
4188 fidl::encoding::DefaultFuchsiaResourceDialect,
4189 > for (T0, T1, T2)
4190 {
4191 #[inline]
4192 unsafe fn encode(
4193 self,
4194 encoder: &mut fidl::encoding::Encoder<
4195 '_,
4196 fidl::encoding::DefaultFuchsiaResourceDialect,
4197 >,
4198 offset: usize,
4199 depth: fidl::encoding::Depth,
4200 ) -> fidl::Result<()> {
4201 encoder
4202 .debug_check_bounds::<KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest>(offset);
4203 self.0.encode(encoder, offset + 0, depth)?;
4207 self.1.encode(encoder, offset + 16, depth)?;
4208 self.2.encode(encoder, offset + 20, depth)?;
4209 Ok(())
4210 }
4211 }
4212
4213 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4214 for KeyManagerGenerateAsymmetricKeyWithAlgorithmRequest
4215 {
4216 #[inline(always)]
4217 fn new_empty() -> Self {
4218 Self {
4219 key_name: fidl::new_empty!(
4220 fidl::encoding::BoundedString<32>,
4221 fidl::encoding::DefaultFuchsiaResourceDialect
4222 ),
4223 key_algorithm: fidl::new_empty!(
4224 AsymmetricKeyAlgorithm,
4225 fidl::encoding::DefaultFuchsiaResourceDialect
4226 ),
4227 key: fidl::new_empty!(
4228 fidl::encoding::Endpoint<
4229 fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
4230 >,
4231 fidl::encoding::DefaultFuchsiaResourceDialect
4232 ),
4233 }
4234 }
4235
4236 #[inline]
4237 unsafe fn decode(
4238 &mut self,
4239 decoder: &mut fidl::encoding::Decoder<
4240 '_,
4241 fidl::encoding::DefaultFuchsiaResourceDialect,
4242 >,
4243 offset: usize,
4244 _depth: fidl::encoding::Depth,
4245 ) -> fidl::Result<()> {
4246 decoder.debug_check_bounds::<Self>(offset);
4247 fidl::decode!(
4249 fidl::encoding::BoundedString<32>,
4250 fidl::encoding::DefaultFuchsiaResourceDialect,
4251 &mut self.key_name,
4252 decoder,
4253 offset + 0,
4254 _depth
4255 )?;
4256 fidl::decode!(
4257 AsymmetricKeyAlgorithm,
4258 fidl::encoding::DefaultFuchsiaResourceDialect,
4259 &mut self.key_algorithm,
4260 decoder,
4261 offset + 16,
4262 _depth
4263 )?;
4264 fidl::decode!(
4265 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
4266 fidl::encoding::DefaultFuchsiaResourceDialect,
4267 &mut self.key,
4268 decoder,
4269 offset + 20,
4270 _depth
4271 )?;
4272 Ok(())
4273 }
4274 }
4275
4276 impl fidl::encoding::ResourceTypeMarker for KeyManagerGetAsymmetricPrivateKeyRequest {
4277 type Borrowed<'a> = &'a mut Self;
4278 fn take_or_borrow<'a>(
4279 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4280 ) -> Self::Borrowed<'a> {
4281 value
4282 }
4283 }
4284
4285 unsafe impl fidl::encoding::TypeMarker for KeyManagerGetAsymmetricPrivateKeyRequest {
4286 type Owned = Self;
4287
4288 #[inline(always)]
4289 fn inline_align(_context: fidl::encoding::Context) -> usize {
4290 8
4291 }
4292
4293 #[inline(always)]
4294 fn inline_size(_context: fidl::encoding::Context) -> usize {
4295 24
4296 }
4297 }
4298
4299 unsafe impl
4300 fidl::encoding::Encode<
4301 KeyManagerGetAsymmetricPrivateKeyRequest,
4302 fidl::encoding::DefaultFuchsiaResourceDialect,
4303 > for &mut KeyManagerGetAsymmetricPrivateKeyRequest
4304 {
4305 #[inline]
4306 unsafe fn encode(
4307 self,
4308 encoder: &mut fidl::encoding::Encoder<
4309 '_,
4310 fidl::encoding::DefaultFuchsiaResourceDialect,
4311 >,
4312 offset: usize,
4313 _depth: fidl::encoding::Depth,
4314 ) -> fidl::Result<()> {
4315 encoder.debug_check_bounds::<KeyManagerGetAsymmetricPrivateKeyRequest>(offset);
4316 fidl::encoding::Encode::<
4318 KeyManagerGetAsymmetricPrivateKeyRequest,
4319 fidl::encoding::DefaultFuchsiaResourceDialect,
4320 >::encode(
4321 (
4322 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
4323 &self.key_name,
4324 ),
4325 <fidl::encoding::Endpoint<
4326 fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
4327 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4328 &mut self.key
4329 ),
4330 ),
4331 encoder,
4332 offset,
4333 _depth,
4334 )
4335 }
4336 }
4337 unsafe impl<
4338 T0: fidl::encoding::Encode<
4339 fidl::encoding::BoundedString<32>,
4340 fidl::encoding::DefaultFuchsiaResourceDialect,
4341 >,
4342 T1: fidl::encoding::Encode<
4343 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
4344 fidl::encoding::DefaultFuchsiaResourceDialect,
4345 >,
4346 >
4347 fidl::encoding::Encode<
4348 KeyManagerGetAsymmetricPrivateKeyRequest,
4349 fidl::encoding::DefaultFuchsiaResourceDialect,
4350 > for (T0, T1)
4351 {
4352 #[inline]
4353 unsafe fn encode(
4354 self,
4355 encoder: &mut fidl::encoding::Encoder<
4356 '_,
4357 fidl::encoding::DefaultFuchsiaResourceDialect,
4358 >,
4359 offset: usize,
4360 depth: fidl::encoding::Depth,
4361 ) -> fidl::Result<()> {
4362 encoder.debug_check_bounds::<KeyManagerGetAsymmetricPrivateKeyRequest>(offset);
4363 unsafe {
4366 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4367 (ptr as *mut u64).write_unaligned(0);
4368 }
4369 self.0.encode(encoder, offset + 0, depth)?;
4371 self.1.encode(encoder, offset + 16, depth)?;
4372 Ok(())
4373 }
4374 }
4375
4376 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4377 for KeyManagerGetAsymmetricPrivateKeyRequest
4378 {
4379 #[inline(always)]
4380 fn new_empty() -> Self {
4381 Self {
4382 key_name: fidl::new_empty!(
4383 fidl::encoding::BoundedString<32>,
4384 fidl::encoding::DefaultFuchsiaResourceDialect
4385 ),
4386 key: fidl::new_empty!(
4387 fidl::encoding::Endpoint<
4388 fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
4389 >,
4390 fidl::encoding::DefaultFuchsiaResourceDialect
4391 ),
4392 }
4393 }
4394
4395 #[inline]
4396 unsafe fn decode(
4397 &mut self,
4398 decoder: &mut fidl::encoding::Decoder<
4399 '_,
4400 fidl::encoding::DefaultFuchsiaResourceDialect,
4401 >,
4402 offset: usize,
4403 _depth: fidl::encoding::Depth,
4404 ) -> fidl::Result<()> {
4405 decoder.debug_check_bounds::<Self>(offset);
4406 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4408 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4409 let mask = 0xffffffff00000000u64;
4410 let maskedval = padval & mask;
4411 if maskedval != 0 {
4412 return Err(fidl::Error::NonZeroPadding {
4413 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4414 });
4415 }
4416 fidl::decode!(
4417 fidl::encoding::BoundedString<32>,
4418 fidl::encoding::DefaultFuchsiaResourceDialect,
4419 &mut self.key_name,
4420 decoder,
4421 offset + 0,
4422 _depth
4423 )?;
4424 fidl::decode!(
4425 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
4426 fidl::encoding::DefaultFuchsiaResourceDialect,
4427 &mut self.key,
4428 decoder,
4429 offset + 16,
4430 _depth
4431 )?;
4432 Ok(())
4433 }
4434 }
4435
4436 impl fidl::encoding::ResourceTypeMarker for KeyManagerImportAsymmetricPrivateKeyRequest {
4437 type Borrowed<'a> = &'a mut Self;
4438 fn take_or_borrow<'a>(
4439 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4440 ) -> Self::Borrowed<'a> {
4441 value
4442 }
4443 }
4444
4445 unsafe impl fidl::encoding::TypeMarker for KeyManagerImportAsymmetricPrivateKeyRequest {
4446 type Owned = Self;
4447
4448 #[inline(always)]
4449 fn inline_align(_context: fidl::encoding::Context) -> usize {
4450 8
4451 }
4452
4453 #[inline(always)]
4454 fn inline_size(_context: fidl::encoding::Context) -> usize {
4455 40
4456 }
4457 }
4458
4459 unsafe impl
4460 fidl::encoding::Encode<
4461 KeyManagerImportAsymmetricPrivateKeyRequest,
4462 fidl::encoding::DefaultFuchsiaResourceDialect,
4463 > for &mut KeyManagerImportAsymmetricPrivateKeyRequest
4464 {
4465 #[inline]
4466 unsafe fn encode(
4467 self,
4468 encoder: &mut fidl::encoding::Encoder<
4469 '_,
4470 fidl::encoding::DefaultFuchsiaResourceDialect,
4471 >,
4472 offset: usize,
4473 _depth: fidl::encoding::Depth,
4474 ) -> fidl::Result<()> {
4475 encoder.debug_check_bounds::<KeyManagerImportAsymmetricPrivateKeyRequest>(offset);
4476 fidl::encoding::Encode::<KeyManagerImportAsymmetricPrivateKeyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4478 (
4479 <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
4480 <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.key_name),
4481 <AsymmetricKeyAlgorithm as fidl::encoding::ValueTypeMarker>::borrow(&self.key_algorithm),
4482 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.key),
4483 ),
4484 encoder, offset, _depth
4485 )
4486 }
4487 }
4488 unsafe impl<
4489 T0: fidl::encoding::Encode<
4490 fidl::encoding::UnboundedVector<u8>,
4491 fidl::encoding::DefaultFuchsiaResourceDialect,
4492 >,
4493 T1: fidl::encoding::Encode<
4494 fidl::encoding::BoundedString<32>,
4495 fidl::encoding::DefaultFuchsiaResourceDialect,
4496 >,
4497 T2: fidl::encoding::Encode<
4498 AsymmetricKeyAlgorithm,
4499 fidl::encoding::DefaultFuchsiaResourceDialect,
4500 >,
4501 T3: fidl::encoding::Encode<
4502 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
4503 fidl::encoding::DefaultFuchsiaResourceDialect,
4504 >,
4505 >
4506 fidl::encoding::Encode<
4507 KeyManagerImportAsymmetricPrivateKeyRequest,
4508 fidl::encoding::DefaultFuchsiaResourceDialect,
4509 > for (T0, T1, T2, T3)
4510 {
4511 #[inline]
4512 unsafe fn encode(
4513 self,
4514 encoder: &mut fidl::encoding::Encoder<
4515 '_,
4516 fidl::encoding::DefaultFuchsiaResourceDialect,
4517 >,
4518 offset: usize,
4519 depth: fidl::encoding::Depth,
4520 ) -> fidl::Result<()> {
4521 encoder.debug_check_bounds::<KeyManagerImportAsymmetricPrivateKeyRequest>(offset);
4522 self.0.encode(encoder, offset + 0, depth)?;
4526 self.1.encode(encoder, offset + 16, depth)?;
4527 self.2.encode(encoder, offset + 32, depth)?;
4528 self.3.encode(encoder, offset + 36, depth)?;
4529 Ok(())
4530 }
4531 }
4532
4533 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4534 for KeyManagerImportAsymmetricPrivateKeyRequest
4535 {
4536 #[inline(always)]
4537 fn new_empty() -> Self {
4538 Self {
4539 data: fidl::new_empty!(
4540 fidl::encoding::UnboundedVector<u8>,
4541 fidl::encoding::DefaultFuchsiaResourceDialect
4542 ),
4543 key_name: fidl::new_empty!(
4544 fidl::encoding::BoundedString<32>,
4545 fidl::encoding::DefaultFuchsiaResourceDialect
4546 ),
4547 key_algorithm: fidl::new_empty!(
4548 AsymmetricKeyAlgorithm,
4549 fidl::encoding::DefaultFuchsiaResourceDialect
4550 ),
4551 key: fidl::new_empty!(
4552 fidl::encoding::Endpoint<
4553 fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>,
4554 >,
4555 fidl::encoding::DefaultFuchsiaResourceDialect
4556 ),
4557 }
4558 }
4559
4560 #[inline]
4561 unsafe fn decode(
4562 &mut self,
4563 decoder: &mut fidl::encoding::Decoder<
4564 '_,
4565 fidl::encoding::DefaultFuchsiaResourceDialect,
4566 >,
4567 offset: usize,
4568 _depth: fidl::encoding::Depth,
4569 ) -> fidl::Result<()> {
4570 decoder.debug_check_bounds::<Self>(offset);
4571 fidl::decode!(
4573 fidl::encoding::UnboundedVector<u8>,
4574 fidl::encoding::DefaultFuchsiaResourceDialect,
4575 &mut self.data,
4576 decoder,
4577 offset + 0,
4578 _depth
4579 )?;
4580 fidl::decode!(
4581 fidl::encoding::BoundedString<32>,
4582 fidl::encoding::DefaultFuchsiaResourceDialect,
4583 &mut self.key_name,
4584 decoder,
4585 offset + 16,
4586 _depth
4587 )?;
4588 fidl::decode!(
4589 AsymmetricKeyAlgorithm,
4590 fidl::encoding::DefaultFuchsiaResourceDialect,
4591 &mut self.key_algorithm,
4592 decoder,
4593 offset + 32,
4594 _depth
4595 )?;
4596 fidl::decode!(
4597 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AsymmetricPrivateKeyMarker>>,
4598 fidl::encoding::DefaultFuchsiaResourceDialect,
4599 &mut self.key,
4600 decoder,
4601 offset + 36,
4602 _depth
4603 )?;
4604 Ok(())
4605 }
4606 }
4607
4608 impl fidl::encoding::ResourceTypeMarker for KeyManagerSealDataRequest {
4609 type Borrowed<'a> = &'a mut Self;
4610 fn take_or_borrow<'a>(
4611 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4612 ) -> Self::Borrowed<'a> {
4613 value
4614 }
4615 }
4616
4617 unsafe impl fidl::encoding::TypeMarker for KeyManagerSealDataRequest {
4618 type Owned = Self;
4619
4620 #[inline(always)]
4621 fn inline_align(_context: fidl::encoding::Context) -> usize {
4622 8
4623 }
4624
4625 #[inline(always)]
4626 fn inline_size(_context: fidl::encoding::Context) -> usize {
4627 16
4628 }
4629 }
4630
4631 unsafe impl
4632 fidl::encoding::Encode<
4633 KeyManagerSealDataRequest,
4634 fidl::encoding::DefaultFuchsiaResourceDialect,
4635 > for &mut KeyManagerSealDataRequest
4636 {
4637 #[inline]
4638 unsafe fn encode(
4639 self,
4640 encoder: &mut fidl::encoding::Encoder<
4641 '_,
4642 fidl::encoding::DefaultFuchsiaResourceDialect,
4643 >,
4644 offset: usize,
4645 _depth: fidl::encoding::Depth,
4646 ) -> fidl::Result<()> {
4647 encoder.debug_check_bounds::<KeyManagerSealDataRequest>(offset);
4648 fidl::encoding::Encode::<
4650 KeyManagerSealDataRequest,
4651 fidl::encoding::DefaultFuchsiaResourceDialect,
4652 >::encode(
4653 (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4654 &mut self.plain_text,
4655 ),),
4656 encoder,
4657 offset,
4658 _depth,
4659 )
4660 }
4661 }
4662 unsafe impl<
4663 T0: fidl::encoding::Encode<
4664 fidl_fuchsia_mem::Buffer,
4665 fidl::encoding::DefaultFuchsiaResourceDialect,
4666 >,
4667 >
4668 fidl::encoding::Encode<
4669 KeyManagerSealDataRequest,
4670 fidl::encoding::DefaultFuchsiaResourceDialect,
4671 > for (T0,)
4672 {
4673 #[inline]
4674 unsafe fn encode(
4675 self,
4676 encoder: &mut fidl::encoding::Encoder<
4677 '_,
4678 fidl::encoding::DefaultFuchsiaResourceDialect,
4679 >,
4680 offset: usize,
4681 depth: fidl::encoding::Depth,
4682 ) -> fidl::Result<()> {
4683 encoder.debug_check_bounds::<KeyManagerSealDataRequest>(offset);
4684 self.0.encode(encoder, offset + 0, depth)?;
4688 Ok(())
4689 }
4690 }
4691
4692 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4693 for KeyManagerSealDataRequest
4694 {
4695 #[inline(always)]
4696 fn new_empty() -> Self {
4697 Self {
4698 plain_text: fidl::new_empty!(
4699 fidl_fuchsia_mem::Buffer,
4700 fidl::encoding::DefaultFuchsiaResourceDialect
4701 ),
4702 }
4703 }
4704
4705 #[inline]
4706 unsafe fn decode(
4707 &mut self,
4708 decoder: &mut fidl::encoding::Decoder<
4709 '_,
4710 fidl::encoding::DefaultFuchsiaResourceDialect,
4711 >,
4712 offset: usize,
4713 _depth: fidl::encoding::Depth,
4714 ) -> fidl::Result<()> {
4715 decoder.debug_check_bounds::<Self>(offset);
4716 fidl::decode!(
4718 fidl_fuchsia_mem::Buffer,
4719 fidl::encoding::DefaultFuchsiaResourceDialect,
4720 &mut self.plain_text,
4721 decoder,
4722 offset + 0,
4723 _depth
4724 )?;
4725 Ok(())
4726 }
4727 }
4728
4729 impl fidl::encoding::ResourceTypeMarker for KeyManagerUnsealDataRequest {
4730 type Borrowed<'a> = &'a mut Self;
4731 fn take_or_borrow<'a>(
4732 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4733 ) -> Self::Borrowed<'a> {
4734 value
4735 }
4736 }
4737
4738 unsafe impl fidl::encoding::TypeMarker for KeyManagerUnsealDataRequest {
4739 type Owned = Self;
4740
4741 #[inline(always)]
4742 fn inline_align(_context: fidl::encoding::Context) -> usize {
4743 8
4744 }
4745
4746 #[inline(always)]
4747 fn inline_size(_context: fidl::encoding::Context) -> usize {
4748 16
4749 }
4750 }
4751
4752 unsafe impl
4753 fidl::encoding::Encode<
4754 KeyManagerUnsealDataRequest,
4755 fidl::encoding::DefaultFuchsiaResourceDialect,
4756 > for &mut KeyManagerUnsealDataRequest
4757 {
4758 #[inline]
4759 unsafe fn encode(
4760 self,
4761 encoder: &mut fidl::encoding::Encoder<
4762 '_,
4763 fidl::encoding::DefaultFuchsiaResourceDialect,
4764 >,
4765 offset: usize,
4766 _depth: fidl::encoding::Depth,
4767 ) -> fidl::Result<()> {
4768 encoder.debug_check_bounds::<KeyManagerUnsealDataRequest>(offset);
4769 fidl::encoding::Encode::<
4771 KeyManagerUnsealDataRequest,
4772 fidl::encoding::DefaultFuchsiaResourceDialect,
4773 >::encode(
4774 (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4775 &mut self.cipher_text,
4776 ),),
4777 encoder,
4778 offset,
4779 _depth,
4780 )
4781 }
4782 }
4783 unsafe impl<
4784 T0: fidl::encoding::Encode<
4785 fidl_fuchsia_mem::Buffer,
4786 fidl::encoding::DefaultFuchsiaResourceDialect,
4787 >,
4788 >
4789 fidl::encoding::Encode<
4790 KeyManagerUnsealDataRequest,
4791 fidl::encoding::DefaultFuchsiaResourceDialect,
4792 > for (T0,)
4793 {
4794 #[inline]
4795 unsafe fn encode(
4796 self,
4797 encoder: &mut fidl::encoding::Encoder<
4798 '_,
4799 fidl::encoding::DefaultFuchsiaResourceDialect,
4800 >,
4801 offset: usize,
4802 depth: fidl::encoding::Depth,
4803 ) -> fidl::Result<()> {
4804 encoder.debug_check_bounds::<KeyManagerUnsealDataRequest>(offset);
4805 self.0.encode(encoder, offset + 0, depth)?;
4809 Ok(())
4810 }
4811 }
4812
4813 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4814 for KeyManagerUnsealDataRequest
4815 {
4816 #[inline(always)]
4817 fn new_empty() -> Self {
4818 Self {
4819 cipher_text: fidl::new_empty!(
4820 fidl_fuchsia_mem::Buffer,
4821 fidl::encoding::DefaultFuchsiaResourceDialect
4822 ),
4823 }
4824 }
4825
4826 #[inline]
4827 unsafe fn decode(
4828 &mut self,
4829 decoder: &mut fidl::encoding::Decoder<
4830 '_,
4831 fidl::encoding::DefaultFuchsiaResourceDialect,
4832 >,
4833 offset: usize,
4834 _depth: fidl::encoding::Depth,
4835 ) -> fidl::Result<()> {
4836 decoder.debug_check_bounds::<Self>(offset);
4837 fidl::decode!(
4839 fidl_fuchsia_mem::Buffer,
4840 fidl::encoding::DefaultFuchsiaResourceDialect,
4841 &mut self.cipher_text,
4842 decoder,
4843 offset + 0,
4844 _depth
4845 )?;
4846 Ok(())
4847 }
4848 }
4849
4850 impl fidl::encoding::ResourceTypeMarker for KeyManagerSealDataResponse {
4851 type Borrowed<'a> = &'a mut Self;
4852 fn take_or_borrow<'a>(
4853 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4854 ) -> Self::Borrowed<'a> {
4855 value
4856 }
4857 }
4858
4859 unsafe impl fidl::encoding::TypeMarker for KeyManagerSealDataResponse {
4860 type Owned = Self;
4861
4862 #[inline(always)]
4863 fn inline_align(_context: fidl::encoding::Context) -> usize {
4864 8
4865 }
4866
4867 #[inline(always)]
4868 fn inline_size(_context: fidl::encoding::Context) -> usize {
4869 16
4870 }
4871 }
4872
4873 unsafe impl
4874 fidl::encoding::Encode<
4875 KeyManagerSealDataResponse,
4876 fidl::encoding::DefaultFuchsiaResourceDialect,
4877 > for &mut KeyManagerSealDataResponse
4878 {
4879 #[inline]
4880 unsafe fn encode(
4881 self,
4882 encoder: &mut fidl::encoding::Encoder<
4883 '_,
4884 fidl::encoding::DefaultFuchsiaResourceDialect,
4885 >,
4886 offset: usize,
4887 _depth: fidl::encoding::Depth,
4888 ) -> fidl::Result<()> {
4889 encoder.debug_check_bounds::<KeyManagerSealDataResponse>(offset);
4890 fidl::encoding::Encode::<
4892 KeyManagerSealDataResponse,
4893 fidl::encoding::DefaultFuchsiaResourceDialect,
4894 >::encode(
4895 (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4896 &mut self.cipher_text,
4897 ),),
4898 encoder,
4899 offset,
4900 _depth,
4901 )
4902 }
4903 }
4904 unsafe impl<
4905 T0: fidl::encoding::Encode<
4906 fidl_fuchsia_mem::Buffer,
4907 fidl::encoding::DefaultFuchsiaResourceDialect,
4908 >,
4909 >
4910 fidl::encoding::Encode<
4911 KeyManagerSealDataResponse,
4912 fidl::encoding::DefaultFuchsiaResourceDialect,
4913 > for (T0,)
4914 {
4915 #[inline]
4916 unsafe fn encode(
4917 self,
4918 encoder: &mut fidl::encoding::Encoder<
4919 '_,
4920 fidl::encoding::DefaultFuchsiaResourceDialect,
4921 >,
4922 offset: usize,
4923 depth: fidl::encoding::Depth,
4924 ) -> fidl::Result<()> {
4925 encoder.debug_check_bounds::<KeyManagerSealDataResponse>(offset);
4926 self.0.encode(encoder, offset + 0, depth)?;
4930 Ok(())
4931 }
4932 }
4933
4934 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4935 for KeyManagerSealDataResponse
4936 {
4937 #[inline(always)]
4938 fn new_empty() -> Self {
4939 Self {
4940 cipher_text: fidl::new_empty!(
4941 fidl_fuchsia_mem::Buffer,
4942 fidl::encoding::DefaultFuchsiaResourceDialect
4943 ),
4944 }
4945 }
4946
4947 #[inline]
4948 unsafe fn decode(
4949 &mut self,
4950 decoder: &mut fidl::encoding::Decoder<
4951 '_,
4952 fidl::encoding::DefaultFuchsiaResourceDialect,
4953 >,
4954 offset: usize,
4955 _depth: fidl::encoding::Depth,
4956 ) -> fidl::Result<()> {
4957 decoder.debug_check_bounds::<Self>(offset);
4958 fidl::decode!(
4960 fidl_fuchsia_mem::Buffer,
4961 fidl::encoding::DefaultFuchsiaResourceDialect,
4962 &mut self.cipher_text,
4963 decoder,
4964 offset + 0,
4965 _depth
4966 )?;
4967 Ok(())
4968 }
4969 }
4970
4971 impl fidl::encoding::ResourceTypeMarker for KeyManagerUnsealDataResponse {
4972 type Borrowed<'a> = &'a mut Self;
4973 fn take_or_borrow<'a>(
4974 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4975 ) -> Self::Borrowed<'a> {
4976 value
4977 }
4978 }
4979
4980 unsafe impl fidl::encoding::TypeMarker for KeyManagerUnsealDataResponse {
4981 type Owned = Self;
4982
4983 #[inline(always)]
4984 fn inline_align(_context: fidl::encoding::Context) -> usize {
4985 8
4986 }
4987
4988 #[inline(always)]
4989 fn inline_size(_context: fidl::encoding::Context) -> usize {
4990 16
4991 }
4992 }
4993
4994 unsafe impl
4995 fidl::encoding::Encode<
4996 KeyManagerUnsealDataResponse,
4997 fidl::encoding::DefaultFuchsiaResourceDialect,
4998 > for &mut KeyManagerUnsealDataResponse
4999 {
5000 #[inline]
5001 unsafe fn encode(
5002 self,
5003 encoder: &mut fidl::encoding::Encoder<
5004 '_,
5005 fidl::encoding::DefaultFuchsiaResourceDialect,
5006 >,
5007 offset: usize,
5008 _depth: fidl::encoding::Depth,
5009 ) -> fidl::Result<()> {
5010 encoder.debug_check_bounds::<KeyManagerUnsealDataResponse>(offset);
5011 fidl::encoding::Encode::<
5013 KeyManagerUnsealDataResponse,
5014 fidl::encoding::DefaultFuchsiaResourceDialect,
5015 >::encode(
5016 (<fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5017 &mut self.plain_text,
5018 ),),
5019 encoder,
5020 offset,
5021 _depth,
5022 )
5023 }
5024 }
5025 unsafe impl<
5026 T0: fidl::encoding::Encode<
5027 fidl_fuchsia_mem::Buffer,
5028 fidl::encoding::DefaultFuchsiaResourceDialect,
5029 >,
5030 >
5031 fidl::encoding::Encode<
5032 KeyManagerUnsealDataResponse,
5033 fidl::encoding::DefaultFuchsiaResourceDialect,
5034 > for (T0,)
5035 {
5036 #[inline]
5037 unsafe fn encode(
5038 self,
5039 encoder: &mut fidl::encoding::Encoder<
5040 '_,
5041 fidl::encoding::DefaultFuchsiaResourceDialect,
5042 >,
5043 offset: usize,
5044 depth: fidl::encoding::Depth,
5045 ) -> fidl::Result<()> {
5046 encoder.debug_check_bounds::<KeyManagerUnsealDataResponse>(offset);
5047 self.0.encode(encoder, offset + 0, depth)?;
5051 Ok(())
5052 }
5053 }
5054
5055 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5056 for KeyManagerUnsealDataResponse
5057 {
5058 #[inline(always)]
5059 fn new_empty() -> Self {
5060 Self {
5061 plain_text: fidl::new_empty!(
5062 fidl_fuchsia_mem::Buffer,
5063 fidl::encoding::DefaultFuchsiaResourceDialect
5064 ),
5065 }
5066 }
5067
5068 #[inline]
5069 unsafe fn decode(
5070 &mut self,
5071 decoder: &mut fidl::encoding::Decoder<
5072 '_,
5073 fidl::encoding::DefaultFuchsiaResourceDialect,
5074 >,
5075 offset: usize,
5076 _depth: fidl::encoding::Depth,
5077 ) -> fidl::Result<()> {
5078 decoder.debug_check_bounds::<Self>(offset);
5079 fidl::decode!(
5081 fidl_fuchsia_mem::Buffer,
5082 fidl::encoding::DefaultFuchsiaResourceDialect,
5083 &mut self.plain_text,
5084 decoder,
5085 offset + 0,
5086 _depth
5087 )?;
5088 Ok(())
5089 }
5090 }
5091}