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

Implement SecretType::into_secret #271

Closed
IvanUkhov opened this issue May 6, 2024 · 2 comments · Fixed by #272
Closed

Implement SecretType::into_secret #271

IvanUkhov opened this issue May 6, 2024 · 2 comments · Fixed by #272

Comments

@IvanUkhov
Copy link
Contributor

It would be helpful to have a method to get the ownership of the underlying string back. What do you think?

@ramosbugs
Copy link
Owner

Hey @IvanUkhov,

This sounds reasonable. The Rust idiom I often see is an accessor method called inner() that returns a reference and another method called into_inner() that takes ownership and returns the inner value. Since the secret types currently have an accessor called secret(), it would probably make sense to call the new method into_secret() instead of implementing the From trait. This naming also helps remind callers that they're dealing with a sensitive value they should be careful with, which may help keep these secrets out of logs or other undesirable sinks.

@IvanUkhov IvanUkhov changed the title Implement From<SecretType> for String Implement SecretType::into_secret May 7, 2024
@IvanUkhov
Copy link
Contributor Author

Clear. Done in #272.

ramosbugs pushed a commit that referenced this issue May 7, 2024
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

Successfully merging a pull request may close this issue.

2 participants