From 43cdf55f3bc45692dfe96c3e3eb81b8548feada7 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Tue, 14 Apr 2026 19:47:20 +0100 Subject: [PATCH] lib: add JSON instance to Signature type (#1764) Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com> --- 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 9cc78acb3..754f55480 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 #-}