From 2a410940c580fa8f02d60efafba5303a247db3f8 Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Sun, 12 Apr 2026 14:20:15 +0000 Subject: [PATCH] lib: add JSON instance to Signature type --- src/Simplex/Messaging/Crypto.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Simplex/Messaging/Crypto.hs b/src/Simplex/Messaging/Crypto.hs index 9cc78acb30..754f554802 100644 --- a/src/Simplex/Messaging/Crypto.hs +++ b/src/Simplex/Messaging/Crypto.hs @@ -816,6 +816,13 @@ instance CryptoSignature (Signature s) => StrEncoding (Signature s) where strDecode = decodeSignature {-# INLINE strDecode #-} +instance CryptoSignature (Signature s) => ToJSON (Signature s) where + toJSON = strToJSON + toEncoding = strToJEncoding + +instance CryptoSignature (Signature s) => FromJSON (Signature s) where + parseJSON = strParseJSON "Signature" + instance CryptoSignature (Signature s) => Encoding (Signature s) where smpEncode = smpEncode . signatureBytes {-# INLINE smpEncode #-}