Skip to content

Commit 015d8d7

Browse files
committed
Fix type
1 parent 330bde5 commit 015d8d7

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

crates/bitwarden-crypto/src/security_state.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ use serde::{Deserialize, Serialize};
2727
use serde_bytes::ByteBuf;
2828

2929
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,
3232
};
3333

3434
#[cfg(feature = "wasm")]
@@ -101,22 +101,22 @@ impl SignedSecurityState {
101101
#[derive(Clone, Debug)]
102102
pub struct SignedSecurityState(pub(crate) SignedObject);
103103

104-
impl From<SignedSecurityState> for Vec<u8> {
104+
impl From<SignedSecurityState> for CoseSign1Bytes {
105105
fn from(val: SignedSecurityState) -> Self {
106106
val.0.to_cose()
107107
}
108108
}
109109

110-
impl TryFrom<Vec<u8>> for SignedSecurityState {
110+
impl TryFrom<&CoseSign1Bytes> for SignedSecurityState {
111111
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)?))
114114
}
115115
}
116116

117117
impl From<SignedSecurityState> for String {
118118
fn from(val: SignedSecurityState) -> Self {
119-
let bytes: Vec<u8> = val.into();
119+
let bytes: CoseSign1Bytes = val.into();
120120
STANDARD.encode(&bytes)
121121
}
122122
}
@@ -128,7 +128,7 @@ impl FromStr for SignedSecurityState {
128128
let bytes = STANDARD
129129
.decode(s)
130130
.map_err(|_| EncodingError::InvalidCborSerialization)?;
131-
Self::try_from(bytes)
131+
Self::try_from(&CoseSign1Bytes::from(bytes))
132132
}
133133
}
134134

0 commit comments

Comments
 (0)