Web Crypto API
Published on April 06, 2021← Back to tips
Provides a standard way to work with cryptographic algorithms on the web.
Encrypt, decrypt, verify and/or sign content right in your browser.
You can generate a cryptographic key using 10 different algorithms, from older RSA-PSS to AES-GCM or ECDSA.
The API requires you to specify only the algorithm to be used and the purpose of the key.
Once generated, you can use the key object to encrypt/decrypt any data.
In addition, you need an initialization vector(also known as nonce) for encryption, which complements the whole process.
And using the same nonce, the other party can decrypt the already encrypted data.
PS: All data operations using the crypto API return array buffers.
Who uses it?
Excalidraw (@excalidraw), a virtual whiteboard for sketching hand-drawn like diagrams, uses the crypto API for saving the diagrams for facilitating collaboration.
More reading Down pointing backhand index https://w3.org/TR/WebCryptoAPI/
I talk about the latest in frontend, along with my experience in building various (Indie) side-projects