File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ impl<'a> Service<'a> {
8888 #[ doc( alias = "OpenSession" ) ]
8989 pub async fn open_session (
9090 & self ,
91- client_public_key : Option < & Key > ,
91+ client_public_key : Option < Key > ,
9292 ) -> Result < ( Option < Key > , Session < ' a > ) , Error > {
9393 let ( algorithm, key) : ( _ , Value < ' _ > ) = match client_public_key {
9494 None => ( Algorithm :: Plain , zvariant:: Str :: default ( ) . into ( ) ) ,
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ impl<'a> Service<'a> {
8787 tracing:: debug!( "Starting an encrypted Secret Service session" ) ;
8888 let private_key = Key :: generate_private_key ( ) ?;
8989 let public_key = Key :: generate_public_key ( & private_key) ?;
90- let ( service_key, session) = service. open_session ( Some ( & public_key) ) . await ?;
90+ let ( service_key, session) = service. open_session ( Some ( public_key) ) . await ?;
9191 let aes_key = service_key
9292 . map ( |service_key| Key :: generate_aes_key ( & private_key, & service_key) )
9393 . transpose ( ) ?
Original file line number Diff line number Diff line change 11use zeroize:: { Zeroize , ZeroizeOnDrop } ;
2- use zvariant:: Type ;
32
43use crate :: { crypto, file} ;
54
@@ -57,20 +56,16 @@ impl Key {
5756 }
5857}
5958
60- impl From < & Key > for zvariant:: Value < ' _ > {
61- fn from ( key : & Key ) -> Self {
62- let mut array = zvariant:: Array :: new ( u8:: SIGNATURE ) ;
63- for byte in key. as_ref ( ) {
64- array
65- . append ( zvariant:: Value :: U8 ( * byte) )
66- . expect ( "Element of valid type" ) ;
67- }
68- array. into ( )
59+ impl From < Key > for zvariant:: Value < ' static > {
60+ fn from ( key : Key ) -> Self {
61+ let mut key = key;
62+ let inner: Vec < u8 > = std:: mem:: take ( & mut key. key ) ;
63+ zvariant:: Array :: from ( inner) . into ( )
6964 }
7065}
7166
72- impl From < & Key > for zvariant:: OwnedValue {
73- fn from ( key : & Key ) -> Self {
67+ impl From < Key > for zvariant:: OwnedValue {
68+ fn from ( key : Key ) -> Self {
7469 zvariant:: Value :: from ( key) . try_to_owned ( ) . unwrap ( )
7570 }
7671}
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ impl Service {
9797 object_server. at ( & path, session) . await ?;
9898
9999 let service_key = public_key
100- . map ( |k| OwnedValue :: from ( & k ) )
100+ . map ( OwnedValue :: from)
101101 . unwrap_or_else ( || Value :: new :: < Vec < u8 > > ( vec ! [ ] ) . try_to_owned ( ) . unwrap ( ) ) ;
102102
103103 Ok ( ( service_key, path) )
You can’t perform that action at this time.
0 commit comments