diff --git a/internal/nostr/models.go b/internal/nostr/models.go index 7ca9f02..b27469c 100644 --- a/internal/nostr/models.go +++ b/internal/nostr/models.go @@ -13,7 +13,8 @@ const ( NIP_47_INFO_EVENT_KIND = 13194 NIP_47_REQUEST_KIND = 23194 NIP_47_RESPONSE_KIND = 23195 - NIP_47_NOTIFICATION_KIND = 23196 + LEGACY_NIP_47_NOTIFICATION_KIND = 23196 + NIP_47_NOTIFICATION_KIND = 23197 REQUEST_EVENT_PUBLISH_CONFIRMED = "CONFIRMED" REQUEST_EVENT_PUBLISH_FAILED = "FAILED" @@ -169,6 +170,7 @@ type NIP47NotificationRequest struct { WebhookUrl string `json:"webhookUrl"` WalletPubkey string `json:"walletPubkey"` ConnPubkey string `json:"connectionPubkey"` + Version string `json:"version"` } type NIP47PushNotificationRequest struct { @@ -177,6 +179,7 @@ type NIP47PushNotificationRequest struct { WalletPubkey string `json:"walletPubkey"` ConnPubkey string `json:"connectionPubkey"` IsIOS bool `json:"isIOS"` + Version string `json:"version"` } type NIP47Response struct { diff --git a/internal/nostr/nostr.go b/internal/nostr/nostr.go index 2690910..3fac226 100644 --- a/internal/nostr/nostr.go +++ b/internal/nostr/nostr.go @@ -549,7 +549,11 @@ func (svc *Service) NIP47NotificationHandler(c echo.Context) error { Open: true, Since: time.Now(), Authors: &[]string{requestData.WalletPubkey}, - Kinds: &[]int{NIP_47_NOTIFICATION_KIND}, + Kinds: &[]int{LEGACY_NIP_47_NOTIFICATION_KIND}, + } + + if (requestData.Version == "1.0") { + subscription.Kinds = &[]int{NIP_47_NOTIFICATION_KIND} } tags := make(nostr.TagMap) diff --git a/internal/nostr/push.go b/internal/nostr/push.go index d473528..bab2df9 100644 --- a/internal/nostr/push.go +++ b/internal/nostr/push.go @@ -88,7 +88,11 @@ func (svc *Service) NIP47PushNotificationHandler(c echo.Context) error { Open: true, Since: time.Now(), Authors: &[]string{requestData.WalletPubkey}, - Kinds: &[]int{NIP_47_NOTIFICATION_KIND}, + Kinds: &[]int{LEGACY_NIP_47_NOTIFICATION_KIND}, + } + + if (requestData.Version == "1.0") { + subscription.Kinds = &[]int{NIP_47_NOTIFICATION_KIND} } tags := make(nostr.TagMap)