Skip to content

Commit 43cdf55

Browse files
lib: add JSON instance to Signature type (#1764)
Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
1 parent bc5ea42 commit 43cdf55

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/Simplex/Messaging/Crypto.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,13 @@ instance CryptoSignature (Signature s) => StrEncoding (Signature s) where
816816
strDecode = decodeSignature
817817
{-# INLINE strDecode #-}
818818

819+
instance CryptoSignature (Signature s) => ToJSON (Signature s) where
820+
toJSON = strToJSON
821+
toEncoding = strToJEncoding
822+
823+
instance CryptoSignature (Signature s) => FromJSON (Signature s) where
824+
parseJSON = strParseJSON "Signature"
825+
819826
instance CryptoSignature (Signature s) => Encoding (Signature s) where
820827
smpEncode = smpEncode . signatureBytes
821828
{-# INLINE smpEncode #-}

0 commit comments

Comments
 (0)