feat: support nip46
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
pub mod constants;
|
||||
pub mod profile;
|
||||
pub mod qr;
|
||||
pub mod utils;
|
||||
|
||||
13
crates/common/src/qr.rs
Normal file
13
crates/common/src/qr.rs
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user