enostr: remove nostr crate for now

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-02-10 16:14:45 -08:00
parent a51935b292
commit 9feb6465c0
4 changed files with 19 additions and 454 deletions

View File

@@ -1,4 +1,4 @@
use nostr::prelude::secp256k1;
//use nostr::prelude::secp256k1;
use serde_json;
use std::array::TryFromSliceError;
use std::fmt;
@@ -10,7 +10,7 @@ pub enum Error {
HexDecodeFailed,
InvalidByteSize,
InvalidSignature,
Secp(secp256k1::Error),
// Secp(secp256k1::Error),
Json(serde_json::Error),
Generic(String),
}
@@ -26,7 +26,7 @@ impl std::cmp::PartialEq for Error {
// This is slightly wrong but whatevs
(Error::Json(..), Error::Json(..)) => true,
(Error::Generic(left), Error::Generic(right)) => left == right,
(Error::Secp(left), Error::Secp(right)) => left == right,
//(Error::Secp(left), Error::Secp(right)) => left == right,
_ => false,
}
}
@@ -40,7 +40,7 @@ impl fmt::Display for Error {
Self::InvalidSignature => write!(f, "invalid signature"),
Self::HexDecodeFailed => write!(f, "hex decoding failed"),
Self::InvalidByteSize => write!(f, "invalid byte size"),
Self::Secp(e) => write!(f, "{e}"),
//Self::Secp(e) => write!(f, "{e}"),
Self::Json(e) => write!(f, "{e}"),
Self::Generic(e) => write!(f, "{e}"),
}
@@ -67,11 +67,13 @@ impl From<hex::FromHexError> for Error {
}
}
/*
impl From<secp256k1::Error> for Error {
fn from(e: secp256k1::Error) -> Self {
Error::Secp(e)
}
}
*/
impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {

View File

@@ -3,7 +3,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
use crate::Error;
use hex;
use log::debug;
use nostr::key::XOnlyPublicKey;
//use nostr::key::XOnlyPublicKey;
use std::fmt;
#[derive(Debug, Eq, PartialEq, Clone, Hash)]