• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use binder::Interface;
2 use pinweaver_api::{DelayScheduleEntry, IPinWeaver, InsertMode, LeafId, LeafSet, TryAuthResponse};
3 use pinweaver_storage::current::StorageInterface;
4 use std::sync::Arc;
5 use tipc::TipcError;
6 
7 #[allow(dead_code)]
8 /// Implements the `IPinWeaver` AIDL interface for other Trusty apps to call.
9 pub struct PinWeaverService {
10     storage: Arc<dyn StorageInterface<Error = TipcError>>,
11     // TODO: b/359374997 - add `gsc: Arc<dyn IGSc>`
12 }
13 
14 impl PinWeaverService {
new(storage: Arc<dyn StorageInterface<Error = TipcError>>) -> Self15     pub fn new(storage: Arc<dyn StorageInterface<Error = TipcError>>) -> Self {
16         Self { storage }
17     }
18 }
19 
20 impl Interface for PinWeaverService {}
21 
22 impl IPinWeaver for PinWeaverService {
insert( &self, _id: &LeafId, _low_entropy_secret: &[u8], _high_entropy_secret: &[u8], _delay_schedule: &[DelayScheduleEntry], _allow_existing: InsertMode, ) -> binder::Result<()>23     fn insert(
24         &self,
25         _id: &LeafId,
26         _low_entropy_secret: &[u8],
27         _high_entropy_secret: &[u8],
28         _delay_schedule: &[DelayScheduleEntry],
29         _allow_existing: InsertMode,
30     ) -> binder::Result<()> {
31         // TODO: b/359374997 - Implement.
32         Err(binder::StatusCode::FAILED_TRANSACTION.into())
33     }
34 
tryAuthenticate( &self, _id: &LeafId, _low_entropy_secret: &[u8], ) -> binder::Result<TryAuthResponse>35     fn tryAuthenticate(
36         &self,
37         _id: &LeafId,
38         _low_entropy_secret: &[u8],
39     ) -> binder::Result<TryAuthResponse> {
40         // TODO: b/359374997 - Implement.
41         Err(binder::StatusCode::FAILED_TRANSACTION.into())
42     }
43 
tryAuthenticateThenReplace( &self, _id: &LeafId, _current_low_entropy_secret: &[u8], _new_low_entropy_secret: &[u8], _new_high_entropy_secret: Option<&[u8]>, _new_delay_schedule: Option<&[Option<DelayScheduleEntry>]>, ) -> binder::Result<TryAuthResponse>44     fn tryAuthenticateThenReplace(
45         &self,
46         _id: &LeafId,
47         _current_low_entropy_secret: &[u8],
48         _new_low_entropy_secret: &[u8],
49         _new_high_entropy_secret: Option<&[u8]>,
50         _new_delay_schedule: Option<&[Option<DelayScheduleEntry>]>,
51     ) -> binder::Result<TryAuthResponse> {
52         // TODO: b/359374997 - Implement.
53         Err(binder::StatusCode::FAILED_TRANSACTION.into())
54     }
55 
remove(&self, _id: &LeafId) -> binder::Result<()>56     fn remove(&self, _id: &LeafId) -> binder::Result<()> {
57         // TODO: b/359374997 - Implement.
58         Err(binder::StatusCode::FAILED_TRANSACTION.into())
59     }
60 
removeAll(&self, _leaf_set: LeafSet) -> binder::Result<()>61     fn removeAll(&self, _leaf_set: LeafSet) -> binder::Result<()> {
62         // TODO: b/359374997 - Implement.
63         Err(binder::StatusCode::FAILED_TRANSACTION.into())
64     }
65 }
66