First of all: DO NOT USE THIS PROGRAM! It's probably horribly insecure and broken.
But, since pinentry-mac stopped working after the latest MacOS update, I had to come up with a solution fast. Which is this pile of Javascript spaghetti code.
For further information about the underlying protocl, see the pinentry protocol description and assuan manual.