With two separate instances, no message appears when sending encrypted message to other instance
In two separate terminals I have nostr running. When I attempt to send a private message to the public key of instance 2, I see no message appear.
I obtain the public key of Instance 2 using NostrBasics.Keys.PublicKey.to_npub(pubkey)
NostrApp.send_encrypted_direct_messages("npub1ngza9xfjwyt5xqktjt03aac6lnjzqvn8lskmvfpargya8k6rrkasswux8u", "hello")
Instance 1:
.iex.local.exs
relays = [
"wss://relay.nostr.bg",
"wss://relay.nostr.pro"
]
nsec = "nsec...lg"
{:ok, pkey} = NostrBasics.Keys.PrivateKey.from_nsec(nsec)
NostrApp.start_link(relays, pkey)
{:ok, pubkey} = NostrBasics.Keys.PublicKey.from_private_key(pkey)
NostrApp.timeline(pubkey)
NostrApp.encrypted_direct_messages
Instance 2:
.iex.local.exs
relays = [
"wss://relay.nostr.bg",
"wss://relay.nostr.pro"
]
nsec = "nsec...ru"
{:ok, pkey} = NostrBasics.Keys.PrivateKey.from_nsec(nsec)
NostrApp.start_link(relays, pkey)
{:ok, pubkey} = NostrBasics.Keys.PublicKey.from_private_key(pkey)
NostrApp.timeline(pubkey)
NostrApp.encrypted_direct_messages
Probably because you first need to make sure both accounts follow each other...
Brand new accounts technically follow no one, so it makes sense that their timelines contains nothing.
My bad, pilot error.
Still having trouble receiving a message:
~~~~~~~~~~
INSTANCE B)
~~~~~~~~~~
iex(17)> {:ok, follow_pubkey} = NostrBasics.Keys.PublicKey.from_npub("npub1wnpd8xykcg3rs90c463f0yaqq7st9upxyz4fe5q697cttnp3nazq8fehvc")
iex(17)> NostrBasics.Keys.PublicKey.to_npub(pubkey)
:ok
iex(18)>
21:47:13.211 [info] sent an follow command for t�Ә��"8^U������^G���& ���^Z/���1�D
21:47:13.464 [info] wss://relay.nostr.bg sent d0ec041d5eac388a010c89b8f8b12817904c748ff29ef79061137bc3b21449ea: true
~~~~~~~~~~
INSTANCE A)
~~~~~~~~~~
21:47:53.065 [info] HTTP connection to wss://relay.nostr.pro
iex(20)> {:ok, friend_pubkey} = NostrBasics.Keys.PublicKey.from_npub("npub1ngza9xfjwyt5xqktjt03aac6lnjzqvn8lskmvfpargya8k6rrkasswux8u")
{:ok,
<<154, 5, 210, 153, 50, 113, 23, 67, 2, 203, 146, 223, 30, 247, 26, 252, 228,
32, 50, 103, 252, 45, 182, 36, 61, 26, 9, 211, 219, 67, 29, 187>>}
iex(21)> NostrApp.follow(friend_pubkey)
:ok
iex(22)>
21:48:03.522 [info] sent an follow command for �^Eҙ2q^WC^B˒�^^�^Z�� 2g�-�$=^Z ��C^]�
21:48:03.819 [info] wss://relay.nostr.bg sent 4118b35aa92f6567bb2ad3cb59f6c7a46b9f5a2749f0e1da21c8130932b13d64: true
~~~~~~~~~~
INSTANCE B)
~~~~~~~~~~
iex(23)> NostrApp.send_encrypted_direct_messages("npub1wnpd8xykcg3rs90c463f0yaqq7st9upxyz4fe5q697cttnp3nazq8fehvc", "hello")
:ok
iex(24)>
21:49:18.120 [info] sent an encrypted direct message command
21:49:18.248 [info] wss://relay.nostr.bg sent 410be9cf3b4411c0481e1e059d621ef3e01ae4b284a4bb35256d416bf8d9da35: true
Expected: seeing a message in INSTANCE A) terminal Actual: no message