Closed gauntface closed 8 years ago
When would a developer ever want the buffer vs string? If it's rare, or only the advanced dev who wants the buffer, then let's just drop it.
These libraries should cover the 80% use case, not every use case. If a dev wants something special, they can use the the library as their starting point and add the custom functionality they need.
The ciphertext at least MUST be raw bytes. But yeah, maybe the other two should come back as strings. On Fri, 26 Feb 2016 at 15:23 Pete LePage notifications@github.com wrote:
When would a developer ever want the buffer vs string? If it's rare, or only the advanced dev who wants the buffer, then let's just drop it.
These libraries should cover the 80% use case, not every use case. If a dev wants something special, they can use the the library as their starting point and add the custom functionality they need.
— Reply to this email directly or view it on GitHub https://github.com/GoogleChrome/push-encryption-node/issues/7#issuecomment-189321411 .
cc @wibblymat @petele @PaulKinlan @beverloo
At the moment the output of encrypt are buffers, given that some fields need to be url safe base64 encoded and some don't (I can't recall which) and given this is accessible on the index object, it feels a bit unfriendly to return a buffer.
We could by default return a string for ciphertext, salt and serverpublickey and have an option on the encrypt method to return buffer (just a boolean) that if set to true will return the buffer (useful for internal usage of encrypt).