mirror of
https://github.com/fiatjaf/nak.git
synced 2026-10-05 15:18:23 +00: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:
committed by
fiatjaf
co-authored by
Claude Opus 4.6
parent
6ee60cb197
commit
d0c291b25c
@@ -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