Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ git2 = "0.19.0"
tempfile = "3.13.0"
home = "0.5.9"
ring = "0.17.8"
secp256k1 = "0.30.0"
2 changes: 1 addition & 1 deletion gemini/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ reqwest = { workspace = true }
tracing = { workspace = true }
tokio = { workspace = true, features = ["net"] }
chrono = { workspace = true }
secp256k1 = { version = "0.29.0", features = ["serde", "rand","hashes"] }
secp256k1 = { workspace = true , features = ["serde", "rand","hashes"] }
9 changes: 5 additions & 4 deletions gemini/src/nostr/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ impl NostrEvent {
let hash = sha256::Hash::from_str(self.id.inner().clone().as_str())?;
let message: Message = Message::from_digest(hash.to_byte_array());
// let message = Message::from_slice(hash.as_ref())?;
secp.verify_schnorr(&self.sig, &message, &self.pubkey)
secp.verify_schnorr(&self.sig, message.as_ref(), &self.pubkey)
.map_err(|_| Error::InvalidSignature)
}
}
Expand All @@ -250,15 +250,16 @@ pub fn sign_with_rng(id: String, keypair: &Keypair) -> Signature {
let secp = Secp256k1::new();
let mut rng = rand::thread_rng();
let hash = sha256::Hash::from_str(id.as_str()).unwrap();
let message: Message = Message::from_digest(hash.to_byte_array());
secp.sign_schnorr_with_rng(&message, keypair, &mut rng)
let message = Message::from_digest(hash.to_byte_array());

secp.sign_schnorr_with_rng(message.as_ref(), keypair, &mut rng)
}

pub fn sign_without_rng(id: String, keypair: &Keypair) -> Signature {
let secp = Secp256k1::new();
let hash = sha256::Hash::from_str(id.as_str()).unwrap();
let message: Message = Message::from_digest(hash.to_byte_array());
secp.sign_schnorr_no_aux_rand(&message, keypair)
secp.sign_schnorr_no_aux_rand(message.as_ref(), keypair)
}

/// Event Id
Expand Down
2 changes: 1 addition & 1 deletion vault/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ hex = "0.4.3"
lazy_static = "1.5.0"
bs58 = "0.5.1"
serde = { version = "1.0.117", features = ["derive"] }
secp256k1 = { version = "0.29.0", features = ["serde", "rand"] }
secp256k1 = { workspace = true , features = ["serde", "rand","hashes"] }