@hongminhee Here is some code for verifying and creating LD Signatures https://codeberg.org/rimu/pyfedi/src/commit/1a658d007fa6259ea736005b818ae516a954bb16/app/activitypub/signature.py#L429
I tested it out last week but haven't used it in production - this was originally copied from Takahe so I assume it works well with Mastodon.