upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/repo_ref.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-03-22 15:51:36 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2024-03-22 15:51:36 +0000
commit9a450f2ce740da08843a541d230c43194b934f5f (patch)
tree77505c28638e7fbc610d23c7844d3a1f260bac7a /src/repo_ref.rs
parent0d7a8383d7d54e64bb0e1d5f4e06110c1e6a818b (diff)
replace XOnlyPublicKey with wrapper PublicKey
to reflect new name in rust-nostr
Diffstat (limited to 'src/repo_ref.rs')
-rw-r--r--src/repo_ref.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/repo_ref.rs b/src/repo_ref.rs
index c7b42fa..0a14005 100644
--- a/src/repo_ref.rs
+++ b/src/repo_ref.rs
@@ -1,7 +1,7 @@
1use std::{fs::File, io::BufReader, str::FromStr}; 1use std::{fs::File, io::BufReader, str::FromStr};
2 2
3use anyhow::{bail, Context, Result}; 3use anyhow::{bail, Context, Result};
4use nostr::{nips::nip19::Nip19, secp256k1::XOnlyPublicKey, FromBech32, Tag, ToBech32}; 4use nostr::{nips::nip19::Nip19, FromBech32, PublicKey, Tag, ToBech32};
5use serde::{Deserialize, Serialize}; 5use serde::{Deserialize, Serialize};
6 6
7#[cfg(not(test))] 7#[cfg(not(test))]
@@ -23,7 +23,7 @@ pub struct RepoRef {
23 pub git_server: String, 23 pub git_server: String,
24 pub web: Vec<String>, 24 pub web: Vec<String>,
25 pub relays: Vec<String>, 25 pub relays: Vec<String>,
26 pub maintainers: Vec<XOnlyPublicKey>, 26 pub maintainers: Vec<PublicKey>,
27 // code languages and hashtags 27 // code languages and hashtags
28} 28}
29 29
@@ -78,7 +78,7 @@ impl TryFrom<nostr::Event> for RepoRef {
78 } 78 }
79 for pk in maintainers { 79 for pk in maintainers {
80 r.maintainers.push( 80 r.maintainers.push(
81 nostr_sdk::prelude::XOnlyPublicKey::from_str(&pk) 81 nostr_sdk::prelude::PublicKey::from_str(&pk)
82 .context(format!("cannot convert entry from maintainers tag {pk} into a valid nostr public key. it should be in hex format")) 82 .context(format!("cannot convert entry from maintainers tag {pk} into a valid nostr public key. it should be in hex format"))
83 .context("invalid repository event")?, 83 .context("invalid repository event")?,
84 ); 84 );
@@ -246,11 +246,11 @@ pub fn get_repo_config_from_yaml(git_repo: &Repo) -> Result<RepoConfigYaml> {
246 Ok(repo_config_yaml) 246 Ok(repo_config_yaml)
247} 247}
248 248
249pub fn extract_pks(pk_strings: Vec<String>) -> Result<Vec<XOnlyPublicKey>> { 249pub fn extract_pks(pk_strings: Vec<String>) -> Result<Vec<PublicKey>> {
250 let mut pks: Vec<XOnlyPublicKey> = vec![]; 250 let mut pks: Vec<PublicKey> = vec![];
251 for s in pk_strings { 251 for s in pk_strings {
252 pks.push( 252 pks.push(
253 nostr_sdk::prelude::XOnlyPublicKey::from_bech32(s.clone()) 253 nostr_sdk::prelude::PublicKey::from_bech32(s.clone())
254 .context(format!("cannot convert {s} into a valid nostr public key"))?, 254 .context(format!("cannot convert {s} into a valid nostr public key"))?,
255 ); 255 );
256 } 256 }
@@ -259,7 +259,7 @@ pub fn extract_pks(pk_strings: Vec<String>) -> Result<Vec<XOnlyPublicKey>> {
259 259
260pub fn save_repo_config_to_yaml( 260pub fn save_repo_config_to_yaml(
261 git_repo: &Repo, 261 git_repo: &Repo,
262 maintainers: Vec<XOnlyPublicKey>, 262 maintainers: Vec<PublicKey>,
263 relays: Vec<String>, 263 relays: Vec<String>,
264) -> Result<()> { 264) -> Result<()> {
265 let path = git_repo.get_path()?.join("maintainers.yaml"); 265 let path = git_repo.get_path()?.join("maintainers.yaml");