feat: support nip46

This commit is contained in:
2025-02-10 13:46:51 +07:00
parent c4573ef1da
commit 0347e8b3c5
7 changed files with 352 additions and 127 deletions

View File

@@ -10,5 +10,7 @@ nostr-sdk.workspace = true
anyhow.workspace = true
itertools.workspace = true
chrono.workspace = true
dirs.workspace = true
random_name_generator = "0.3.6"
qrcode-generator = "5.0.0"

View File

@@ -1,3 +1,4 @@
pub mod constants;
pub mod profile;
pub mod qr;
pub mod utils;

13
crates/common/src/qr.rs Normal file
View File

@@ -0,0 +1,13 @@
use std::path::PathBuf;
use dirs::config_dir;
use qrcode_generator::QrCodeEcc;
pub fn create_qr(data: &str) -> Result<PathBuf, anyhow::Error> {
let config_dir = config_dir().expect("Config directory not found");
let path = config_dir.join("Coop/nostr_connect.png");
qrcode_generator::to_png_to_file(data, QrCodeEcc::Low, 1024, &path)?;
Ok(path)
}