mirror of
https://github.com/fiatjaf/nak.git
synced 2026-06-05 02:01:27 +02:00
gift unwrap: verify seal signature before trusting pubkey
The CLI gift unwrap path skips seal signature verification that nip59.GiftUnwrap() performs. Without this check, a forged seal with an arbitrary pubkey would be trusted for decryption key lookup and sender identity. Fixes https://github.com/fiatjaf/nak/issues/110 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
4
gift.go
4
gift.go
@@ -239,6 +239,10 @@ a decoupled key (if it has been created or received with "nak dekey" previously)
|
||||
return fmt.Errorf("not a seal event (kind %d)", seal.Kind)
|
||||
}
|
||||
|
||||
if !seal.VerifySignature() {
|
||||
return fmt.Errorf("seal signature is invalid")
|
||||
}
|
||||
|
||||
senderEncryptionPublicKeys := []nostr.PubKey{seal.PubKey}
|
||||
if theirEPub, exists := getDecoupledEncryptionPublicKey(ctx, seal.PubKey); exists {
|
||||
senderEncryptionPublicKeys = append(senderEncryptionPublicKeys, seal.PubKey)
|
||||
|
||||
Reference in New Issue
Block a user