mirror of
https://github.com/bitwarden/browser
synced 2026-02-04 02:33:33 +00:00
Fix build
This commit is contained in:
@@ -161,7 +161,7 @@ impl TryFrom<&[u8]> for SshSignRequest {
|
||||
.map_err(|e| anyhow::anyhow!("Failed to read flags from sign request: {e}"))?;
|
||||
|
||||
Ok(SshSignRequest {
|
||||
public_key: PublicKey::from_blob(public_key_blob),
|
||||
public_key: PublicKey::try_from_blob(public_key_blob)?,
|
||||
payload_to_sign: data.clone(),
|
||||
parsed_sign_request: data.as_slice().try_into()?,
|
||||
flags,
|
||||
|
||||
@@ -360,11 +360,12 @@ impl PublicKey {
|
||||
Ok(PublicKey { alg, blob })
|
||||
}
|
||||
|
||||
pub fn from_blob(blob: Vec<u8>) -> Self {
|
||||
pub fn try_from_blob(blob: Vec<u8>) -> Result<Self, anyhow::Error> {
|
||||
// Parse the blob to extract the algorithm
|
||||
let mut bytes = &blob[..];
|
||||
let alg = String::from_utf8_lossy(read_bytes(&mut bytes).unwrap().as_slice()).to_string();
|
||||
PublicKey { alg, blob }
|
||||
let alg = String::from_utf8_lossy(read_bytes(&mut bytes)
|
||||
.map_err(|e| anyhow::anyhow!("Failed to read algorithm from blob: {e}"))?.as_slice()).to_string();
|
||||
Ok(PublicKey { alg, blob })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user