@@ -27,8 +27,8 @@ use serde::{Deserialize, Serialize};
27
27
use serde_bytes:: ByteBuf ;
28
28
29
29
use crate :: {
30
- cose:: CoseSerializable , error:: EncodingError , util:: FromStrVisitor , CryptoError , KeyIds ,
31
- KeyStoreContext , SignedObject , SigningKey , SigningNamespace , VerifyingKey ,
30
+ cose:: CoseSerializable , error:: EncodingError , util:: FromStrVisitor , CoseSign1Bytes ,
31
+ CryptoError , KeyIds , KeyStoreContext , SignedObject , SigningKey , SigningNamespace , VerifyingKey ,
32
32
} ;
33
33
34
34
#[ cfg( feature = "wasm" ) ]
@@ -101,22 +101,22 @@ impl SignedSecurityState {
101
101
#[ derive( Clone , Debug ) ]
102
102
pub struct SignedSecurityState ( pub ( crate ) SignedObject ) ;
103
103
104
- impl From < SignedSecurityState > for Vec < u8 > {
104
+ impl From < SignedSecurityState > for CoseSign1Bytes {
105
105
fn from ( val : SignedSecurityState ) -> Self {
106
106
val. 0 . to_cose ( )
107
107
}
108
108
}
109
109
110
- impl TryFrom < Vec < u8 > > for SignedSecurityState {
110
+ impl TryFrom < & CoseSign1Bytes > for SignedSecurityState {
111
111
type Error = EncodingError ;
112
- fn try_from ( bytes : Vec < u8 > ) -> Result < Self , EncodingError > {
113
- Ok ( SignedSecurityState ( SignedObject :: from_cose ( & bytes) ?) )
112
+ fn try_from ( bytes : & CoseSign1Bytes ) -> Result < Self , EncodingError > {
113
+ Ok ( SignedSecurityState ( SignedObject :: from_cose ( bytes) ?) )
114
114
}
115
115
}
116
116
117
117
impl From < SignedSecurityState > for String {
118
118
fn from ( val : SignedSecurityState ) -> Self {
119
- let bytes: Vec < u8 > = val. into ( ) ;
119
+ let bytes: CoseSign1Bytes = val. into ( ) ;
120
120
STANDARD . encode ( & bytes)
121
121
}
122
122
}
@@ -128,7 +128,7 @@ impl FromStr for SignedSecurityState {
128
128
let bytes = STANDARD
129
129
. decode ( s)
130
130
. map_err ( |_| EncodingError :: InvalidCborSerialization ) ?;
131
- Self :: try_from ( bytes)
131
+ Self :: try_from ( & CoseSign1Bytes :: from ( bytes) )
132
132
}
133
133
}
134
134
0 commit comments