Skip to content

Commit

Permalink
fix: PublicKey as String (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
darioAnongba authored Oct 9, 2024
1 parent d89721b commit 453a963
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/application/dtos/ln_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct RegisterLnAddressRequest {
pub allows_nostr: bool,

/// Nostr public key
#[schema(example = "npub1m8pwckdf3...")]
#[schema(value_type = Option<String>, example = "npub1m8pwckdf3...")]
pub nostr_pubkey: Option<PublicKey>,
}

Expand All @@ -34,6 +34,6 @@ pub struct UpdateLnAddressRequest {
pub allows_nostr: Option<bool>,

/// Nostr public key
#[schema(example = "npub1m8pwckdf3...")]
#[schema(value_type = Option<String>, example = "npub1m8pwckdf3...")]
pub nostr_pubkey: Option<PublicKey>,
}
5 changes: 2 additions & 3 deletions src/application/dtos/nostr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ pub struct NostrNIP05QueryParams {
}

#[derive(Debug, Serialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct NostrNIP05Response {
/// Found names
pub names: HashMap<String, PublicKey>,
pub names: HashMap<String, String>,
}

impl NostrNIP05Response {
pub fn new(name: String, pubkey: PublicKey) -> Self {
let mut names = HashMap::new();
names.insert(name, pubkey);
names.insert(name, pubkey.to_string());
Self { names }
}
}
2 changes: 1 addition & 1 deletion src/domains/ln_address/entities/ln_address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct LnAddress {
pub allows_nostr: bool,
/// Nostr Public key
#[serde(skip_serializing_if = "Option::is_none")]
#[schema(example = "npub1m8pwckdf3...")]
#[schema(value_type = Option<String>, example = "d9c2ec59a98c...")]
pub nostr_pubkey: Option<PublicKey>,
/// Date of creation in database
pub created_at: DateTime<Utc>,
Expand Down
2 changes: 1 addition & 1 deletion src/domains/ln_address/ln_address_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use super::{LnAddress, LnAddressFilter};
#[derive(OpenApi)]
#[openapi(
paths(register_address, get_address, list_addresses, update_address, delete_address, delete_addresses),
components(schemas(LnAddress, RegisterLnAddressRequest)),
components(schemas(LnAddress, RegisterLnAddressRequest, UpdateLnAddressRequest)),
tags(
(name = "Lightning Addresses", description = "LN Address management endpoints as defined in the [protocol specification](https://lightningaddress.com/). Require `read:ln_address` or `write:ln_address` permissions.")
)
Expand Down
2 changes: 1 addition & 1 deletion src/domains/lnurl/entities/lnurl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct LnURLPayRequest {
pub allows_nostr: bool,

/// Nostr public key
#[schema(example = "npub1m8pwckdf3...")]
#[schema(value_type = Option<String>, example = "d9c2ec59a98c...")]
pub nostr_pubkey: Option<PublicKey>,
}

Expand Down

0 comments on commit 453a963

Please sign in to comment.