package kind // Musiquay kind block. // // The block is described in docs/ARCHITECTURE.md of the musiquay specification. // Addressable kinds occupy 32210-32217; the regular (immutable) kinds are 3221, // 3222, 3223, 3224, 32218, 32219, and 32220. Kind 22243 is ephemeral and lives // outside the block. All of these values were checked against the Nostr // registry of kinds for collisions before adoption. // // Do not renumber: the values are on the wire and are referenced by the // specification documents, the acceptance tests, and the relay policy. var ( // PlayReport is a regular kind carrying an auditable play report. It is // certified with a BDHKE blind signature and a NUT-12 DLEQ proof, so the // host never learns which listener a certified play belongs to. PlayReport = &K{3221} // PurchaseOrder is a regular kind carrying a private purchase order. It is // only ever transported inside a NIP-59 gift wrap; the relay sees 1059. PurchaseOrder = &K{3222} // EntitlementDeed is a regular kind carrying an owner-signed entitlement // deed. The deed is a signed event inside the NIP-59 seal (not a rumor) so // that a host which is not the recipient can verify it. EntitlementDeed = &K{3223} // AssetIdentity is a regular kind carrying the signed record that maps a // stable asset id to the current addressable coordinate. It is keyed by a // regular "d" tag holding the asset id so hosts can query it by address. AssetIdentity = &K{3224} // Track is the addressable kind for a recording. Every published encoding // of the recording hangs off one track event as a Blossom blob. Track = &K{32210} // Album is the addressable kind for a release. Album = &K{32211} // Playlist is the addressable kind for an ordered list of track references. Playlist = &K{32212} // Setlist is the addressable kind for a per-artist song list for an event. Setlist = &K{32213} // ReleaseCredits is the addressable kind for structured release credits. ReleaseCredits = &K{32214} // TrackCredits is the addressable kind for per-track credit overrides. TrackCredits = &K{32215} // Edition is the addressable kind for a format-specific release edition. Edition = &K{32216} // AccessFilter is the addressable kind for an access filter event. It points // at a Blossom blob holding the exact Golomb-coded membership set. AccessFilter = &K{32217} // DeliveryReceipt is a regular kind carrying a private host-signed delivery // receipt. Like the purchase order it is only transported inside a NIP-59 // gift wrap. DeliveryReceipt = &K{32218} // HostAggregate is a regular kind carrying a host's public aggregate totals // for one asset and one period. HostAggregate = &K{32219} // PublisherRollup is a regular kind carrying a publisher's rollup over // surviving host aggregates. PublisherRollup = &K{32220} // DeedPresentation is an ephemeral kind carrying a buyer-signed proof of // possession of a deed, bound to a deed id, the requested asset, a server, // a client nonce, and a timestamp. DeedPresentation = &K{22243} ) // MusiquayAddressable is the set of addressable kinds in the block. var MusiquayAddressable = []*K{ Track, Album, Playlist, Setlist, ReleaseCredits, TrackCredits, Edition, AccessFilter, } // MusiquayRegular is the set of immutable (regular) kinds in the block. var MusiquayRegular = []*K{ PlayReport, PurchaseOrder, EntitlementDeed, AssetIdentity, DeliveryReceipt, HostAggregate, PublisherRollup, } // MusiquayAll is every kind the relay must accept for musiquay, including the // ephemeral presentation proof. var MusiquayAll = []*K{ PlayReport, PurchaseOrder, EntitlementDeed, AssetIdentity, Track, Album, Playlist, Setlist, ReleaseCredits, TrackCredits, Edition, AccessFilter, DeliveryReceipt, HostAggregate, PublisherRollup, DeedPresentation, } // MusiquayPrivate is the set of kinds that must never be published as plain // events: orders, deeds, and receipts belong only inside a NIP-59 gift wrap. // A public event of one of these kinds is a policy violation. var MusiquayPrivate = []*K{ PurchaseOrder, EntitlementDeed, DeliveryReceipt, } // musiquayAllSet is the lookup form of MusiquayAll, built once at init. var musiquayAllSet = func() (m map[uint16]bool) { m = make(map[uint16]bool, len(MusiquayAll)) for _, k := range MusiquayAll { m[k.ToU16()] = true } return }() // IsMusiquay reports whether a kind number belongs to the musiquay block. func IsMusiquay(k uint16) bool { return musiquayAllSet[k] } // IsMusiquayPrivate reports whether a kind must only travel inside a gift wrap. func IsMusiquayPrivate(k uint16) bool { for _, p := range MusiquayPrivate { if p.ToU16() == k { return true } } return false } // IsMusiquayAddressable reports whether a kind is addressable in the block. func IsMusiquayAddressable(k uint16) bool { for _, a := range MusiquayAddressable { if a.ToU16() == k { return true } } return false }