Skip to content

Implement SecretType::into_secret#272

Merged
ramosbugs merged 1 commit intoramosbugs:mainfrom
IvanUkhov:into-secret
May 7, 2024
Merged

Implement SecretType::into_secret#272
ramosbugs merged 1 commit intoramosbugs:mainfrom
IvanUkhov:into-secret

Conversation

@IvanUkhov
Copy link
Copy Markdown
Contributor

Closes #271.

/// Leaking this value may compromise the security of the OAuth2 flow.
pub fn secret(&self) -> &$type { &self.0 }

#[doc = $secret_doc]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeating the same docstring, as it is rather general.

#[test]
fn test_secret_conversion() {
let secret = CsrfToken::new("top_secret".into());
assert_eq!(secret.into_secret().into_boxed_str(), "top_secret".into());
Copy link
Copy Markdown
Contributor Author

@IvanUkhov IvanUkhov May 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to use a method present exclusively in the owned value.

@ramosbugs ramosbugs merged commit daf4db6 into ramosbugs:main May 7, 2024
@ramosbugs
Copy link
Copy Markdown
Owner

Thanks!

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 this pull request may close these issues.

Implement SecretType::into_secret

2 participants