Oddbean new post about | logout
 That solved that error.

# command-line-arguments
./nostrlogger.go:16:17: undefined: nostr.DerivePublicKey
./nostrlogger.go:18:19: undefined: nostr.EncodePrivateKey
./nostrlogger.go:20:19: undefined: nostr.EncodePublicKey
./nostrlogger.go:34:3: unknown field Type in struct literal of type nostr.Event
./nostrlogger.go:35:3: unknown field Payload in struct literal of type nostr.Event
./nostrlogger.go:39:3: unknown field Timestamp in struct literal of type nostr.Event
./nostrlogger.go:40:3: unknown field Signature in struct literal of type nostr.Event
./nostrlogger.go:40:17: sk.Sign undefined (type string has no field or method Sign)
./nostrlogger.go:45:14: undefined: nostr.Publish
 
 Did you run 

go get github.com/nbd-wtf/go-nostr

? 
 Yes

 undefined: nostr.DerivePublicKey

nostr is never defined anywhere  
 import ... go-nostr should define it. 🤔

Let me try to compile it in termux 
 Looks like your nsec section shoud be like this?

  pk, _ := nostr.GetPublicKey(sk)
    nsec, _ := nip19.EncodePrivateKey(sk)
    npub, _ := nip19.EncodePublicKey(pk) 
 
 Does this compile? 
 It moves on
 Looks like the entite  event section is wrong too. Nothing like the sample   
 Need to read the code for .Publish() to see how to construct the event struct for DM 
 It's KindEncryptedDirectMessage. This is the struct. nip4.go has encryption functions

ev := nostr.Event{
	PubKey:    pub,
	CreatedAt: nostr.Now(),
	Kind:      KindEncryptedDirectMessage,
	Tags:      nil,
	Content:   need to encrypt this,
}