How can I save the return of the signed variable in a binary file?
Here's my code:

Here's the browser's console:

Note that I'm using Chrome browser environment and not Node.js. Would that be possible?
Hey :wave: The code you commented out seems like a good start.
Do you want the binary signature to contain the message itself, or not? Right now it won't, I'm guessing since you wrote detached: false that you want it to.
To achieve that, change openpgp.cleartext.fromText to openpgp.message.fromText, and message.signature.packets.write() to message.packets.write().
Let me know if that's not what you want or if you have any other issues.
Thanks for the quick response. I applied the changes and here's what I got now:

What should I do next? I would like to save it to HelloWorld.txt.sig.
Here's a sample signed file that we're expecting:

I used Kleopatra to do that. So does producing a file like that possible in the browser side only?
What should I do next? I would like to save it to file.pgp.
Take a look at download.js. You can make a Blob from a Uint8Array.
Another question though: does the signature contain both data and signature?
Hard to tell, could you post your full new code again?
Thanks a lot, it worked! I was able to verify the signed file.
I guess my next question would probably be is there another way aside form download.js to save the file? We have our own API to create file and it requires a base64 I believe. I guess what's the best practice for converting Uint8Array to base64?
There's a deprecated FileSystem API in Chrome, and some efforts to replace it, but nothing generally supported, I believe.
I guess what's the best practice for converting Uint8Array to base64?
openpgp.util.Uint8Array_to_b64 should work :)
It all works now! Thanks a lot, really great help!
Most helpful comment
Take a look at download.js. You can make a
Blobfrom aUint8Array.Hard to tell, could you post your full new code again?