Skip to content

Commit

Permalink
fix: ✅ Successfully extracted signature form packet.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jisu-Woniu committed Nov 23, 2023
1 parent eaf8540 commit 34e9fa9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src-tauri/crypto/src/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ pub async fn sign_file_with_key(
#[cfg(test)]
mod tests {

use pgp::{de::Deserialize, packet, types::Version, Signature};
use std::io::{self, BufReader};

use pgp::packet::{self, PacketParser};
use temp_dir::TempDir;
use tokio::fs::{self, read};

Expand Down Expand Up @@ -132,7 +134,13 @@ mod tests {
dbg!(tmp_dir.path());

dbg!(&sig_data);
let signature = Signature::from_slice(Version::New, &sig_data);
let packet = PacketParser::new(sig_data.as_slice())
.next()
.unwrap_or(Err(pgp::errors::Error::MissingPackets))?;
let signature = match packet {
packet::Packet::Signature(s) => Ok(s),
_ => Err(pgp::errors::Error::InvalidInput),
};

dbg!(&signature);

Expand Down

0 comments on commit 34e9fa9

Please sign in to comment.