.
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m25s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m46s
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m25s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m46s
This commit is contained in:
@@ -23,3 +23,4 @@ serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
rustls = "0.23"
|
||||
petname = "2.0.2"
|
||||
|
||||
@@ -37,6 +37,8 @@ pub const NOSTR_CONNECT_RELAY: &str = "wss://relay.nsec.app";
|
||||
pub const DEVICE_GIFTWRAP: &str = "device-gift-wraps";
|
||||
/// Default subscription id for user gift wrap events
|
||||
pub const USER_GIFTWRAP: &str = "user-gift-wraps";
|
||||
/// Default avatar for new users
|
||||
pub const DEFAULT_AVATAR: &str = "https://image.nostr.build/93bb6084457a42620849b6827f3f34f111ae5a4ac728638a989d4ed4b4bb3ac8.png";
|
||||
/// Default vertex relays
|
||||
pub const WOT_RELAYS: [&str; 1] = ["wss://relay.vertexlab.io"];
|
||||
/// Default search relays
|
||||
@@ -726,7 +728,12 @@ impl NostrRegistry {
|
||||
|
||||
/// Create a new identity
|
||||
fn create_identity(&mut self, cx: &mut Context<Self>) {
|
||||
let client = self.client();
|
||||
|
||||
// Generate new keys
|
||||
let keys = Keys::generate();
|
||||
|
||||
// Get write credential task
|
||||
let write_credential = cx.write_credentials(
|
||||
CLIENT_NAME,
|
||||
&keys.public_key().to_hex(),
|
||||
@@ -736,10 +743,23 @@ impl NostrRegistry {
|
||||
// Update the signer
|
||||
self.set_signer(keys, false, cx);
|
||||
|
||||
// TODO: set metadata
|
||||
|
||||
// Spawn a task to write the credentials
|
||||
// Spawn a task to set metadata and write the credentials
|
||||
cx.background_spawn(async move {
|
||||
let name = petname::petname(2, "-").unwrap_or("Cooper".to_string());
|
||||
let avatar = Url::parse(DEFAULT_AVATAR).unwrap();
|
||||
|
||||
// Construct metadata for the identity
|
||||
let metadata = Metadata::new()
|
||||
.display_name(&name)
|
||||
.name(&name)
|
||||
.picture(avatar);
|
||||
|
||||
// Set metadata for the identity
|
||||
if let Err(e) = client.set_metadata(&metadata).await {
|
||||
log::error!("Failed to set metadata: {}", e);
|
||||
}
|
||||
|
||||
// Write the credentials
|
||||
if let Err(e) = write_credential.await {
|
||||
log::error!("Failed to write credentials: {}", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user