mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-06-18 12:52:51 +02:00
nip46: only use nip44 for encrypting requests and responses (breaking).
This commit is contained in:
parent
579172e5b7
commit
4346158f83
@ -54,7 +54,7 @@ func (s Session) MakeResponse(
|
|||||||
}
|
}
|
||||||
|
|
||||||
jresp, _ := json.Marshal(resp)
|
jresp, _ := json.Marshal(resp)
|
||||||
ciphertext, err := nip04.Encrypt(string(jresp), s.SharedKey)
|
ciphertext, err := nip44.Encrypt(string(jresp), s.ConversationKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return resp, evt, fmt.Errorf("failed to encrypt result: %w", err)
|
return resp, evt, fmt.Errorf("failed to encrypt result: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ type BunkerClient struct {
|
|||||||
pool *nostr.SimplePool
|
pool *nostr.SimplePool
|
||||||
target string
|
target string
|
||||||
relays []string
|
relays []string
|
||||||
sharedSecret []byte // nip04
|
|
||||||
conversationKey [32]byte // nip44
|
conversationKey [32]byte // nip44
|
||||||
listeners *xsync.MapOf[string, chan Response]
|
listeners *xsync.MapOf[string, chan Response]
|
||||||
expectingAuth *xsync.MapOf[string, struct{}]
|
expectingAuth *xsync.MapOf[string, struct{}]
|
||||||
@ -103,7 +102,6 @@ func NewBunker(
|
|||||||
clientSecretKey: clientSecretKey,
|
clientSecretKey: clientSecretKey,
|
||||||
target: targetPublicKey,
|
target: targetPublicKey,
|
||||||
relays: relays,
|
relays: relays,
|
||||||
sharedSecret: sharedSecret,
|
|
||||||
conversationKey: conversationKey,
|
conversationKey: conversationKey,
|
||||||
listeners: xsync.NewMapOf[string, chan Response](),
|
listeners: xsync.NewMapOf[string, chan Response](),
|
||||||
expectingAuth: xsync.NewMapOf[string, struct{}](),
|
expectingAuth: xsync.NewMapOf[string, struct{}](),
|
||||||
@ -226,7 +224,7 @@ func (bunker *BunkerClient) RPC(ctx context.Context, method string, params []str
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
content, err := nip04.Encrypt(string(req), bunker.sharedSecret)
|
content, err := nip44.Encrypt(string(req), bunker.conversationKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("error encrypting request: %w", err)
|
return "", fmt.Errorf("error encrypting request: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user