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

Missing clearPrivateParams from TS definitions #1710

Open
nishils opened this issue Dec 13, 2023 · 3 comments
Open

Missing clearPrivateParams from TS definitions #1710

nishils opened this issue Dec 13, 2023 · 3 comments

Comments

@nishils
Copy link

nishils commented Dec 13, 2023

  • OpenPGP.js version: 5.11.0
  • Affected platform (Browser or Node.js version): both

The typescript definitions for PrivateKey is missing the clearPrivateParams() function

The same is also true for the typescript definition of SecretKeyPacket.

@larabr
Copy link
Collaborator

larabr commented Dec 14, 2023

Hi, thanks for the report, see https://github.com/openpgpjs/openpgpjs?tab=readme-ov-file#typescript .

Do you have a use case for calling the function directly on a SecretKeyPacket?

@nishils
Copy link
Author

nishils commented Dec 15, 2023

I had a similar issue as #1431 (comment) so I was attempting to resolve the issue using the recommended code snippet. That code snippet calls clearPrivateParams()

@larabr
Copy link
Collaborator

larabr commented Dec 18, 2023

I see, IMO it's too much of a corner case to justify "exposing" that specific method via TS, as it's easy to misuse, and automatically called internally for the standard cases. That said, there is a good case to add the higher level PrivateKey.clearPrivateParams() type , as it can be used to remove traces of the key material from memory when an app is exiting (without re-encrypting the keys), for instance.

If you're up for it, a PR adding the type definition is welcome 😄

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

No branches or pull requests

2 participants