Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistyped parameter in method update of Decipher class #68693

Open
pbesret opened this issue Feb 19, 2024 · 6 comments
Open

Mistyped parameter in method update of Decipher class #68693

pbesret opened this issue Feb 19, 2024 · 6 comments

Comments

@pbesret
Copy link

pbesret commented Feb 19, 2024

Hi there, I think the type defined here for the parameter inputEncoding with the signature method using a Buffer is wrong and should support Encoding too.

update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string;

Imo, inputEncoding property should have the same types as in this signature :

update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string;

Best regards,
Paul.

@pbesret
Copy link
Author

pbesret commented Feb 20, 2024

Please can an moderator delete this....

@cweijan
Copy link

cweijan commented Feb 21, 2024

Here are the responses about this parameter: #59476

@pbesret
Copy link
Author

pbesret commented Feb 21, 2024

Thanks for you answer. I don't understand, since it would be an unique signature even without the inputEncoding parameter with a Buffer, why can't we just remove this parameter if it is ignored ? Is it a retro-compatibility issue ? In which case we could mark it as deprecated.

@cweijan
Copy link

cweijan commented Feb 21, 2024

According to @SimonSchick's reply, the second parameter is ignored and the user should not pass it 😀.

@pbesret
Copy link
Author

pbesret commented Feb 21, 2024

That doesn't answer the "why" can't we remove this parameter if it is ignored anyway ^^

@SimonSchick
Copy link
Contributor

See https://nodejs.org/api/crypto.html#decipherupdatedata-inputencoding-outputencoding according to the docs inputEncoding still needs to be specified in order to be able to specify outputEncoding.

Please provide your use case or example of why this should not be the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@SimonSchick @cweijan @pbesret and others