Yuki Kishimoto on Nostr: ```python from nostr_protocol import Keys, Nip19Profile # OR `from nostr_sdk import ...
```python
from nostr_protocol import Keys, Nip19Profile
# OR `from nostr_sdk import Keys, Nip19Profile`
keys = Keys.parse("<private-key>") # nsec or hex
public_key = keys.public_key()
profile = Nip19Profile(public_key, relays=["wss://relay.damus.io"])
print(f"NIP-19: {profile.to_bech32()}")
print(f"NIP-21: {profile.to_nostr_uri()}")
```
You can learn more here (NIP-19 and NIP-21 sections):
https://rust-nostr.org/Published at
2024-08-30 21:54:43Event JSON
{
"id": "b82af1b781507c159808006efdd8e708a32a37b86d2633177a2b9bfe310afb6e",
"pubkey": "68d81165918100b7da43fc28f7d1fc12554466e1115886b9e7bb326f65ec4272",
"created_at": 1725054883,
"kind": 1,
"tags": [
[
"e",
"58d9e7cae1ab1b5ca46bc5bfef38c0a1cfbe78f791be361804fabea7c836ef76",
"wss://nostr.einundzwanzig.space/",
"root"
],
[
"e",
"b4a7fa7e7edbfa1fd5d53c61055b032f65882fb9a52bf2592f57e6bcc9029ac6",
"wss://nostr.einundzwanzig.space/",
"reply"
],
[
"p",
"5eb2c642d40a58795422121625be7fbe47e8901485a1a8bc01e1907b8aea0a9b",
"",
"mention"
],
[
"p",
"c67cd3e1a83daa56cff16f635db2fdb9ed9619300298d4701a58e68e84098345",
"",
"mention"
]
],
"content": "```python\nfrom nostr_protocol import Keys, Nip19Profile\n# OR `from nostr_sdk import Keys, Nip19Profile`\n\nkeys = Keys.parse(\"\u003cprivate-key\u003e\") # nsec or hex\npublic_key = keys.public_key()\n\nprofile = Nip19Profile(public_key, relays=[\"wss://relay.damus.io\"])\nprint(f\"NIP-19: {profile.to_bech32()}\")\nprint(f\"NIP-21: {profile.to_nostr_uri()}\")\n```\n\nYou can learn more here (NIP-19 and NIP-21 sections): https://rust-nostr.org/",
"sig": "efc9fe0d6b63629a22606d03058e75b1b66e37c9ad673e7136d1c13f91536c4e9cc41a27a953d7b7b3d74b5f5a9bd6a08051da6b233b059dfd0ac62b2095b825"
}