Swift CryptoKit and Browser

1 · Fabien Penso · April 6, 2021, 7:30 p.m.
This previous article explains how to read ChaCha20-Poly encrypted data using Ruby or Python. My first goal is to ensure other languages can read data encrypted within Beam, but the end goal is to decrypt it within your browser, using client-side HTML and Javascript. Sadly, WebCrypto omits ChaCha20-Poly, and I had to move to AES-GCM instead. This extensive documentation says to use additionalData for the tag part, but that never worked on my code, and I had to do that manually. Use the following...