mirror of
https://github.com/scsibug/nostr-rs-relay.git
synced 2024-11-25 10:09:08 -05:00
feat: change pub(crate) to pub for use as a library
This commit is contained in:
parent
1e1ec69175
commit
4fd7643907
|
@ -80,7 +80,7 @@ impl FromStr for Operator {
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
|
||||||
pub struct ConditionQuery {
|
pub struct ConditionQuery {
|
||||||
pub(crate) conditions: Vec<Condition>,
|
pub conditions: Vec<Condition>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConditionQuery {
|
impl ConditionQuery {
|
||||||
|
@ -137,9 +137,9 @@ pub fn validate_delegation(
|
||||||
/// An example complex condition would be: kind=1,2,3&created_at<1665265999
|
/// An example complex condition would be: kind=1,2,3&created_at<1665265999
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
|
||||||
pub struct Condition {
|
pub struct Condition {
|
||||||
pub(crate) field: Field,
|
pub field: Field,
|
||||||
pub(crate) operator: Operator,
|
pub operator: Operator,
|
||||||
pub(crate) values: Vec<u64>,
|
pub values: Vec<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Condition {
|
impl Condition {
|
||||||
|
|
18
src/event.rs
18
src/event.rs
|
@ -37,19 +37,19 @@ impl EventCmd {
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
|
||||||
pub struct Event {
|
pub struct Event {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub(crate) pubkey: String,
|
pub pubkey: String,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub(crate) delegated_by: Option<String>,
|
pub delegated_by: Option<String>,
|
||||||
pub(crate) created_at: u64,
|
pub created_at: u64,
|
||||||
pub(crate) kind: u64,
|
pub kind: u64,
|
||||||
#[serde(deserialize_with = "tag_from_string")]
|
#[serde(deserialize_with = "tag_from_string")]
|
||||||
// NOTE: array-of-arrays may need to be more general than a string container
|
// NOTE: array-of-arrays may need to be more general than a string container
|
||||||
pub(crate) tags: Vec<Vec<String>>,
|
pub tags: Vec<Vec<String>>,
|
||||||
pub(crate) content: String,
|
pub content: String,
|
||||||
pub(crate) sig: String,
|
pub sig: String,
|
||||||
// Optimization for tag search, built on demand.
|
// Optimization for tag search, built on demand.
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub(crate) tagidx: Option<HashMap<char, HashSet<String>>>,
|
pub tagidx: Option<HashMap<char, HashSet<String>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Simple tag type for array of array of strings.
|
/// Simple tag type for array of array of strings.
|
||||||
|
@ -242,7 +242,7 @@ impl Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if this event has a valid signature.
|
/// Check if this event has a valid signature.
|
||||||
fn validate(&self) -> Result<()> {
|
pub fn validate(&self) -> Result<()> {
|
||||||
// TODO: return a Result with a reason for invalid events
|
// TODO: return a Result with a reason for invalid events
|
||||||
// validation is performed by:
|
// validation is performed by:
|
||||||
// * parsing JSON string into event fields
|
// * parsing JSON string into event fields
|
||||||
|
|
Loading…
Reference in New Issue
Block a user