At @nos.social we did some similar work on top of your library for a probably incomplete version of Nip-17 but it may be useful anyways https://github.com/planetary-social/nos/blob/aebbcb7353ec5cc34584bc3c802ddb6b754cb6ad/Nos/Service/GiftWrapper.swift