Refactor to provide better type safety
This is a breaking change meant to provide better type safety for consumers of this API and also to support the uses of encryption we do in Passit more easily, that extend beyond the simple Alice and Bob example.
crypto.ts
- Use only one representation (mostly binary) in all the files, so that we can remove code from each function that changes between binary and string if necessary
- Move encryption/decryption of private keys into functions that are not tied to a key pair
asymmetric_encryption.ts
- Break up
Asym
class into multiple different classes, each representing some binary data, in order to support composing them easier without any Asym state object to understand. - Provide better type safety for binary data by creating different classes for encrypted data, keys, and UTF8 encoded data.
Edited by Saul Shanabrook