Implement encryptor in keystore library#1587
Conversation
✅ API Diff Results - No breaking changes |
* Wip * Basic signer test * Errors new * Fix merge * Remove unnecessary lock
| const ( | ||
| // Maximum payload size for encrypt/decrypt operations (100kb) | ||
| // Note just an initial limit, we may want to increase this in the future. | ||
| MaxEncryptionPayloadSize = 100 * 1024 |
There was a problem hiding this comment.
Do we allow users to pass in a limit when creating the keystore? Agree this is fine for now, but since we're going to be trusting clients to use this correctly, it would make sense for them to be able to provide the limit. (Maybe we can follow the OCR model of having a MaxMax limit)
There was a problem hiding this comment.
We don't yet but yep we can add a user facing limit with an underlying MaxMax
| k.mu.RLock() | ||
| defer k.mu.RUnlock() | ||
|
|
||
| if len(req.EncryptedData) == 0 || len(req.EncryptedData) > MaxEncryptionPayloadSize*2 { |
There was a problem hiding this comment.
Is this potentially brittle? Can we document how we got to this number and under what circumstances it would change
There was a problem hiding this comment.
yeah I think it'd be possible in principle that we introduce some new scheme which has enormous overhead/envelope size (more than 2x), but exceedingly unlikely. Perhaps better to have explicit envelope sizes per type (at least the existing ones so far are fixed so we can start with that). Can do in a follow up
Note signer impl already reviewed.