1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_DATA_SIZE: u32 = 65536;
12
13pub const MAX_HARDWARE_DERIVED_KEY_SIZE: u8 = 32;
14
15pub const MAX_HARDWARE_DERIVE_KEY_INFO_SIZE: u8 = 32;
16
17pub const MAX_KEY_NAME_SIZE: u8 = 32;
18
19#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
20#[repr(u32)]
21pub enum AsymmetricKeyAlgorithm {
22 RsaSsaPssSha2562048 = 1,
23 RsaSsaPssSha2563072 = 2,
24 RsaSsaPssSha5124096 = 3,
25 RsaSsaPkcs1Sha2562048 = 4,
26 RsaSsaPkcs1Sha2563072 = 5,
27 RsaSsaPkcs1Sha5124096 = 6,
28 EcdsaSha256P256 = 7,
29 EcdsaSha512P384 = 8,
30 EcdsaSha512P521 = 9,
31}
32
33impl AsymmetricKeyAlgorithm {
34 #[inline]
35 pub fn from_primitive(prim: u32) -> Option<Self> {
36 match prim {
37 1 => Some(Self::RsaSsaPssSha2562048),
38 2 => Some(Self::RsaSsaPssSha2563072),
39 3 => Some(Self::RsaSsaPssSha5124096),
40 4 => Some(Self::RsaSsaPkcs1Sha2562048),
41 5 => Some(Self::RsaSsaPkcs1Sha2563072),
42 6 => Some(Self::RsaSsaPkcs1Sha5124096),
43 7 => Some(Self::EcdsaSha256P256),
44 8 => Some(Self::EcdsaSha512P384),
45 9 => Some(Self::EcdsaSha512P521),
46 _ => None,
47 }
48 }
49
50 #[inline]
51 pub const fn into_primitive(self) -> u32 {
52 self as u32
53 }
54
55 #[deprecated = "Strict enums should not use `is_unknown`"]
56 #[inline]
57 pub fn is_unknown(&self) -> bool {
58 false
59 }
60}
61
62#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
63#[repr(u32)]
64pub enum Error {
65 InternalError = 1,
67 KeyAlreadyExists = 2,
69 KeyNotFound = 3,
71 ParseKeyError = 4,
73 InputTooLarge = 5,
75}
76
77impl Error {
78 #[inline]
79 pub fn from_primitive(prim: u32) -> Option<Self> {
80 match prim {
81 1 => Some(Self::InternalError),
82 2 => Some(Self::KeyAlreadyExists),
83 3 => Some(Self::KeyNotFound),
84 4 => Some(Self::ParseKeyError),
85 5 => Some(Self::InputTooLarge),
86 _ => None,
87 }
88 }
89
90 #[inline]
91 pub const fn into_primitive(self) -> u32 {
92 self as u32
93 }
94
95 #[deprecated = "Strict enums should not use `is_unknown`"]
96 #[inline]
97 pub fn is_unknown(&self) -> bool {
98 false
99 }
100}
101
102#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
103#[repr(u32)]
104pub enum KeyOrigin {
105 Generated = 1,
107 Imported = 2,
109}
110
111impl KeyOrigin {
112 #[inline]
113 pub fn from_primitive(prim: u32) -> Option<Self> {
114 match prim {
115 1 => Some(Self::Generated),
116 2 => Some(Self::Imported),
117 _ => None,
118 }
119 }
120
121 #[inline]
122 pub const fn into_primitive(self) -> u32 {
123 self as u32
124 }
125
126 #[deprecated = "Strict enums should not use `is_unknown`"]
127 #[inline]
128 pub fn is_unknown(&self) -> bool {
129 false
130 }
131}
132
133#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
134#[repr(u32)]
135pub enum KeyProvider {
136 MockProvider = 1,
138 SoftwareProvider = 2,
141 SoftwareAsymmetricOnlyProvider = 3,
143 OpteeProvider = 4,
145}
146
147impl KeyProvider {
148 #[inline]
149 pub fn from_primitive(prim: u32) -> Option<Self> {
150 match prim {
151 1 => Some(Self::MockProvider),
152 2 => Some(Self::SoftwareProvider),
153 3 => Some(Self::SoftwareAsymmetricOnlyProvider),
154 4 => Some(Self::OpteeProvider),
155 _ => None,
156 }
157 }
158
159 #[inline]
160 pub const fn into_primitive(self) -> u32 {
161 self as u32
162 }
163
164 #[deprecated = "Strict enums should not use `is_unknown`"]
165 #[inline]
166 pub fn is_unknown(&self) -> bool {
167 false
168 }
169}
170
171#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
172pub struct AsymmetricPrivateKeyGetKeyAlgorithmResponse {
173 pub key_algorithm: AsymmetricKeyAlgorithm,
174}
175
176impl fidl::Persistable for AsymmetricPrivateKeyGetKeyAlgorithmResponse {}
177
178#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
179pub struct AsymmetricPrivateKeyGetPublicKeyResponse {
180 pub public_key: PublicKey,
181}
182
183impl fidl::Persistable for AsymmetricPrivateKeyGetPublicKeyResponse {}
184
185#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
186pub struct AsymmetricPrivateKeySignResponse {
187 pub signature: Signature,
188}
189
190impl fidl::Persistable for AsymmetricPrivateKeySignResponse {}
191
192#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
193pub struct KeyManagerDeleteKeyRequest {
194 pub key_name: String,
195}
196
197impl fidl::Persistable for KeyManagerDeleteKeyRequest {}
198
199#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
200pub struct KeyGetKeyOriginResponse {
201 pub key_origin: KeyOrigin,
202}
203
204impl fidl::Persistable for KeyGetKeyOriginResponse {}
205
206#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
207pub struct KeyGetKeyProviderResponse {
208 pub key_provider: KeyProvider,
209}
210
211impl fidl::Persistable for KeyGetKeyProviderResponse {}
212
213#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
214pub struct PublicKey {
215 pub bytes: Vec<u8>,
216}
217
218impl fidl::Persistable for PublicKey {}
219
220#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
221pub struct Signature {
222 pub bytes: Vec<u8>,
223}
224
225impl fidl::Persistable for Signature {}
226
227#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
228pub struct StatelessKeyManagerGetHardwareDerivedKeyRequest {
229 pub key_info: Vec<u8>,
230}
231
232impl fidl::Persistable for StatelessKeyManagerGetHardwareDerivedKeyRequest {}
233
234#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
235pub struct StatelessKeyManagerGetHardwareDerivedKeyResponse {
236 pub derived_key: Vec<u8>,
237}
238
239impl fidl::Persistable for StatelessKeyManagerGetHardwareDerivedKeyResponse {}
240
241mod internal {
242 use super::*;
243 unsafe impl fidl::encoding::TypeMarker for AsymmetricKeyAlgorithm {
244 type Owned = Self;
245
246 #[inline(always)]
247 fn inline_align(_context: fidl::encoding::Context) -> usize {
248 std::mem::align_of::<u32>()
249 }
250
251 #[inline(always)]
252 fn inline_size(_context: fidl::encoding::Context) -> usize {
253 std::mem::size_of::<u32>()
254 }
255
256 #[inline(always)]
257 fn encode_is_copy() -> bool {
258 true
259 }
260
261 #[inline(always)]
262 fn decode_is_copy() -> bool {
263 false
264 }
265 }
266
267 impl fidl::encoding::ValueTypeMarker for AsymmetricKeyAlgorithm {
268 type Borrowed<'a> = Self;
269 #[inline(always)]
270 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
271 *value
272 }
273 }
274
275 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
276 for AsymmetricKeyAlgorithm
277 {
278 #[inline]
279 unsafe fn encode(
280 self,
281 encoder: &mut fidl::encoding::Encoder<'_, D>,
282 offset: usize,
283 _depth: fidl::encoding::Depth,
284 ) -> fidl::Result<()> {
285 encoder.debug_check_bounds::<Self>(offset);
286 encoder.write_num(self.into_primitive(), offset);
287 Ok(())
288 }
289 }
290
291 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
292 for AsymmetricKeyAlgorithm
293 {
294 #[inline(always)]
295 fn new_empty() -> Self {
296 Self::RsaSsaPssSha2562048
297 }
298
299 #[inline]
300 unsafe fn decode(
301 &mut self,
302 decoder: &mut fidl::encoding::Decoder<'_, D>,
303 offset: usize,
304 _depth: fidl::encoding::Depth,
305 ) -> fidl::Result<()> {
306 decoder.debug_check_bounds::<Self>(offset);
307 let prim = decoder.read_num::<u32>(offset);
308
309 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
310 Ok(())
311 }
312 }
313 unsafe impl fidl::encoding::TypeMarker for Error {
314 type Owned = Self;
315
316 #[inline(always)]
317 fn inline_align(_context: fidl::encoding::Context) -> usize {
318 std::mem::align_of::<u32>()
319 }
320
321 #[inline(always)]
322 fn inline_size(_context: fidl::encoding::Context) -> usize {
323 std::mem::size_of::<u32>()
324 }
325
326 #[inline(always)]
327 fn encode_is_copy() -> bool {
328 true
329 }
330
331 #[inline(always)]
332 fn decode_is_copy() -> bool {
333 false
334 }
335 }
336
337 impl fidl::encoding::ValueTypeMarker for Error {
338 type Borrowed<'a> = Self;
339 #[inline(always)]
340 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
341 *value
342 }
343 }
344
345 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
346 #[inline]
347 unsafe fn encode(
348 self,
349 encoder: &mut fidl::encoding::Encoder<'_, D>,
350 offset: usize,
351 _depth: fidl::encoding::Depth,
352 ) -> fidl::Result<()> {
353 encoder.debug_check_bounds::<Self>(offset);
354 encoder.write_num(self.into_primitive(), offset);
355 Ok(())
356 }
357 }
358
359 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
360 #[inline(always)]
361 fn new_empty() -> Self {
362 Self::InternalError
363 }
364
365 #[inline]
366 unsafe fn decode(
367 &mut self,
368 decoder: &mut fidl::encoding::Decoder<'_, D>,
369 offset: usize,
370 _depth: fidl::encoding::Depth,
371 ) -> fidl::Result<()> {
372 decoder.debug_check_bounds::<Self>(offset);
373 let prim = decoder.read_num::<u32>(offset);
374
375 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
376 Ok(())
377 }
378 }
379 unsafe impl fidl::encoding::TypeMarker for KeyOrigin {
380 type Owned = Self;
381
382 #[inline(always)]
383 fn inline_align(_context: fidl::encoding::Context) -> usize {
384 std::mem::align_of::<u32>()
385 }
386
387 #[inline(always)]
388 fn inline_size(_context: fidl::encoding::Context) -> usize {
389 std::mem::size_of::<u32>()
390 }
391
392 #[inline(always)]
393 fn encode_is_copy() -> bool {
394 true
395 }
396
397 #[inline(always)]
398 fn decode_is_copy() -> bool {
399 false
400 }
401 }
402
403 impl fidl::encoding::ValueTypeMarker for KeyOrigin {
404 type Borrowed<'a> = Self;
405 #[inline(always)]
406 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
407 *value
408 }
409 }
410
411 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyOrigin {
412 #[inline]
413 unsafe fn encode(
414 self,
415 encoder: &mut fidl::encoding::Encoder<'_, D>,
416 offset: usize,
417 _depth: fidl::encoding::Depth,
418 ) -> fidl::Result<()> {
419 encoder.debug_check_bounds::<Self>(offset);
420 encoder.write_num(self.into_primitive(), offset);
421 Ok(())
422 }
423 }
424
425 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyOrigin {
426 #[inline(always)]
427 fn new_empty() -> Self {
428 Self::Generated
429 }
430
431 #[inline]
432 unsafe fn decode(
433 &mut self,
434 decoder: &mut fidl::encoding::Decoder<'_, D>,
435 offset: usize,
436 _depth: fidl::encoding::Depth,
437 ) -> fidl::Result<()> {
438 decoder.debug_check_bounds::<Self>(offset);
439 let prim = decoder.read_num::<u32>(offset);
440
441 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
442 Ok(())
443 }
444 }
445 unsafe impl fidl::encoding::TypeMarker for KeyProvider {
446 type Owned = Self;
447
448 #[inline(always)]
449 fn inline_align(_context: fidl::encoding::Context) -> usize {
450 std::mem::align_of::<u32>()
451 }
452
453 #[inline(always)]
454 fn inline_size(_context: fidl::encoding::Context) -> usize {
455 std::mem::size_of::<u32>()
456 }
457
458 #[inline(always)]
459 fn encode_is_copy() -> bool {
460 true
461 }
462
463 #[inline(always)]
464 fn decode_is_copy() -> bool {
465 false
466 }
467 }
468
469 impl fidl::encoding::ValueTypeMarker for KeyProvider {
470 type Borrowed<'a> = Self;
471 #[inline(always)]
472 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
473 *value
474 }
475 }
476
477 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyProvider {
478 #[inline]
479 unsafe fn encode(
480 self,
481 encoder: &mut fidl::encoding::Encoder<'_, D>,
482 offset: usize,
483 _depth: fidl::encoding::Depth,
484 ) -> fidl::Result<()> {
485 encoder.debug_check_bounds::<Self>(offset);
486 encoder.write_num(self.into_primitive(), offset);
487 Ok(())
488 }
489 }
490
491 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyProvider {
492 #[inline(always)]
493 fn new_empty() -> Self {
494 Self::MockProvider
495 }
496
497 #[inline]
498 unsafe fn decode(
499 &mut self,
500 decoder: &mut fidl::encoding::Decoder<'_, D>,
501 offset: usize,
502 _depth: fidl::encoding::Depth,
503 ) -> fidl::Result<()> {
504 decoder.debug_check_bounds::<Self>(offset);
505 let prim = decoder.read_num::<u32>(offset);
506
507 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
508 Ok(())
509 }
510 }
511
512 impl fidl::encoding::ValueTypeMarker for AsymmetricPrivateKeyGetKeyAlgorithmResponse {
513 type Borrowed<'a> = &'a Self;
514 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
515 value
516 }
517 }
518
519 unsafe impl fidl::encoding::TypeMarker for AsymmetricPrivateKeyGetKeyAlgorithmResponse {
520 type Owned = Self;
521
522 #[inline(always)]
523 fn inline_align(_context: fidl::encoding::Context) -> usize {
524 4
525 }
526
527 #[inline(always)]
528 fn inline_size(_context: fidl::encoding::Context) -> usize {
529 4
530 }
531 }
532
533 unsafe impl<D: fidl::encoding::ResourceDialect>
534 fidl::encoding::Encode<AsymmetricPrivateKeyGetKeyAlgorithmResponse, D>
535 for &AsymmetricPrivateKeyGetKeyAlgorithmResponse
536 {
537 #[inline]
538 unsafe fn encode(
539 self,
540 encoder: &mut fidl::encoding::Encoder<'_, D>,
541 offset: usize,
542 _depth: fidl::encoding::Depth,
543 ) -> fidl::Result<()> {
544 encoder.debug_check_bounds::<AsymmetricPrivateKeyGetKeyAlgorithmResponse>(offset);
545 fidl::encoding::Encode::<AsymmetricPrivateKeyGetKeyAlgorithmResponse, D>::encode(
547 (<AsymmetricKeyAlgorithm as fidl::encoding::ValueTypeMarker>::borrow(
548 &self.key_algorithm,
549 ),),
550 encoder,
551 offset,
552 _depth,
553 )
554 }
555 }
556 unsafe impl<
557 D: fidl::encoding::ResourceDialect,
558 T0: fidl::encoding::Encode<AsymmetricKeyAlgorithm, D>,
559 > fidl::encoding::Encode<AsymmetricPrivateKeyGetKeyAlgorithmResponse, D> for (T0,)
560 {
561 #[inline]
562 unsafe fn encode(
563 self,
564 encoder: &mut fidl::encoding::Encoder<'_, D>,
565 offset: usize,
566 depth: fidl::encoding::Depth,
567 ) -> fidl::Result<()> {
568 encoder.debug_check_bounds::<AsymmetricPrivateKeyGetKeyAlgorithmResponse>(offset);
569 self.0.encode(encoder, offset + 0, depth)?;
573 Ok(())
574 }
575 }
576
577 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
578 for AsymmetricPrivateKeyGetKeyAlgorithmResponse
579 {
580 #[inline(always)]
581 fn new_empty() -> Self {
582 Self { key_algorithm: fidl::new_empty!(AsymmetricKeyAlgorithm, D) }
583 }
584
585 #[inline]
586 unsafe fn decode(
587 &mut self,
588 decoder: &mut fidl::encoding::Decoder<'_, D>,
589 offset: usize,
590 _depth: fidl::encoding::Depth,
591 ) -> fidl::Result<()> {
592 decoder.debug_check_bounds::<Self>(offset);
593 fidl::decode!(
595 AsymmetricKeyAlgorithm,
596 D,
597 &mut self.key_algorithm,
598 decoder,
599 offset + 0,
600 _depth
601 )?;
602 Ok(())
603 }
604 }
605
606 impl fidl::encoding::ValueTypeMarker for AsymmetricPrivateKeyGetPublicKeyResponse {
607 type Borrowed<'a> = &'a Self;
608 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
609 value
610 }
611 }
612
613 unsafe impl fidl::encoding::TypeMarker for AsymmetricPrivateKeyGetPublicKeyResponse {
614 type Owned = Self;
615
616 #[inline(always)]
617 fn inline_align(_context: fidl::encoding::Context) -> usize {
618 8
619 }
620
621 #[inline(always)]
622 fn inline_size(_context: fidl::encoding::Context) -> usize {
623 16
624 }
625 }
626
627 unsafe impl<D: fidl::encoding::ResourceDialect>
628 fidl::encoding::Encode<AsymmetricPrivateKeyGetPublicKeyResponse, D>
629 for &AsymmetricPrivateKeyGetPublicKeyResponse
630 {
631 #[inline]
632 unsafe fn encode(
633 self,
634 encoder: &mut fidl::encoding::Encoder<'_, D>,
635 offset: usize,
636 _depth: fidl::encoding::Depth,
637 ) -> fidl::Result<()> {
638 encoder.debug_check_bounds::<AsymmetricPrivateKeyGetPublicKeyResponse>(offset);
639 fidl::encoding::Encode::<AsymmetricPrivateKeyGetPublicKeyResponse, D>::encode(
641 (<PublicKey as fidl::encoding::ValueTypeMarker>::borrow(&self.public_key),),
642 encoder,
643 offset,
644 _depth,
645 )
646 }
647 }
648 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PublicKey, D>>
649 fidl::encoding::Encode<AsymmetricPrivateKeyGetPublicKeyResponse, D> for (T0,)
650 {
651 #[inline]
652 unsafe fn encode(
653 self,
654 encoder: &mut fidl::encoding::Encoder<'_, D>,
655 offset: usize,
656 depth: fidl::encoding::Depth,
657 ) -> fidl::Result<()> {
658 encoder.debug_check_bounds::<AsymmetricPrivateKeyGetPublicKeyResponse>(offset);
659 self.0.encode(encoder, offset + 0, depth)?;
663 Ok(())
664 }
665 }
666
667 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
668 for AsymmetricPrivateKeyGetPublicKeyResponse
669 {
670 #[inline(always)]
671 fn new_empty() -> Self {
672 Self { public_key: fidl::new_empty!(PublicKey, D) }
673 }
674
675 #[inline]
676 unsafe fn decode(
677 &mut self,
678 decoder: &mut fidl::encoding::Decoder<'_, D>,
679 offset: usize,
680 _depth: fidl::encoding::Depth,
681 ) -> fidl::Result<()> {
682 decoder.debug_check_bounds::<Self>(offset);
683 fidl::decode!(PublicKey, D, &mut self.public_key, decoder, offset + 0, _depth)?;
685 Ok(())
686 }
687 }
688
689 impl fidl::encoding::ValueTypeMarker for AsymmetricPrivateKeySignResponse {
690 type Borrowed<'a> = &'a Self;
691 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
692 value
693 }
694 }
695
696 unsafe impl fidl::encoding::TypeMarker for AsymmetricPrivateKeySignResponse {
697 type Owned = Self;
698
699 #[inline(always)]
700 fn inline_align(_context: fidl::encoding::Context) -> usize {
701 8
702 }
703
704 #[inline(always)]
705 fn inline_size(_context: fidl::encoding::Context) -> usize {
706 16
707 }
708 }
709
710 unsafe impl<D: fidl::encoding::ResourceDialect>
711 fidl::encoding::Encode<AsymmetricPrivateKeySignResponse, D>
712 for &AsymmetricPrivateKeySignResponse
713 {
714 #[inline]
715 unsafe fn encode(
716 self,
717 encoder: &mut fidl::encoding::Encoder<'_, D>,
718 offset: usize,
719 _depth: fidl::encoding::Depth,
720 ) -> fidl::Result<()> {
721 encoder.debug_check_bounds::<AsymmetricPrivateKeySignResponse>(offset);
722 fidl::encoding::Encode::<AsymmetricPrivateKeySignResponse, D>::encode(
724 (<Signature as fidl::encoding::ValueTypeMarker>::borrow(&self.signature),),
725 encoder,
726 offset,
727 _depth,
728 )
729 }
730 }
731 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Signature, D>>
732 fidl::encoding::Encode<AsymmetricPrivateKeySignResponse, D> for (T0,)
733 {
734 #[inline]
735 unsafe fn encode(
736 self,
737 encoder: &mut fidl::encoding::Encoder<'_, D>,
738 offset: usize,
739 depth: fidl::encoding::Depth,
740 ) -> fidl::Result<()> {
741 encoder.debug_check_bounds::<AsymmetricPrivateKeySignResponse>(offset);
742 self.0.encode(encoder, offset + 0, depth)?;
746 Ok(())
747 }
748 }
749
750 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
751 for AsymmetricPrivateKeySignResponse
752 {
753 #[inline(always)]
754 fn new_empty() -> Self {
755 Self { signature: fidl::new_empty!(Signature, D) }
756 }
757
758 #[inline]
759 unsafe fn decode(
760 &mut self,
761 decoder: &mut fidl::encoding::Decoder<'_, D>,
762 offset: usize,
763 _depth: fidl::encoding::Depth,
764 ) -> fidl::Result<()> {
765 decoder.debug_check_bounds::<Self>(offset);
766 fidl::decode!(Signature, D, &mut self.signature, decoder, offset + 0, _depth)?;
768 Ok(())
769 }
770 }
771
772 impl fidl::encoding::ValueTypeMarker for KeyManagerDeleteKeyRequest {
773 type Borrowed<'a> = &'a Self;
774 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
775 value
776 }
777 }
778
779 unsafe impl fidl::encoding::TypeMarker for KeyManagerDeleteKeyRequest {
780 type Owned = Self;
781
782 #[inline(always)]
783 fn inline_align(_context: fidl::encoding::Context) -> usize {
784 8
785 }
786
787 #[inline(always)]
788 fn inline_size(_context: fidl::encoding::Context) -> usize {
789 16
790 }
791 }
792
793 unsafe impl<D: fidl::encoding::ResourceDialect>
794 fidl::encoding::Encode<KeyManagerDeleteKeyRequest, D> for &KeyManagerDeleteKeyRequest
795 {
796 #[inline]
797 unsafe fn encode(
798 self,
799 encoder: &mut fidl::encoding::Encoder<'_, D>,
800 offset: usize,
801 _depth: fidl::encoding::Depth,
802 ) -> fidl::Result<()> {
803 encoder.debug_check_bounds::<KeyManagerDeleteKeyRequest>(offset);
804 fidl::encoding::Encode::<KeyManagerDeleteKeyRequest, D>::encode(
806 (<fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
807 &self.key_name,
808 ),),
809 encoder,
810 offset,
811 _depth,
812 )
813 }
814 }
815 unsafe impl<
816 D: fidl::encoding::ResourceDialect,
817 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<32>, D>,
818 > fidl::encoding::Encode<KeyManagerDeleteKeyRequest, D> for (T0,)
819 {
820 #[inline]
821 unsafe fn encode(
822 self,
823 encoder: &mut fidl::encoding::Encoder<'_, D>,
824 offset: usize,
825 depth: fidl::encoding::Depth,
826 ) -> fidl::Result<()> {
827 encoder.debug_check_bounds::<KeyManagerDeleteKeyRequest>(offset);
828 self.0.encode(encoder, offset + 0, depth)?;
832 Ok(())
833 }
834 }
835
836 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
837 for KeyManagerDeleteKeyRequest
838 {
839 #[inline(always)]
840 fn new_empty() -> Self {
841 Self { key_name: fidl::new_empty!(fidl::encoding::BoundedString<32>, D) }
842 }
843
844 #[inline]
845 unsafe fn decode(
846 &mut self,
847 decoder: &mut fidl::encoding::Decoder<'_, D>,
848 offset: usize,
849 _depth: fidl::encoding::Depth,
850 ) -> fidl::Result<()> {
851 decoder.debug_check_bounds::<Self>(offset);
852 fidl::decode!(
854 fidl::encoding::BoundedString<32>,
855 D,
856 &mut self.key_name,
857 decoder,
858 offset + 0,
859 _depth
860 )?;
861 Ok(())
862 }
863 }
864
865 impl fidl::encoding::ValueTypeMarker for KeyGetKeyOriginResponse {
866 type Borrowed<'a> = &'a Self;
867 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
868 value
869 }
870 }
871
872 unsafe impl fidl::encoding::TypeMarker for KeyGetKeyOriginResponse {
873 type Owned = Self;
874
875 #[inline(always)]
876 fn inline_align(_context: fidl::encoding::Context) -> usize {
877 4
878 }
879
880 #[inline(always)]
881 fn inline_size(_context: fidl::encoding::Context) -> usize {
882 4
883 }
884 }
885
886 unsafe impl<D: fidl::encoding::ResourceDialect>
887 fidl::encoding::Encode<KeyGetKeyOriginResponse, D> for &KeyGetKeyOriginResponse
888 {
889 #[inline]
890 unsafe fn encode(
891 self,
892 encoder: &mut fidl::encoding::Encoder<'_, D>,
893 offset: usize,
894 _depth: fidl::encoding::Depth,
895 ) -> fidl::Result<()> {
896 encoder.debug_check_bounds::<KeyGetKeyOriginResponse>(offset);
897 fidl::encoding::Encode::<KeyGetKeyOriginResponse, D>::encode(
899 (<KeyOrigin as fidl::encoding::ValueTypeMarker>::borrow(&self.key_origin),),
900 encoder,
901 offset,
902 _depth,
903 )
904 }
905 }
906 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<KeyOrigin, D>>
907 fidl::encoding::Encode<KeyGetKeyOriginResponse, D> for (T0,)
908 {
909 #[inline]
910 unsafe fn encode(
911 self,
912 encoder: &mut fidl::encoding::Encoder<'_, D>,
913 offset: usize,
914 depth: fidl::encoding::Depth,
915 ) -> fidl::Result<()> {
916 encoder.debug_check_bounds::<KeyGetKeyOriginResponse>(offset);
917 self.0.encode(encoder, offset + 0, depth)?;
921 Ok(())
922 }
923 }
924
925 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
926 for KeyGetKeyOriginResponse
927 {
928 #[inline(always)]
929 fn new_empty() -> Self {
930 Self { key_origin: fidl::new_empty!(KeyOrigin, D) }
931 }
932
933 #[inline]
934 unsafe fn decode(
935 &mut self,
936 decoder: &mut fidl::encoding::Decoder<'_, D>,
937 offset: usize,
938 _depth: fidl::encoding::Depth,
939 ) -> fidl::Result<()> {
940 decoder.debug_check_bounds::<Self>(offset);
941 fidl::decode!(KeyOrigin, D, &mut self.key_origin, decoder, offset + 0, _depth)?;
943 Ok(())
944 }
945 }
946
947 impl fidl::encoding::ValueTypeMarker for KeyGetKeyProviderResponse {
948 type Borrowed<'a> = &'a Self;
949 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
950 value
951 }
952 }
953
954 unsafe impl fidl::encoding::TypeMarker for KeyGetKeyProviderResponse {
955 type Owned = Self;
956
957 #[inline(always)]
958 fn inline_align(_context: fidl::encoding::Context) -> usize {
959 4
960 }
961
962 #[inline(always)]
963 fn inline_size(_context: fidl::encoding::Context) -> usize {
964 4
965 }
966 }
967
968 unsafe impl<D: fidl::encoding::ResourceDialect>
969 fidl::encoding::Encode<KeyGetKeyProviderResponse, D> for &KeyGetKeyProviderResponse
970 {
971 #[inline]
972 unsafe fn encode(
973 self,
974 encoder: &mut fidl::encoding::Encoder<'_, D>,
975 offset: usize,
976 _depth: fidl::encoding::Depth,
977 ) -> fidl::Result<()> {
978 encoder.debug_check_bounds::<KeyGetKeyProviderResponse>(offset);
979 fidl::encoding::Encode::<KeyGetKeyProviderResponse, D>::encode(
981 (<KeyProvider as fidl::encoding::ValueTypeMarker>::borrow(&self.key_provider),),
982 encoder,
983 offset,
984 _depth,
985 )
986 }
987 }
988 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<KeyProvider, D>>
989 fidl::encoding::Encode<KeyGetKeyProviderResponse, D> for (T0,)
990 {
991 #[inline]
992 unsafe fn encode(
993 self,
994 encoder: &mut fidl::encoding::Encoder<'_, D>,
995 offset: usize,
996 depth: fidl::encoding::Depth,
997 ) -> fidl::Result<()> {
998 encoder.debug_check_bounds::<KeyGetKeyProviderResponse>(offset);
999 self.0.encode(encoder, offset + 0, depth)?;
1003 Ok(())
1004 }
1005 }
1006
1007 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1008 for KeyGetKeyProviderResponse
1009 {
1010 #[inline(always)]
1011 fn new_empty() -> Self {
1012 Self { key_provider: fidl::new_empty!(KeyProvider, D) }
1013 }
1014
1015 #[inline]
1016 unsafe fn decode(
1017 &mut self,
1018 decoder: &mut fidl::encoding::Decoder<'_, D>,
1019 offset: usize,
1020 _depth: fidl::encoding::Depth,
1021 ) -> fidl::Result<()> {
1022 decoder.debug_check_bounds::<Self>(offset);
1023 fidl::decode!(KeyProvider, D, &mut self.key_provider, decoder, offset + 0, _depth)?;
1025 Ok(())
1026 }
1027 }
1028
1029 impl fidl::encoding::ValueTypeMarker for PublicKey {
1030 type Borrowed<'a> = &'a Self;
1031 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1032 value
1033 }
1034 }
1035
1036 unsafe impl fidl::encoding::TypeMarker for PublicKey {
1037 type Owned = Self;
1038
1039 #[inline(always)]
1040 fn inline_align(_context: fidl::encoding::Context) -> usize {
1041 8
1042 }
1043
1044 #[inline(always)]
1045 fn inline_size(_context: fidl::encoding::Context) -> usize {
1046 16
1047 }
1048 }
1049
1050 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PublicKey, D>
1051 for &PublicKey
1052 {
1053 #[inline]
1054 unsafe fn encode(
1055 self,
1056 encoder: &mut fidl::encoding::Encoder<'_, D>,
1057 offset: usize,
1058 _depth: fidl::encoding::Depth,
1059 ) -> fidl::Result<()> {
1060 encoder.debug_check_bounds::<PublicKey>(offset);
1061 fidl::encoding::Encode::<PublicKey, D>::encode(
1063 (<fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(
1064 &self.bytes,
1065 ),),
1066 encoder,
1067 offset,
1068 _depth,
1069 )
1070 }
1071 }
1072 unsafe impl<
1073 D: fidl::encoding::ResourceDialect,
1074 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>, D>,
1075 > fidl::encoding::Encode<PublicKey, D> for (T0,)
1076 {
1077 #[inline]
1078 unsafe fn encode(
1079 self,
1080 encoder: &mut fidl::encoding::Encoder<'_, D>,
1081 offset: usize,
1082 depth: fidl::encoding::Depth,
1083 ) -> fidl::Result<()> {
1084 encoder.debug_check_bounds::<PublicKey>(offset);
1085 self.0.encode(encoder, offset + 0, depth)?;
1089 Ok(())
1090 }
1091 }
1092
1093 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PublicKey {
1094 #[inline(always)]
1095 fn new_empty() -> Self {
1096 Self { bytes: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, D) }
1097 }
1098
1099 #[inline]
1100 unsafe fn decode(
1101 &mut self,
1102 decoder: &mut fidl::encoding::Decoder<'_, D>,
1103 offset: usize,
1104 _depth: fidl::encoding::Depth,
1105 ) -> fidl::Result<()> {
1106 decoder.debug_check_bounds::<Self>(offset);
1107 fidl::decode!(fidl::encoding::Vector<u8, 256>, D, &mut self.bytes, decoder, offset + 0, _depth)?;
1109 Ok(())
1110 }
1111 }
1112
1113 impl fidl::encoding::ValueTypeMarker for Signature {
1114 type Borrowed<'a> = &'a Self;
1115 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1116 value
1117 }
1118 }
1119
1120 unsafe impl fidl::encoding::TypeMarker for Signature {
1121 type Owned = Self;
1122
1123 #[inline(always)]
1124 fn inline_align(_context: fidl::encoding::Context) -> usize {
1125 8
1126 }
1127
1128 #[inline(always)]
1129 fn inline_size(_context: fidl::encoding::Context) -> usize {
1130 16
1131 }
1132 }
1133
1134 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Signature, D>
1135 for &Signature
1136 {
1137 #[inline]
1138 unsafe fn encode(
1139 self,
1140 encoder: &mut fidl::encoding::Encoder<'_, D>,
1141 offset: usize,
1142 _depth: fidl::encoding::Depth,
1143 ) -> fidl::Result<()> {
1144 encoder.debug_check_bounds::<Signature>(offset);
1145 fidl::encoding::Encode::<Signature, D>::encode(
1147 (<fidl::encoding::Vector<u8, 512> as fidl::encoding::ValueTypeMarker>::borrow(
1148 &self.bytes,
1149 ),),
1150 encoder,
1151 offset,
1152 _depth,
1153 )
1154 }
1155 }
1156 unsafe impl<
1157 D: fidl::encoding::ResourceDialect,
1158 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 512>, D>,
1159 > fidl::encoding::Encode<Signature, D> for (T0,)
1160 {
1161 #[inline]
1162 unsafe fn encode(
1163 self,
1164 encoder: &mut fidl::encoding::Encoder<'_, D>,
1165 offset: usize,
1166 depth: fidl::encoding::Depth,
1167 ) -> fidl::Result<()> {
1168 encoder.debug_check_bounds::<Signature>(offset);
1169 self.0.encode(encoder, offset + 0, depth)?;
1173 Ok(())
1174 }
1175 }
1176
1177 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Signature {
1178 #[inline(always)]
1179 fn new_empty() -> Self {
1180 Self { bytes: fidl::new_empty!(fidl::encoding::Vector<u8, 512>, D) }
1181 }
1182
1183 #[inline]
1184 unsafe fn decode(
1185 &mut self,
1186 decoder: &mut fidl::encoding::Decoder<'_, D>,
1187 offset: usize,
1188 _depth: fidl::encoding::Depth,
1189 ) -> fidl::Result<()> {
1190 decoder.debug_check_bounds::<Self>(offset);
1191 fidl::decode!(fidl::encoding::Vector<u8, 512>, D, &mut self.bytes, decoder, offset + 0, _depth)?;
1193 Ok(())
1194 }
1195 }
1196
1197 impl fidl::encoding::ValueTypeMarker for StatelessKeyManagerGetHardwareDerivedKeyRequest {
1198 type Borrowed<'a> = &'a Self;
1199 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1200 value
1201 }
1202 }
1203
1204 unsafe impl fidl::encoding::TypeMarker for StatelessKeyManagerGetHardwareDerivedKeyRequest {
1205 type Owned = Self;
1206
1207 #[inline(always)]
1208 fn inline_align(_context: fidl::encoding::Context) -> usize {
1209 8
1210 }
1211
1212 #[inline(always)]
1213 fn inline_size(_context: fidl::encoding::Context) -> usize {
1214 16
1215 }
1216 }
1217
1218 unsafe impl<D: fidl::encoding::ResourceDialect>
1219 fidl::encoding::Encode<StatelessKeyManagerGetHardwareDerivedKeyRequest, D>
1220 for &StatelessKeyManagerGetHardwareDerivedKeyRequest
1221 {
1222 #[inline]
1223 unsafe fn encode(
1224 self,
1225 encoder: &mut fidl::encoding::Encoder<'_, D>,
1226 offset: usize,
1227 _depth: fidl::encoding::Depth,
1228 ) -> fidl::Result<()> {
1229 encoder.debug_check_bounds::<StatelessKeyManagerGetHardwareDerivedKeyRequest>(offset);
1230 fidl::encoding::Encode::<StatelessKeyManagerGetHardwareDerivedKeyRequest, D>::encode(
1232 (<fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
1233 &self.key_info,
1234 ),),
1235 encoder,
1236 offset,
1237 _depth,
1238 )
1239 }
1240 }
1241 unsafe impl<
1242 D: fidl::encoding::ResourceDialect,
1243 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
1244 > fidl::encoding::Encode<StatelessKeyManagerGetHardwareDerivedKeyRequest, D> for (T0,)
1245 {
1246 #[inline]
1247 unsafe fn encode(
1248 self,
1249 encoder: &mut fidl::encoding::Encoder<'_, D>,
1250 offset: usize,
1251 depth: fidl::encoding::Depth,
1252 ) -> fidl::Result<()> {
1253 encoder.debug_check_bounds::<StatelessKeyManagerGetHardwareDerivedKeyRequest>(offset);
1254 self.0.encode(encoder, offset + 0, depth)?;
1258 Ok(())
1259 }
1260 }
1261
1262 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1263 for StatelessKeyManagerGetHardwareDerivedKeyRequest
1264 {
1265 #[inline(always)]
1266 fn new_empty() -> Self {
1267 Self { key_info: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D) }
1268 }
1269
1270 #[inline]
1271 unsafe fn decode(
1272 &mut self,
1273 decoder: &mut fidl::encoding::Decoder<'_, D>,
1274 offset: usize,
1275 _depth: fidl::encoding::Depth,
1276 ) -> fidl::Result<()> {
1277 decoder.debug_check_bounds::<Self>(offset);
1278 fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.key_info, decoder, offset + 0, _depth)?;
1280 Ok(())
1281 }
1282 }
1283
1284 impl fidl::encoding::ValueTypeMarker for StatelessKeyManagerGetHardwareDerivedKeyResponse {
1285 type Borrowed<'a> = &'a Self;
1286 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1287 value
1288 }
1289 }
1290
1291 unsafe impl fidl::encoding::TypeMarker for StatelessKeyManagerGetHardwareDerivedKeyResponse {
1292 type Owned = Self;
1293
1294 #[inline(always)]
1295 fn inline_align(_context: fidl::encoding::Context) -> usize {
1296 8
1297 }
1298
1299 #[inline(always)]
1300 fn inline_size(_context: fidl::encoding::Context) -> usize {
1301 16
1302 }
1303 }
1304
1305 unsafe impl<D: fidl::encoding::ResourceDialect>
1306 fidl::encoding::Encode<StatelessKeyManagerGetHardwareDerivedKeyResponse, D>
1307 for &StatelessKeyManagerGetHardwareDerivedKeyResponse
1308 {
1309 #[inline]
1310 unsafe fn encode(
1311 self,
1312 encoder: &mut fidl::encoding::Encoder<'_, D>,
1313 offset: usize,
1314 _depth: fidl::encoding::Depth,
1315 ) -> fidl::Result<()> {
1316 encoder.debug_check_bounds::<StatelessKeyManagerGetHardwareDerivedKeyResponse>(offset);
1317 fidl::encoding::Encode::<StatelessKeyManagerGetHardwareDerivedKeyResponse, D>::encode(
1319 (<fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
1320 &self.derived_key,
1321 ),),
1322 encoder,
1323 offset,
1324 _depth,
1325 )
1326 }
1327 }
1328 unsafe impl<
1329 D: fidl::encoding::ResourceDialect,
1330 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
1331 > fidl::encoding::Encode<StatelessKeyManagerGetHardwareDerivedKeyResponse, D> for (T0,)
1332 {
1333 #[inline]
1334 unsafe fn encode(
1335 self,
1336 encoder: &mut fidl::encoding::Encoder<'_, D>,
1337 offset: usize,
1338 depth: fidl::encoding::Depth,
1339 ) -> fidl::Result<()> {
1340 encoder.debug_check_bounds::<StatelessKeyManagerGetHardwareDerivedKeyResponse>(offset);
1341 self.0.encode(encoder, offset + 0, depth)?;
1345 Ok(())
1346 }
1347 }
1348
1349 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1350 for StatelessKeyManagerGetHardwareDerivedKeyResponse
1351 {
1352 #[inline(always)]
1353 fn new_empty() -> Self {
1354 Self { derived_key: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D) }
1355 }
1356
1357 #[inline]
1358 unsafe fn decode(
1359 &mut self,
1360 decoder: &mut fidl::encoding::Decoder<'_, D>,
1361 offset: usize,
1362 _depth: fidl::encoding::Depth,
1363 ) -> fidl::Result<()> {
1364 decoder.debug_check_bounds::<Self>(offset);
1365 fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.derived_key, decoder, offset + 0, _depth)?;
1367 Ok(())
1368 }
1369 }
1370}