This differential brings WebCrypt API typing to keyserver and enables AES crypto stack implemented for web to be used on the keyserver as well
Details
Use aes-crypto-utils.js to encrypt and decrypt simple string on the keyserver. Ensure that encryption and decryption is succesfull and flow does not complain.
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
keyserver/src/utils/aes-crypto-utils.js | ||
---|---|---|
13 ↗ | (On Diff #28756) | An alternative would be to implement AES encryption on the keyserver from scratch using the part of crypto API that comes typed in flow. I thought about this and it has two disadvantages:
|
web/flow-typed/web-crypto.js | ||
283 ↗ | (On Diff #28756) | An alternative would be to move this entire file to lib and insert webcrypto into global on the keyserver so that the statement declare var crypto: Crypto; is true. However, the crypto on the keyserver is a library and we don't just insert libraries into global so that they don't need to be imported. Therefore I moved only the types to the lib and left global declaration on web. |
web/media/aes-crypto-utils.js | ||
10 ↗ | (On Diff #28756) | I could remove this file and use function from lib directly, but I didn't want to affect to much code and leave this layer of abstraction unchanged. |
keyserver/src/utils/aes-crypto-utils.js | ||
---|---|---|
13 ↗ | (On Diff #28756) | I agree we should not reimplement it. This any-cast is safe, since you immediately cast it to another type |
15–31 ↗ | (On Diff #28756) | In all three of these cases, your use of async / await is not necessary, and results in unnecessary computation. Instead, you can simplify forward the Promise |
Remove web/media/aes-crypto-utils.js from the scope of this diff, so that it can be handled in separate diff