Support NIP-19 nprofile #116

Closed
opened 2023-01-06 01:16:40 +13:00 by fiatjaf · 6 comments
fiatjaf commented 2023-01-06 01:16:40 +13:00 (Migrated from github.com)

The nprofile identifier contains a list of relays, so it would probably fit easily into Gossip's people-adding flow. It's essentially what NIP-35 was for NIP-05 but for standalone key identifiers.

https://github.com/nostr-protocol/nips/blob/master/19.md

An example: nprofile1qqsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8gpyfmhxue69uhkummnw3ez6an9wf5kv6t9vsh8wetvd3hhyer9wghxuet5fmsq8j

The `nprofile` identifier contains a list of relays, so it would probably fit easily into Gossip's people-adding flow. It's essentially what NIP-35 was for NIP-05 but for standalone key identifiers. https://github.com/nostr-protocol/nips/blob/master/19.md An example: `nprofile1qqsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8gpyfmhxue69uhkummnw3ez6an9wf5kv6t9vsh8wetvd3hhyer9wghxuet5fmsq8j`
mikedilger commented 2023-01-06 02:06:03 +13:00 (Migrated from github.com)

Cool, I hadn't understood that.

Do these just show up in contents of text notes, or do people cut-n-paste them from somewhere?

Cool, I hadn't understood that. Do these just show up in contents of text notes, or do people cut-n-paste them from somewhere?
fiatjaf commented 2023-01-06 02:09:45 +13:00 (Migrated from github.com)

That is just for copypasting, as in: "follow me, I am nprofile1qqsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8gpyfmhxue69uhkummnw3ez6an9wf5kv6t9vsh8wetvd3hhyer9wghxuet5fmsq8j on nostr!".

They would also work well as QR codes and links (nostr:nprofile1qqsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8gpyfmhxue69uhkummnw3ez6an9wf5kv6t9vsh8wetvd3hhyer9wghxuet5fmsq8j or nostr:name@domain.com would work nice, what do you think?). But I think no one has implemented these things yet.

That is just for copypasting, as in: "follow me, I am nprofile1qqsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8gpyfmhxue69uhkummnw3ez6an9wf5kv6t9vsh8wetvd3hhyer9wghxuet5fmsq8j on nostr!". They would also work well as QR codes and links (`nostr:nprofile1qqsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8gpyfmhxue69uhkummnw3ez6an9wf5kv6t9vsh8wetvd3hhyer9wghxuet5fmsq8j` or `nostr:name@domain.com` would work nice, what do you think?). But I think no one has implemented these things yet.
mikedilger commented 2023-01-06 02:46:20 +13:00 (Migrated from github.com)

Yeah I like it.

I will implement the translation in nostr-types, which is the library crate that just deals with the data types. Then I guess on the "follow someone" page make it so you can paste an nprofile. And on the "you" page it should show your nprofile with a copy button. Does that sound right?

Yeah I like it. I will implement the translation in nostr-types, which is the library crate that just deals with the data types. Then I guess on the "follow someone" page make it so you can paste an nprofile. And on the "you" page it should show your nprofile with a copy button. Does that sound right?
fiatjaf commented 2023-01-06 03:09:58 +13:00 (Migrated from github.com)

Yes, to me it sounds right.

Yes, to me it sounds right.
mikedilger commented 2023-01-08 14:37:46 +13:00 (Migrated from github.com)

nostr-types now supports a Profile type like this:

/// A person's profile on nostr which consists of the data needed in order to follow someone.                                                                                     
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
pub struct Profile {
    /// Their public key                                                                                                                                                          
    pub pubkey: PublicKey,

    /// Some of the relays they post to (when the profile was created)                                                                                                            
    pub relays: Vec<Url>,
}

As well as

    /// Export as a bech32 encoded string ("nprofile")                                                                                                                            
    pub fn try_as_bech32_string(&self) -> Result<String, Error> {
        ...
    }

    /// Import from a bech32 encoded string ("nprofile")                                                                                                                          
    pub fn try_from_bech32_string(s: &str) -> Result<Profile, Error> {
       ....
    }

...with working test cases, including the example in NIP-19 tried in both directions.

Gossip doesn't have any changes in this regard yet.

nostr-types now supports a Profile type like this: ````rust /// A person's profile on nostr which consists of the data needed in order to follow someone. #[derive(Clone, Debug, Serialize, Deserialize, PartialEq)] pub struct Profile { /// Their public key pub pubkey: PublicKey, /// Some of the relays they post to (when the profile was created) pub relays: Vec<Url>, } ```` As well as ````rust /// Export as a bech32 encoded string ("nprofile") pub fn try_as_bech32_string(&self) -> Result<String, Error> { ... } /// Import from a bech32 encoded string ("nprofile") pub fn try_from_bech32_string(s: &str) -> Result<Profile, Error> { .... } ```` ...with working test cases, including the example in NIP-19 tried in both directions. Gossip doesn't have any changes in this regard yet.
mikedilger commented 2023-01-22 17:40:35 +13:00 (Migrated from github.com)

Done. Can follow an nprofile. Shows your own nprofile string.

Done. Can follow an nprofile. Shows your own nprofile string.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nostr/gossip#116
No description provided.