An electronic signature is in many processes legally sufficient to prove an identity. According to the U.S. Federal ESIGN Act passed in 2000, an electronic signature is an:
Electronic sound, symbol, or process, attached to or logically associated with a contract or other record and executed or adopted by a person with the intent to sign the record.
The template contains a TextFrame with a specific Name that specifies that the content of this frame should be replaced with a signature. The signature stamp itself consists of an image placeholder and a merge field that gets merged using the MailMerge class. The signature stamp is stored in a sub-template and can be edited separately from the main template.
Download the sample from GitHub and test it on your own.